Claude Code Plan Mode

How to use Claude Code's /plan command to get a full implementation plan before any code is written. Covers plan review, approval, iteration, and when to use plan mode vs direct execution.

💥 50p impulse-buy: Power Prompts PDF (first 10 buyers) 30 battle-tested Claude Code prompts · 8-page PDF · paste into CLAUDE.md and never re-type a prompt again · 50p impulse-buy, no commitment

Claude Code plan mode lets you review exactly what Claude intends to do before a single file is touched. It's the right tool for multi-file refactors, schema migrations, and any change where getting the sequence wrong creates rework.

Entering plan mode

# In an interactive Claude Code session:
/plan Refactor the payments module to extract a PaymentGateway interface

# Or with a full prompt:
/plan Add end-to-end tests for the /api/orders endpoint using pytest

Claude reads the relevant files, then outputs a structured plan — numbered steps, files affected, commands to run. It then stops and waits.

What a plan looks like

Plan (7 steps):

1. Read payments/processor.py to understand current interface
2. Create payments/gateway.py — abstract PaymentGateway base class with
   charge(), refund(), and get_status() methods
3. Update payments/processor.py — StripeGateway(PaymentGateway) subclass,
   move all Stripe-specific logic out of route handlers
4. Update payments/processor.py — PayPalGateway(PaymentGateway) subclass
5. Update routes/payments.py — replace direct Stripe calls with
   gateway.charge() / gateway.refund()
6. Update tests/test_payments.py — add gateway mock fixture, update 12
   existing tests to use it
7. Run: pytest tests/test_payments.py -v

Ready to proceed? (enter to confirm, or give feedback)

Approving, rejecting, or revising

# Approve and execute:
proceed

# Add a constraint mid-plan:
Also update the admin/billing.py route — it calls Stripe directly too

# Redirect a step:
Step 4: use the existing PayPalProcessor class instead of creating a new one

# Cancel:
/clear

When to use plan mode vs direct execution

ScenarioUse plan modeUse direct
Files touched3+ files1-2 files
Schema changesYes — review before migrateNo migrations
API surface changesYes — check callers firstNo public API
Test refactorsIf mocking strategy changesAdding tests only
CI / headlessNot availableAlways
Quick fix (typo, rename)NoYes

Plan mode for code review before PR

/plan Review the open diff against main and propose what needs changing
      before this is mergeable: missing tests, error handling gaps,
      security issues, style violations

# Claude reads git diff, produces a prioritized checklist
# You pick which items to action before approving

Plan mode with subagents (programmatic)

When running Claude Code via the SDK or as an agent, plan mode maps to the EnterPlanMode / ExitPlanMode tool calls. Your orchestrator can intercept the plan, log it, or require human sign-off before calling ExitPlanMode.

# Example: require human approval for plans touching /migrations/
# In your orchestrator hook:
if "migrations" in plan_text:
    await notify_slack(f"Plan requires approval:
{plan_text}")
    await wait_for_approval()
await claude.exit_plan_mode()

Tips for better plans

For automating repetitive plans across multiple repos, see Claude Code headless mode. For controlling what Claude is allowed to do during plan execution, see Claude Code permissions.

Frequently asked questions

What is Claude Code plan mode?
Plan mode is activated with the /plan slash command. Claude Code sketches a full implementation plan — files to change, steps to take, edge cases to consider — and waits for your approval before writing any code or running any tools.
How do I enter plan mode in Claude Code?
Type /plan at the start of a message: '/plan Refactor the auth module to use JWT'. Claude presents the plan as structured steps. Type 'proceed' or press Enter to execute, or give feedback to revise the plan.
What's the difference between plan mode and normal mode?
In normal mode Claude Code acts immediately: reads files, edits code, runs commands. In plan mode it stops after writing the plan and waits. No files are changed until you approve. Use plan mode for anything touching more than 2-3 files or requiring irreversible actions.
Can I edit the plan before Claude executes it?
Yes — you can reply with corrections ('skip step 3', 'also update the tests', 'use TypeScript not JavaScript') and Claude will revise the plan. Only once you confirm does execution begin.
Does plan mode work in headless/CI mode?
No — plan mode requires interactive approval. In headless mode (--print flag or piped stdin) Claude Code skips the planning gate and executes directly. For pipeline safety, use PreToolUse hooks to block specific tools instead.

Free tools

Cost Calculator → API Cookbook → Diff Summarizer → Skills Browser →

More examples

Claude API Python QuickstartClaude API Node.js / TypeScript QuickstartClaude API Streaming in PythonClaude API Streaming in Node.js / TypeScriptClaude API Tool Use in PythonClaude API Tool Use in Node.js / TypeScript