Spec-Driven Development (for Agents)
A workflow where engineers write a detailed specification—what to build, edge cases, acceptance tests—before letting an AI coding agent implement it. The spec becomes the source of truth: the agent codes against it, tests run against it, and review compares the diff to it. Spec-driven development tames the 'plausible but wrong' failure mode that derails one-shot prompting; teams using it report higher first-pass merge rates and dramatically fewer 'agent took it in the wrong direction' rewrites.
Example
A team adopting Claude Code keeps a spec.md alongside each feature: requirements, non-goals, API surface, edge cases, test scenarios. The agent reads the spec, plans the implementation, writes code and tests, then self-checks the diff against the spec before opening the PR. Reviewers also read the spec first—merge time drops from 2 days to 4 hours because everyone's reviewing against the same ground truth.
Frequently asked questions
- Isn't writing a spec just as much work as writing the code?
- It can be, for trivial changes—skip the spec there. But for any task above a few hundred lines, a 15-minute spec saves hours of rework when the agent (or a junior engineer) misunderstands. Spec-driven development is highest-ROI on cross-cutting changes, integration work, and anything where 'looks right' isn't the same as 'is right'.