Plan before you code: plan mode and specs for AI agents
Why big changes go better when the AI agent plans first: how to use plan mode in Claude Code, how to get it to interview you into a SPEC.md, and how to read and fix a plan before you approve it.
By Shakir Sajad & Claude (AI by Anthropic) · 2 min read · Updated 2026-11-19
Step 07 of the agentic coding learning path.
Why plan first
An agent moves fast. That's great when it's going the right way and costly when it isn't. Most wrong builds start with a wrong guess about what you wanted. A plan puts that guess on the table before any code changes.
Step 1: turn a fuzzy idea into a spec
If you can't describe the feature in a few lines yet, don't guess. Anthropic's best practices suggest letting Claude interview you:
I want to add {feature} but haven't thought it through yet. Interview me until you could write the spec, then write it to SPEC.md.It asks short multiple-choice questions about the parts you haven't decided: who can use it, what happens at the edges, what's out of scope. Your answers become the spec.
Step 2: plan in a fresh session
Start a new session, so the build begins clean with only the spec. Then turn on plan mode:
- Press
Shift+Tabuntil the status bar says plan mode, or - Start one prompt with
/plan
In plan mode, Claude reads files and runs commands to explore, then writes a plan. It doesn't edit your source until you approve. (Permission modes docs.)
/plan Build what SPEC.md describes. List the files you'll change, the steps in order, how you'll check each step works, and anything you're unsure about.Step 3: read the plan like a boss
You don't need to read code to review a plan. Check these:
- Does it solve the right problem? Compare it to the spec, line by line.
- Which files change? Anything surprising, like a file you never mentioned, ask why.
- How will it check? A test, the build, a screenshot. No check means no proof.
- What's it unsure about? Answer those questions now, not after.
- Is it too big? Ask it to split into smaller steps you can ship one at a time.
Not right? Say what to change and it revises. Approve only when it matches what you want.
When to skip the plan
Planning has a cost. Skip it for:
- One-line fixes and copy changes
- Tasks where you already know the exact file and change
- Exploring ("what would you improve in this file?")
A good rule: if you could describe the change in one sentence with the file name, just ask for it.
How I use it
Big changes on this site, like a new hub or a refactor, start in plan mode. I read the plan, push back on anything I didn't ask for, then approve. Small fixes, like spacing on the home page, go straight in.
What's next
Once it builds, make sure it actually works: make the agent prove it.
Do this now
- Pick one feature bigger than an hour of work That's the size where planning pays off. (5 min)
- Run the interview prompt on it Answer its questions until it writes SPEC.md. (20 min)
- Start a fresh session in plan mode Shift+Tab until it says plan mode, or start the prompt with /plan. (5 min)
- Read the plan with the checklist below Files, steps, how it will check, what it won't touch. (10 min)
- Fix one thing in the plan before approving Say what to change. Approve only when it matches what you want. (10 min)
Frequently asked questions
What is plan mode?
A Claude Code mode where Claude reads files and explores, then writes a plan, but doesn't edit your source until you approve it. Turn it on with Shift+Tab or by starting a prompt with /plan.
When should I plan first?
For anything that touches several files, changes how data is stored, or that you can't fully describe yet. Small, clear fixes don't need a plan.
What is a SPEC.md?
A short file that says what to build, what's out of scope and what 'done' means. The agent can write it by interviewing you, and later check its work against it.
Why start a fresh session after the spec?
So the build starts with a clean context and a written definition of done, instead of a long chat full of half-decisions. Anthropic's best practices recommend this.