Plan first, then write code
For bigger requests, have it draft a plan first, sign off on it, then execute step by step. This is the most effective way to cut down on rework.
1. Why draft a plan first
If you just say "build feature XX", it starts writing right away. The problems:
- Where the requirement is ambiguous, it will guess one interpretation for itself;
- Decisions about data structures and interface design, once written into dozens of files, are painful to change;
- You only realize the direction is wrong when you see the code, and the earlier time is wasted.
Spending five minutes aligning on the plan saves an hour later.
2. Plan mode: look but don't touch
Press Shift+Tab to switch to Plan mode, or state it clearly in the request:
Requirement: the report should support custom HTML components for 3D effects. Use the implementation from our other large-screen product as a reference.
Don't write any code yet. After surveying the existing code, give me a plan:
- How data is stored (do tables need to change?)
- How the front end renders it, and how security is ensured
- Which new interfaces are needed
- Which choices need my sign-off
In Plan mode it can only read files, search and look things up. It can't change anything, and in the end it gives you a plan.
3. What a good plan looks like
A plan you can sign off on should include:
- Findings so far: what it found while surveying (key files, existing mechanisms).
- Key points of the plan: data model, interfaces, and the front-end / back-end split of work.
- Choices for you to make, each with a recommendation. For example:
- Load the external 3D library from a CDN or embed it locally?
- When should AI automatically generate a component?
- Risks and what it won't do: which points carry security risk, and which things aren't supported for now.
When it hits a question that really needs your decision, it will ask in multiple-choice form, and you just click one.
4. After sign-off: execute in steps
Once the plan is confirmed, have it proceed step by step and report at key points:
Execute according to the plan. Order: backend data structure and interfaces → front-end component rendering → edit dialog → example.
After each step, compile / self-test before moving on to the next one.
If it finds a problem with the plan during execution, the right behavior is for it to stop and explain, not to change direction on its own. You can spell that out in CLAUDE.md:
## Interaction rules
Execute directly; don't keep asking for confirmation. For database changes, interface design, core logic or architecture adjustments, briefly describe the plan and wait for my confirmation first.
5. What to do when requirements change midway
Just say so when requirements change, and it will adjust on top of the current progress. But be careful:
- Be clear whether you are "discussing" or "changing". "Would this cause a problem?" and "Change it to this" are two different things. Otherwise it may treat a discussion as an instruction and act on it right away.
- For large changes, first have it assess the impact: "If we change it to XX, which parts already written need to change too?"
6. A real example
Requirement: "Reports support custom HTML components".
- It surveyed first: it found the original implementation in the reference large-screen product (iframe sandbox + data bridge), and read the report's data structure and the rendering code for its four styles.
- It gave a plan and raised two questions for sign-off:
- Where should the 3D library load from? → chose "allow CDN";
- When should AI generate components? → chose "only when named, or when built-in options can't do it".
- During execution, it found that "adding a new chart type" would affect dozens of validation spots, so it adjusted the approach to "add an html field to the analysis item as a rendering overlay", and proactively explained the adjustment and the reason.
This is exactly the benefit of planning first: every adjustment in the plan comes with an explanation, so you always know what it is doing and why.