Spec-Driven Development: Writing Requirements That AI Agents Can Build From
When a person writes code, a vague ticket is an annoyance. They ask a question in chat, make a sensible guess and move on. When an agent writes the code, a vague ticket is a problem. The agent will not ask. It will fill every gap with a confident assumption and hand you something that looks finished.
That is why more teams are turning to spec-driven development: writing a clear specification first, agreeing on it, and only then letting an agent build from it. The spec, not the prompt, becomes the source of truth.
1. What a Good Spec Contains
It does not need to be long. It needs to be specific. A useful spec covers:
- The goal: what problem is being solved, and for whom
- The behaviour: what the system should do, with concrete examples
- The boundaries: what is out of scope and what must not change
- The acceptance criteria: how we will know it is done
2. Examples Beat Adjectives
“The search should be fast and user friendly” tells an agent nothing. “Searching for an order number returns that order first, within 300 ms, for a table of ten million rows” tells it exactly what to build and how to check it.
3. Write the Constraints Down
Agents do not know your unwritten rules. If the change must not alter the public API, must work with the existing database schema or must not add a new dependency, say so.
4. Review the Spec, Not Only the Code
The cheapest moment to catch a misunderstanding is before any code exists. Have the team review the spec the way they would review a pull request. Product, engineering and security can all read plain language.
5. Plan Before Building
A good pattern is spec, then plan, then code. Ask the agent to produce a step-by-step plan from the spec and review that too. It is far easier to correct a plan than to unpick a thousand-line change.
6. Turn Acceptance Criteria Into Tests
Each acceptance criterion should become an automated test. That gives the agent a way to check its own work and gives you a way to trust the result.
7. Keep Specs in the Repository
A spec that lives next to the code is versioned, reviewable and visible to the next agent, and the next engineer, who touches the feature. When the behaviour changes, change the spec in the same pull request.
8. Do Not Overdo It
A one-line bug fix does not need a design document. Match the weight of the spec to the size and risk of the change.
Conclusion
Spec-driven development is not a new invention. It is the discipline of thinking before building, made urgent by tools that build very quickly. Teams that write clear specs get better results from agents and, as a bonus, better shared understanding among people. It pairs well with the repository habits we described in our post on context engineering. If you want help bringing it into your delivery process, let’s talk.