Spec-driven development
Writing a precise specification (the outcome, the acceptance criteria, the files in scope) and having the agent implement against it, instead of prompting incrementally. It costs more up front and pays off on anything an agent will run unattended, because the spec is what review is judged against.
At a glance
- Unit of work
- One shippable change
- Core contents
- Outcome, acceptance criteria, scope, non-goals
- Written
- Minutes or hours before the build
- Pays off on
- Long or unattended agent runs
- Not worth it for
- Small changes you watch happen
How it works
A spec for an agent is short and testable, not a design document. It states the user-visible outcome, acceptance criteria as checks someone could run, the files or modules in scope, explicit non-goals, and constraints the agent cannot infer, such as an API that must stay stable. Open questions are listed, so they get answered before the build instead of guessed during it.
The usual loop: draft the spec, often with the agent's help in a planning session, edit it until you would accept any result that meets it, then hand it to a fresh session to implement. When review shows the spec was wrong, fix the spec and rerun rather than patching code by hand.
Why it matters
Incremental prompting works when you watch every step. It breaks down when an agent runs for twenty minutes without you, or when several run at once, because every unstated assumption becomes a decision the agent makes alone. A spec front-loads those decisions and gives review a fixed reference: the question becomes "does this meet the criteria" rather than "is this what I meant", which is faster to answer and easier to send back with a precise reason. The acceptance criteria also give the agent its own finish line, so it can run the checks and keep going until they pass.
Spec-driven development versus waterfall
Waterfall specified whole systems months ahead. A spec for an agent covers one unit of work, is cheap to rewrite when the first attempt shows the plan was wrong, and is closer to a well-written ticket with acceptance criteria than to a requirements document.
Example
Outcome: invited users land on the project they were invited to, not the dashboard.
Acceptance:
- Visiting /invite/<token> signed out, then signing in, opens /p/<slug>.
- An expired token shows the existing expiry page.
- A new test covers both paths.
In scope: src/app/invite/, src/server/auth.ts
Non-goals: changing invite emails or token lifetime.Common mistakes
- Writing the implementation steps instead of the outcome, which blocks better routes and still omits the acceptance check.
- Writing a spec so vague, like "make onboarding smoother", that it constrains nothing.
- Patching code by hand after review and leaving the spec stale.
In Fredrin
A Fredrin ticket's plan has five sections (Outcome, Acceptance checks, Touchpoints, Constraints, Open questions), and a Plan-mode run drafts it before any code is written.
TicketsRelated terms
Frequently asked questions
Is spec-driven development the same as test-driven development?
They are related but not the same. TDD writes executable tests first, while a spec states the outcome and acceptance criteria in prose; a good spec often asks the agent to write those tests as part of the work.
When is a spec not worth writing?
For small, reversible changes you will watch happen, such as a copy edit or a one-line fix. The payoff grows with how long the agent runs alone and how costly a wrong guess is.