让 Claude 深度阅读代码库。必须使用 deeply、in great details、intricacies、go through everything 等限定词——不加这些词,Claude 会认为浅层浏览就够了。
要求将研究结果写入持久化文件 research.md,绝不接受纯口头摘要。这份文档是你的审查面(review surface):可以在规划前发现 Claude 的误解,防止它忽略缓存层、违反 ORM 约定、或重复已有逻辑。
示例提示词:
read this folder in depth, understand how it works deeply, what it does
and all its specificities. when that's done, write a detailed report of
your learnings and findings in research.md
study the notification system in great details, understand the intricacies
of it and write a detailed research.md document with everything there is
to know about how notifications work
要求 Claude 生成详细的 plan.md,包含代码片段、文件路径和权衡考量。使用自定义 markdown 文件而非内置 plan mode(原文直言 "The built-in plan mode sucks"),原因有三:
对于边界清晰的功能,可提供开源项目中的参考实现——Claude 有具体参考时表现显著更好。
示例提示词:
I want to build a new feature <name and description> that extends the
system to perform <business outcome>. write a detailed plan.md document
outlining how to implement this. include code snippets
the list endpoint should support cursor-based pagination instead of
offset. write a detailed plan.md for how to achieve this. read source
files before suggesting changes, base the plan on the actual codebase
这是整套方法论最具差异化的环节。plan.md 是你和 Claude 之间的共享可变状态,支持位置精确的沟通。
plan.md"I added a few notes to the document, address all the notes and update the document accordingly. don't implement yet."don't implement yet — 每轮必须加上,防止 Claude 提前动手写代码。
批注的作用:将你的判断注入计划。
原文批注示例(长度从两个词到整段话不等):
经过数轮批注,计划将从通用方案收敛为适配项目的具体方案。
在计划定稿后、实现之前,单独生成一份细粒度的 todo 清单:
add a detailed todo list to the plan, with all the phases and individual
tasks necessary to complete the plan — don't implement yet
当所有决策在规划阶段验证通过后,实现就是机械执行而非创造性工作——创造性工作已在批注阶段完成。你的角色从架构师转为监工。
没有规划阶段的后果:Claude 会在早期做出看似合理但错误的假设,在其上构建约 15 分钟后才发现需要全部拆解。
标准启动指令(以 TypeScript 项目为例,其他语言请替换对应的类型检查工具和代码规范):
implement it all. when you're done with a task or phase, mark it as
completed in the plan document. do not stop until all tasks and phases
are completed. do not add unnecessary comments or jsdocs, do not use
any or unknown types. continuously run typecheck to make sure you're
not introducing new issues.
各分句用意:
implement it all — 做完所有事,不要挑着做mark it as completed — 用 plan 文档追踪进度do not stop — 不要中途暂停等待确认do not add unnecessary comments or jsdocs — 保持代码简洁do not use any or unknown types — 强制类型安全continuously run typecheck — 实时守住代码质量| 场景 | 做法 | 示例 |
|---|---|---|
| 小修正 | 极简指令 | wider、still cropped、there's a 2px gap |
| 检查遗漏 | 指出未实现的部分 | You didn't implement the deduplicateByTitle function |
| 纠正位置 | 指出放错地方的实现 | You built the settings page in the main app when it should be in the admin app, move it |
| 参考已有代码 | 指向具体位置 | this table should look exactly like the users table, same header, same pagination, same row density |
| UI 问题 | 直接贴截图 | 截图比文字描述精确得多 |
| 方向错误 | 回滚并重新规划 | I reverted everything. Now all I want is to make the list view more minimal — nothing else |
缩小范围后重新实现几乎总是比渐进修复错误方案效果更好。
不要给予 Claude 完全自主权。它可能提出技术上正确但对项目不合适的方案——过度工程化、破坏公开 API、或选择不必要的复杂方案。
| 操作 | 示例 |
|---|---|
| 挑选方案 | "for the first one, just use Promise.all, don't make it overly complicated; for the third one, extract it into a separate function for readability; ignore the fourth and fifth ones, they're not worth the complexity" |
| 裁剪范围 | "remove the download feature from the plan, I don't want to implement this now" |
| 保护接口 | "the signatures of these three functions should not change, the caller should adapt, not the library" |
| 推翻技术选择 | "use this library's built-in method instead of writing a custom one" |
分工原则:Claude 负责机械执行,人负责判断。计划捕获大决策,实现中的选择性指导处理新出现的问题。
在单次长会话中运行整个工作流。Claude Code 的 context window 会自动压缩(auto-compaction),而 plan.md 作为磁盘上的文件,在压缩后仍能以完整保真度保留。作者观察到,即使上下文窗口使用超过 50%,也没有出现性能下降。