Plan-Then-Execute Mode for a Coding Agent
Force a coding agent to produce and confirm an implementation plan before it edits a single file.
Prevent expensive wrong turns by separating planning from execution and getting a checkpoint before changes land.
At a glance
Access
Free prompt
Open to copy — no account or payment needed.
Prompt objective
Prevent expensive wrong turns by separating planning from execution and getting a checkpoint before changes land.
Real use case
On a large refactor, a coding agent dives straight into edits and gets the architecture wrong halfway through. The team wants a reviewable plan first.
Customize these fields first
Replace the placeholders with your own context before you run the prompt. That usually improves the first output more than adding more instructions later.
Prompt
Act as a senior engineer pairing with an autonomous coding agent. We are using a plan-then-execute workflow. Task: [DESCRIBE THE CHANGE] Codebase context: [STACK, RELEVANT MODULES, CONSTRAINTS] PHASE 1 — PLAN ONLY (do not write code yet): 1. Restate the goal and list the assumptions you are making. 2. Identify the files/functions you expect to change and why. 3. Outline the step-by-step implementation order. 4. List risks, edge cases, and anything that could break existing behavior. 5. State how you will verify the change (tests, manual checks). 6. Ask any blocking questions. Then STOP and wait for approval. PHASE 2 — EXECUTE (only after I reply "approved"): - Implement exactly the approved plan, one step at a time. - After each step, briefly note what changed. - If reality diverges from the plan, pause and flag it instead of improvising. - At the end, summarize changes, run the verification steps, and report results. Begin with PHASE 1 now.
Open directly in an AI — the text is pre-filled:
How to use this prompt
- 1Replace the key placeholders first: DESCRIBE THE CHANGE, STACK, RELEVANT MODULES, CONSTRAINTS.
- 2Replace any bracketed placeholders like [this] with your own context.
- 3Add extra background information when you want more tailored results.
- 4Combine multiple prompts in one conversation when you need a richer output.
- 5Save your best-performing prompts so they are easy to reuse later.
Next best step
Open the guide first, then branch only if you still need more.
A guide for technical builders choosing between prompts, coding workflows, and agent-based implementation.
If this prompt is close but not quite right, generate variants next. If the job is recurring, move into the course library after the guide.
Related prompts
View allBrief a Coding Agent (Claude Code / Codex) on a Real Task
Write a precise task brief for an autonomous coding agent so it ships the right change without wandering across the codebase.
Best for
Get a self-contained brief — context, constraints, definition of done — that lets a coding agent work safely in an existing repo.
Turn a Coding Agent into a Test-First TDD Partner
Direct a coding agent to write failing tests first, then implement just enough code to pass them.
Best for
Get higher-quality, regression-resistant changes by enforcing a red-green-refactor loop with the agent.
Debug with an Agent Using a Hypothesis-Driven Loop
Guide a coding agent to debug systematically — form a hypothesis, add instrumentation, test it, narrow down — instead of random edits.
Best for
Find the real root cause faster by forcing structured, evidence-based debugging rather than shotgun fixes.
Explore other prompt categories
Move sideways into adjacent libraries when the current category is not the full answer.
Every prompt here is free. The course teaches the thinking behind them.
Copy as many prompts as you like. When you want to move from single prompts to a repeatable AI workflow, Learn AI in 30 Days walks through it, one day at a time.
Buy the course once ($15/$20 by length), or go all-access for $10/mo with a verifiable certificate.