Plan Before You Prompt
Your AI agent just rewrote half your codebase, and now you're untangling it. The fix isn't a better prompt — it's a five-second habit: don't let the agent touch a file until you've read and approved its plan.
The problem: agents commit to an approach before you've seen it
Ask a coding agent to "add caching to the search endpoint" and, by default, it starts reading files, forming an approach, and editing — all in the same breath. You don't find out it chose an in-memory cache instead of Redis, or that it touched three files you didn't expect, until the diff is already sitting in your working tree. Untangling a 400-line surprise diff costs far more time than reading a five-line plan would have.
The root issue is sequencing. A coding agent's plan and its edits are normally interleaved: it reasons a little, writes a little, reasons a little more. Any correction you have lands after code already exists, so "fixing" means partially undoing work rather than steering before it starts.
The fix: separate planning from editing
Every major agentic coding tool now supports some form of a read-only planning mode — a state where the agent can research your codebase (read files, grep, run non-destructive shell commands) but is mechanically blocked from writing or editing. It has to hand you a plan and stop.
In Claude Code specifically, this is plan mode, one of several built-in permission modes:
| Mode | What runs without asking |
|---|---|
default (Manual) | Reads only |
plan | Reads only — same as Manual, but framed around producing a plan before any edit is approved |
acceptEdits | Reads, file edits, common filesystem commands |
bypassPermissions | Everything (isolated containers only) |
Plan mode isn't a magic new capability — it's the same read-only posture as Manual mode, but the agent knows the goal is to converge on an approved plan, not to make incremental edits between prompts. It reads code, forms an approach, and writes that approach down instead of acting on it.
How to run it
- Enter plan mode. Press
Shift+Tabmid-session to cycle into it, prefix a single prompt with/plan, or start the session already in it:claude --permission-mode plan. To make every session in a project start in plan mode, set it in.claude/settings.json:{ "permissions": { "defaultMode": "plan" } } - Give the agent the task. It reads the relevant files, may run read-only shell commands to explore, and asks clarifying questions if something's ambiguous — the same questions you'd want answered before code exists, not after.
- Read the plan. It outlines the steps it intends to take and, ideally, the files it expects to touch. This is the cheapest possible place to catch a wrong approach: it's plain text, not a diff.
- Fix it in seconds, if needed. Wrong direction? Tell the agent what to change and it revises the plan — no edits to undo. In Claude Code you can also press
Ctrl+Gto open the plan in your text editor and hand-edit it directly before approving. - Approve and execute. Once the plan looks right, approve it. Claude Code exits plan mode and switches to editing (auto-approve edits, review each one, or go step-by-step) — the agent now executes the plan you already signed off on.
That loop — plan, review, execute — is the whole habit. It costs one keystroke going in and a few seconds of reading before you unlock the write.
When it earns its keep
- Scary refactors. Anything touching more than a couple of files. Seeing the step order before it happens catches "this will break the auth middleware" instead of finding out from a failing test suite.
- Legacy code you don't fully understand. The agent's plan doubles as a forced explanation of what it thinks the code does — a cheap sanity check on its own understanding before it starts mutating things you can't easily review line-by-line.
- New features with several reasonable implementations. If there's more than one obvious way to build something, you want to pick the direction before fifteen files change, not after.
For a one-line typo fix, plan mode is overhead you don't need — reach for it when the cost of a wrong first attempt is higher than the cost of one extra approval step.
Power trick
While the agent is planning, ask it directly: "what am I not thinking about?" A planning agent has already read the surrounding code and is primed to surface edge cases, migration concerns, or tests that would break — but it usually won't volunteer them unless asked. This one question routinely surfaces the constraint you forgot before it becomes a bug.
Takeaway
Measure twice, cut once — the same rule that applies to carpentry applies to letting an autonomous agent loose on your repo. Plan mode doesn't make the agent smarter; it just moves your review to before the edit instead of after, which is the one change that reliably cuts down on rework. One keystroke (Shift+Tab) is the whole cost of entry.
Resources
- Claude Code — Choose a permission mode: Plan mode
- Claude Code — Common workflows: Plan before editing
- Claude Code — Ultraplan (browser-based plan review)
Building an AI feature? Yeda AI designs, audits, and ships production LLM systems.