官方工作流

Explore、Plan、Code、Commit:Claude Code 工作流

Anthropic 的四步循环,让 Claude Code 真正干活——根据官方演示视频配图,每一步都链接到视频的精确秒数。

Claude Code plan approval screen with verification checklist from the official explore plan code commit workflow video
计划批准是整个工作流的枢纽:在让 Claude 写代码之前,先读完那份验证清单。

共 12 步的图文教程,阅读约 4 分钟。每一步都可回跳到来源视频中的精确时刻。

速览

别把任务一贴了事。进入 plan 模式(Shift+Tab),让 Claude 探索代码库并提出计划,审阅并修改计划,批准后开着 accept-edits 让它写代码。保持测试可信,把反复出现的修复写进 CLAUDE.md,最后让 Claude 按你的风格生成提交。探索喂给计划,计划就是验收标准,提交时你仍然说了算。

关于来源视频

本页配图整理自 Anthropic 官方的 Claude Code 工作流视频(由 Lewis Menelaws 讲解),每一步都附视频精确时间戳。

截图取自视频并署名 Anthropic;文字部分为本站原创。步骤已于 2026 年 9 月对照视频核实。

Explore:先给 Claude 上下文

只读调研先行——不碰任何文件。

  1. 1

    写代码之前先走两步

    Anthropic 的核心建议:先探索,再计划,然后写代码,最后提交。直接甩一句「帮我实现这个功能」意味着后面要花更多时间纠偏。plan 模式是跑完前两步最快的方式,因为它不能编辑文件——只能阅读和调研。

    Explore and Plan phase card from Anthropic Claude Code workflow guide introducing the first two steps of the explore plan code commit loop
    本页要带你走完的循环,原样来自官方。视频 0:20 处
  2. 2

    每次会话都从上下文开始

    欢迎横幅会催你运行 /init,这正是关键:项目初期生成的 CLAUDE.md 会教之后每一次会话认识你的技术栈和命令。基础信息先写下来,后面的探索会便宜得多。

    Claude Code welcome banner suggesting Run /init to create a CLAUDE.md while the command initializes project documentation
    会话开始先 /init,CLAUDE.md 负责把上下文带下去。视频 1:04 处
  3. 3

    终端和浏览器一起用

    remote-control 横幅表示这个 CLI 会话已与 claude.ai/code 关联——你可以在浏览器里跟随同一个会话。代理在仓库里干活时,你想用网页端更清爽的排版看进度,这就很方便。

    Claude Code session showing remote-control is active with a claude.ai/code session link and plan mode on in the footer
    一个会话,两个入口:CLI 和 claude.ai/code。视频 0:32 处
  4. 4

    描述目标,而不是实现方式

    演示提示词:「My app needs a dark mode... Can you create a toggle switch based on my existing light theme? I need you to find a good contrast color...」目标加约束——plan 模式会先搞清楚东西在哪,再动手改。

    Plan mode prompt in Claude Code requesting a dark mode toggle with instructions to explore project structure and styles before writing code
    一个深色模式需求,被表述成「目标 + 约束」。视频 0:24 处
  5. 5

    看 Claude 探索你的代码库

    plan 模式下 Claude 会读文件、执行 grep,甚至搜索网页。执行轨迹显示 Explore 代理在读路由文件、跑 find 命令——动笔之前先用了十六次工具调用。这份调研正是计划的原料。

    Claude Code Explore agent researching an image upload pipeline with Read and Bash tool calls plus 16 more tool uses listed
    读取和查找——十六次工具调用,零次编辑。视频 2:40 处
  6. 6

    并行的探索代理

    更大的需求会被拆分研究:这里两个 Explore 代理同时摸清项目结构和现有配色,各自边干边汇报 token 消耗。你能亲眼看着上下文被收集起来,而不是祈祷它发生了。

    Claude Code running two Explore agents in parallel on a dark mode request with token counts shown and plan mode active
    两个探索代理,一个深色模式功能。视频 2:50 处

Plan:先就「什么算成功」达成一致

计划是纠偏成本最低的地方。

  1. 7

    选一个真实任务并划清范围

    演示示例:「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 Code plan mode prompt asking to add WebP conversion to an image upload pipeline and figure out dependencies and approach
    一条提示词,三个让 Claude 必须回答的明确问题。视频 0:40 处
  2. 8

    按「改动文件清单」读计划

    一份好计划读起来像更新日志:给 package.json 加 sharp、把上传处理器从磁盘存储切到内存存储、在处理器里做转换和写盘。哪一行让你意外,哪一行就是审阅重点。

    Claude Code plan output listing changes by file including adding sharp to package.json and switching uploads to memory storage
    计划按文件组织成一份份可以否决的改动。视频 0:56 处
  3. 9

    对着验证清单批准计划

    在写代码之前,Claude 会列出它打算怎么验证——安装成功、头像完成转换、损坏文件返回 422。然后你选:清空上下文并自动接受、仅自动接受、逐个批准,或直接打字反馈。这里就是纠偏的最佳时机。

    Claude Code plan approval with a verification checklist and four options including clear context and auto-accept edits
    先看验证步骤,再从四种推进方式里选一个。视频 0:52 处
  4. 10

    用问答环节修正计划

    Claude 可以就计划向你提问:看起来不错直接推进、更新计划、换一套深色配色、抽一个共享组件。答「2」再补一句话,就能换回一份修订过的计划,而不是日后重建一个代码库。

    Claude Code plan interview asking what to change before proceeding with options to update the plan, adjust dark colors, or skip and plan immediately
    现在就纠偏——这里的每个选项都比重写便宜。视频 2:54 处

Code 与 Commit:保持掌控

自动接受改动,在浏览器里验证,然后按你的风格提交。

  1. 11

    让 Claude 自己测 UI

    视频里的技巧:给 Claude 自我验证的工具。装上 Claude in Chrome 扩展后,它能驱动浏览器标签页、打开构建好的应用、在宣布完成前检查界面——这个登录页就是那条循环跑起来的样子。

    TaskFlow sign-in screen rendered in a browser during automated UI testing of a Claude Code build with email and password fields
    代理在真实浏览器标签页里检查过这个界面。视频 2:58 处
  2. 12

    用你的风格生成提交信息

    亲自验证结果之后,问一句「Can you create a commit for this?」——Claude 会把工作变成提交。页脚的 accept edits 提醒你这个模式还开着;回到谨慎模式时按 Shift+Tab 切换关闭。

    Claude Code commit step with the prompt Can you create a commit for this and the accept edits on footer visible
    一句话提示词,把完成的工作变成一次提交。视频 0:12 处

常见问题