🛠️ Build Your First Mini App with Claude Code · Week 1: From Zero to Your First Live Web Page

How to Use Claude Code Plan Mode: Get a Plan Before Any Code Is Written

For complex features, have it propose a plan first; you nod, then it writes

一句话先懂 · TL;DR

When to have Claude Code propose a plan instead of coding right away: multiple files, data structure changes, or when you haven't thought it through yourself. How to enter plan mode, what to ask, and how to judge whether a plan is good enough.

Two Ways of Working

By default, Claude Code starts acting the moment you finish talking. For changing a button color, that's fine. But say "add a categories feature" and it might touch 4 files and change the data format, and by the time you look up you can't follow it anymore.

Plan mode is the other way: it only reads the code, thinks through an approach, and writes it out for you to see, without changing a single line. You read it, nod, and then it executes.

进入方式:在输入框按 Shift+Tab 切换模式,切到「plan」;或者直接说:

「先别改代码。给我一个方案:加分类功能会动哪些文件、数据怎么存、空分类和重名分类怎么处理、做完怎么验证。」
💡How a non-programmer who built his own management system uses it: in plan mode, talk the logic through as if with a coworker. It will ask you about edge cases in return. When you're done, tell it to "start". Spend 20 extra minutes up front and save ten rounds of fixes later.

Plan in Hand, Check These Three Things

It will give you a plan of a few hundred words. You don't need to understand the technical details. Check only three things:

1. Which files it will touch: are they listed? Is there anywhere you think will be affected that it didn't mention?
2. Edge cases: empty, duplicate, bad input. Did it say how it handles them? If not, ask.
3. How to verify: after it's done, what steps do you follow to confirm it worked?

方案节选:
- 改动文件:index.html(数据结构从数组改成 {分类: [待办]})
- 兼容:读取时如果发现旧格式,自动迁移到「默认」分类
- 边界:分类名为空 → 提示;重名 → 提示已存在
- 验证:1) 旧数据打开后全在「默认」分类 2) 新建「工作」分类并添加待办 3) 刷新后分类和待办都在

你的回复:「兼容旧数据那条很好。补一个:删除分类时里面的待办怎么办?定为:有待办的分类不允许删。」

自测 · 学完检查一下

想真正动手做题、记进度、攒连胜?到互动课里练。

Which of these changes should go through plan mode first, rather than just having it do it?

答案:Change the to-do list to support multiple lists (work, personal), which means changing the data structure and several pages

The test: touches multiple files, touches the data structure, or you haven't fully thought it through yourself. Any one of the three means plan first. Color, wording, and font size are single small edits; do them directly, and if they go wrong you'll see it at a glance.

True or false: in plan mode, Claude Code edits the code first, then explains to you what it changed.

答案:False

It's the opposite. In plan mode it only reads, thinks, and writes a plan. It changes no files. Edit-then-explain is the default mode's behavior. The whole value of plan mode is that "nothing happens until you nod".

The AI's plan says "change index.html, store data by category", but says nothing about existing data. He has used the app for two weeks and has 40 to-dos saved. What should he reply?

答案:"The plan is missing one item: existing data must migrate automatically to a default category, none can be lost. Add it to the plan before starting"

This is exactly the kind of gap the "edge cases" check catches, and one sentence at the plan stage fixes it. Going ahead loses data; giving up the feature throws out the baby with the bathwater; hand-copying a backup is doing by hand what the program should do.

What is the purpose of the "how to verify" section in a plan?

答案:It turns "done" into steps you can tick off one by one, so you and the AI share the same definition of "complete"

Verification steps are the same thing as Lesson 2's acceptance criteria: judgeable. With them, the AI runs through them itself when done, you run through them when checking, and nobody guesses. It can't prove there are no bugs; it only guarantees the agreed path works.

Lu reads the plan in plan mode and thinks it's fine. What's the correct next action?

答案:Reply explicitly "go ahead with this plan". Only then will it exit plan mode and start editing code

Plan mode's contract is "it doesn't act until you nod", so the nod has to be an explicit sentence. Rewriting three times is waste. Relaunching throws away all the context you just talked through, and the plan is wasted.

想边练边学,而不只是读?

到互动课里答题、记进度、攒连胜——游客即可试学,无需注册。

进入互动课程 →

Learn something new — don't miss updates

New courses, features and learning tips. Occasional emails, unsubscribe anytime.