ep06-explore-plan-code-commit

Claude Code 101 系列教程 · 第 6 课

Claude (Anthropic)

2026-05-20

Explore → Plan → Code → Commit
第 6 课 · Explore → Plan → Code → Commit

The Explore → Plan → Code → Commit Workflow

Claude Code 101 系列教程 · 第 6 课 · 来自 Claude 官方频道


Claude Code 最重要的工作流

如果你只从 Claude Code 记住一件事,那就是这个工作流:Explore → Plan → Code → Commit

大多数人的错误是直接让 Claude 写代码——这意味着后续需要更多的纠正。


第 1 步:Explore(探索)

最快的方式是进入 Plan Mode。在 Plan Mode 中,Claude 不能编辑文件,只能读取文件做研究

进入方式

Shift + Tab 直到输入框下方显示 Plan Mode。

示例 Prompt

I need to add WebP conversion to our image upload pipeline.
Figure out where in the pipeline it should happen,
whether we need new dependencies, and how to approach it.

Claude 会:

  1. 读取相关文件
  2. 做网络搜索
  3. 返回一份行动计划

Review 计划! 如果不满足要求,可以让 Claude 修改或补充。这是在代码编写之前纠错的最佳时机


第 2 步:Plan(规划)

当计划看起来不错,选择 Approve 接受计划。

Claude 会将计划中的所有待办项转换为可勾选的列表项,然后逐步执行。

你也可以不在 Plan Mode 中使用 Explore——只需直接让 Claude 探索你的代码库即可。


第 3 步:Code(编码)

决定 Claude 是 Auto Accept 文件编辑还是每次都要许可

Claude 会尽力排错,但有时你也需要介入纠正。

Plan Mode 的好处:计划完成后,Claude 拥有完整的上下文——它知道每一步是如何推导的,这有助于后续决策。

让 Claude 对结果有信心

在写计划时,明确写出成功的标准——Claude 需要知道什么才算”做对了”。

添加辅助工具

减少反复沟通的最好方式是给 Claude 配备合适的工具:

Claude 甚至可以帮你写测试。但要确保测试是你和团队的真相来源,避免假阳性。


第 4 步:Commit(提交)

测试通过、你满意后,就到了推送代码的时候。

提交前的 Tips

  1. 运行 Sub-agent Code Reviewer — 让另一个 Claude Agent 审查你的代码
  2. 让 Claude 生成 Commit Message — 按照你的风格自动生成
  3. Push — 推送代码,开始下一个功能

循环往复

Explore → Plan → Code → Commit → Explore → Plan → ...

本教程基于 Claude 官方视频 The Explore → Plan → Code → Commit Workflow 整理,属于 Claude Code 101 系列第 6 课。