Skip to content
Back to AI Coding

Planning Mode Before Editing

Ask the agent for a plan first, review it, then execute — cheap insurance for big tasks.

Agent DevelopmentIntermediate

Why

MCP's reference server repo has ~90,000 GitHub stars, and the Agentic AI Foundation grew from 49 founding members (December 2025) to 247 by August 2026, signaling rapid multi-agent ecosystem growth. A plan is a cheap artifact that catches wrong assumptions before expensive edits.

Reviewing a 10-line plan takes seconds; reverting 30 wrong file edits takes an hour. Planning first is the highest-ROI habit on big tasks.

When

Always plan for tasks touching >5 files, unfamiliar code, or risky migrations. Skip for single-file edits you can eyeball.

How

1. Prompt: "list the files to change and the change in each; do not edit yet". 2. Review the plan: scope, order, risks, missing files. 3. Adjust the plan in chat before greenlighting. 4. Execute in steps with a commit per step. 5. Compare result to the plan; investigate any divergence.

Example

> Plan only: migrate 40 routes from assertValid to zod. List each file + the schema needed. [review 40-row table, spot 2 missing routes, add them] > Execute per the table, one route per commit, stop on first tsc error. Catching 2 missing routes in the plan saved a broken partial migration.

Common Problems

  • ⚠Error: Agent loops infinitely on the same tool call → add a max-iterations guard and a distinctness check on the last N actions.
  • ⚠Error: Cannot find module '@modelcontextprotocol/sdk' → `npm install @modelcontextprotocol/sdk`; agents need the SDK to call MCP tools.
  • ⚠Error: "Tool timed out after 30000ms" → increase the timeout config or break the task into smaller sub-tasks the agent can complete incrementally.

Best Practices

  • ✓Always ask 'do not edit yet' so the agent plans instead of acts.
  • ✓Treat the plan as a contract; reject any execution that diverges.
  • ✓Measure the outcome with a concrete metric (time saved, defect rate, test coverage) so the practice can be justified and improved.

FAQ

What is Planning Mode Before Editing?

Ask the agent for a plan first, review it, then execute — cheap insurance for big tasks. It helps developers quickly grasp the core value and use cases of Planning Mode Before Editing.

How do I get started with Planning Mode Before Editing?

To get started with Planning Mode Before Editing, focus on these points first: Prompt: "list the files to change and the change in each; do not edit yet".

What are common mistakes with Planning Mode Before Editing?

Common mistakes when using Planning Mode Before Editing include: Error: Agent loops infinitely on the same tool call → add a max-iterations guard and a distinctness check on the last N actions.; Error: Cannot find module '@modelcontextprotocol/sdk' → `npm install @modelcontextprotocol/sdk`; agents need the SDK to call MCP tools.; Error: "Tool timed out after 30000ms" → increase the timeout config or break the task into smaller sub-tasks the agent can complete incrementally..

What are the best practices for Planning Mode Before Editing?

Best practices for Planning Mode Before Editing include: Always ask 'do not edit yet' so the agent plans instead of acts.; Treat the plan as a contract; reject any execution that diverges.; Measure the outcome with a concrete metric (time saved, defect rate, test coverage) so the practice can be justified and improved..

How do I learn more about Planning Mode Before Editing?

Start with the official docs, then search real-world examples on GitHub. Validate patterns in a small scratch repo before applying them to production code.