Spec-Driven Development
Spec-first · SDD
Written by Darjus Kazakevic · reviewed
Agree on what to build before the agent builds it.
An agent writes in an afternoon what a team once wrote in a sprint, and one person must review the diff. Reading two thousand generated lines is skimming, not review. Prompting and re-prompting also fails: the intent lives in a chat that the next session never sees.
Spec-driven development reverses the order. First write the requirements, each with a testable “done means”, as a file in the repo. A person reviews that page. Then the agent implements it task by task, and the criteria check the result. Each spec covers one change, so it stays small and cheap to revise.
In essence — Agents made writing code cheap and review the bottleneck. So review the spec — a page that fits in your head — before any code exists.
When to reach for it
Reach for it when
- An agent writes most of the code and the diffs are too big to review
- The work spans several sessions or agents
- Requirements exist before the code: a contract, a rule, a customer ask
Reconsider when
- You do not know what you want yet — build a prototype first
- The change is smaller than its spec would be
- Nobody will really read the spec
The artifacts
- The spec
- What to build and why, short enough for a reviewer to hold in their head. It states behaviour and limits, never implementation, and it lives in the repo next to the code it governs.
- Acceptance criteria
- The “done means” for each requirement, written before any code exists. They describe the intent, so nobody can reverse-engineer them from whatever the code does. They are the agent's stop condition and the reviewer's checklist.
- The review gate
- A person approves the spec before implementation starts. These are the most valuable minutes in the whole flow: a wrong sentence here becomes a wrong module later. The diff still gets a lighter check against the spec.
- The task list
- The spec split into steps, each small enough for one agent session. Progress lives in the file, not in anyone's memory, so the work can resume across sessions, agents and models.
Design rules
- Spend review time on the spec, not the diff
- A page of intent is where human judgement works best, so put your careful minutes there. Diff review then becomes a simple check: does the code match what we agreed?
- Make every requirement testable
- “Handles errors well” is a wish, and an agent will meet it in the cheapest way. Add a “done means” to each requirement: the exact error code, the expired window, the retry that must not pay twice.
- Write one spec per change, in the repo
- Spec the change, not the whole system; a whole-system spec goes stale like an old wiki. In the repo, the spec survives what the context window does not: compaction, new sessions, another agent.
- Update the spec before you change course
- When implementation shows the spec is wrong, fix the spec first and re-review it briefly. Match the process to the risk: a typo fix needs no spec, an auth change does.
Common pitfalls
- Skimming the spec the way people used to skim diffs.
- A whole-system spec that nobody updates. Spec the change, and archive it when shipped.
- Requirements with no test, met in the cheapest possible way.
- Silent drift: the code departs from the spec, and the truth moves back into people's heads.