Skip to content
Khaled.dev
workflow

Force a Spec Before Any Code

A planning prompt that makes the model surface assumptions and a verifiable plan before writing a single line — killing the over-eager-coder failure mode.

The prompt
Before writing ANY code for the task below, produce a short spec:

1. Restate the task in one sentence.
2. List your explicit assumptions. Mark any you're unsure about with (?).
3. Note any ambiguity that has more than one reasonable interpretation.
4. Propose the simplest approach. If a simpler one exists than what I asked
   for, say so.
5. Give a step-by-step plan where every step has a verification check:
     Step -> verify: <how we'll know it worked>

Then STOP and wait for my confirmation. Do not write code yet.

Task:
<describe the task here>

The single highest-leverage prompt in my library. Most bad LLM output comes from the model guessing instead of asking — this forces the guess into the open.

The failure mode it fixes

The model writes 200 lines solving the wrong problem because it never surfaced the assumption that turned out to be false.

Pairs well with

Run this first, confirm the plan, then hand off to a coding agent. The plan becomes the success criteria the agent loops against.

Tip

Keep the "STOP and wait" line. Without it, eager models barrel straight into implementation and the whole point is lost.

#planning#agents#workflow