How do I make Claude plan before it edits code?
Use planning mode (or just ask) so Claude writes the plan, you approve it, and only then does it touch files.
The biggest lever for working well with Claude is getting a plan in writing before anything is edited. The plan is cheap, the rollback isn’t.
Two ways to trigger it
Built-in planning mode. Press Shift-Tab twice in the CLI to cycle into “plan mode”. Claude can read files but cannot edit them. When it’s ready, it shows you the plan and asks you to approve.
Just ask. A plain prompt works almost as well:
Don’t write any code yet. Read the auth middleware and the failing test in
tests/auth.spec.ts, then write a plan for the fix. List which files you’d touch and why. I’ll approve before you change anything.
What a good plan looks like
A useful plan from Claude has four parts:
- What it understood — one sentence, so you can spot misreads early.
- What it’ll change — a list of files with a one-line note per file.
- What it won’t change — the explicit “out of scope” list.
- How it’ll verify — which test or command proves it worked.
If any of those are missing, ask for them. Don’t approve a plan that’s vague about scope; that’s where surprise refactors come from.
When to skip planning
For genuinely small changes — rename a variable, add a log line, fix a typo — planning is overhead. Reserve it for changes that touch more than one file or any code you don’t fully understand yet.
Sources
- Best practices: explore first, then plan, then code — Anthropic's recommended four-phase workflow
- Common workflows: plan before editing — Plan-mode mechanics and Shift+Tab toggle