DEV Community

ミュラ
ミュラ

Posted on

Make Claude Code Plan Before It Codes: One Prompt That Kills the "Confident but Wrong" First Draft

The most expensive AI coding failure isn't bad code. It's confidently wrong code — a full implementation of the wrong thing, delivered fast, that you now have to review, reject, and re-explain.

The fix is boring and it works: make the agent plan first, and make it ask instead of assume.

Here is the exact prompt I use, in full:

Do not write code yet. Enter plan mode: explore [FEATURE_AREA], then give me a step-by-step plan for [GOAL] with files to change, risks, and tests to run. Flag anything ambiguous as a question instead of assuming. Wait for my approval before implementing.
Enter fullscreen mode Exit fullscreen mode

Why each line earns its place

"Do not write code yet." Without this, the plan becomes a preamble to code that was already half-written. The pause is the point.

"Files to change, risks, and tests to run." A plan without a file list is a wish. A plan without a test list is a hope. Naming all three forces the agent to actually explore the codebase instead of improvising from the prompt.

"Flag anything ambiguous as a question instead of assuming." This is the highest-value sentence. Agents assume silently — which database, which auth pattern, which of the two similar services. Every silent assumption is a coin flip. Questions are cheap; rewrites are not.

"Wait for my approval." Approval takes you 30 seconds at the plan stage, or 30 minutes at the diff stage. Pick the cheap one.

What it catches

A typical example: the goal is "add Stripe webhooks." The plan comes back — and before a single line exists, it surfaces that the current webhook handler has no idempotency handling. That is a production incident caught at the planning stage, when fixing it costs one sentence: "add idempotency keys to the plan."

Caught before code: free. Caught after deployment: a very bad day.

When to use it

Any task touching:

  • 3 or more files
  • Auth, payments, or data models
  • Anything where "wait, that's not what I meant" would cost real time

For a one-line fix, skip it. For anything structural, plan mode is the cheapest insurance in AI-assisted development.


This prompt is #02 from my Claude Code Mastery & Orchestration Mini-Pack — 10 prompts for running Claude Code deliberately and splitting big jobs across models, $5 at launch with code **FLOW2* (regular $7). All 28 prompts are in the full AI Coding Agent Prompt Pack — code LAUNCH10 takes it to $9.*

Not affiliated with Anthropic. The prompt works in other coding agents too — the discipline transfers even when the tool changes.

Top comments (0)