Spec-Driven Development with AI Coding Agents
Use specifications to steer AI coding agents: writing specs, plans and task lists, keeping them in the repo, and verifying implementations against them.
Published December 1, 2026
AI coding agents are fast but literal. Give them a vague request and they fill the gaps with guesses; give them a clear specification and they become remarkably reliable. Spec-driven development makes the specification a first-class artefact: written before the code, kept in the repository, and used to plan, implement and verify each change.
The concept
A spec describes what and why, not how: the problem, users, behaviours, constraints, non-goals and acceptance criteria. From the spec, the agent (or developer) derives a technical plan: affected components, data model changes, APIs and risks. The plan is broken into small tasks, each implementable and testable on its own.
Keeping these documents in the repository has compounding benefits. Agents can re-read them at the start of every session, reviewers can compare code to intent, and future maintainers understand why things were built a certain way. Several open-source toolkits and agent features now support this workflow, but plain Markdown files work just as well.
The workflow
Artefacts
| Artefact | Contains | Owner |
|---|---|---|
| spec.md | Problem, users, behaviours, constraints, acceptance criteria | Product + engineer |
| plan.md | Architecture, data changes, APIs, risks, alternatives | Engineer (agent drafts) |
| tasks.md | Ordered checklist of small tasks with tests | Agent, reviewed by engineer |
| Code + tests | Implementation verified against criteria | Agent + reviewer |
In practice
- Write or refine the spec with the agent asking clarifying questions
- Have the agent draft a plan; review and edit it
- Generate a task list; keep each task under an hour of work
- Implement one task at a time; run tests after each
- Check off tasks and update the plan if reality differs
Practical examples
A compact spec
Clear acceptance criteria are the most valuable part.
# Spec: Team invitations
Problem: Admins cannot add teammates without sharing passwords.
Behaviour:
- Admin enters an email; invitee receives a link valid for 7 days
- Accepting creates an account (or links an existing one) with role "member"
Non-goals: SSO, bulk invites
Acceptance:
- Expired links show "Invitation expired" and offer to request a new one
- A user can belong to at most 20 teamsPrompting the agent from the spec
Point to files; ask for a plan first.
Read docs/specs/team-invitations.md and the existing auth module.
Draft docs/plans/team-invitations.md: data model changes, endpoints, email flow, risks.
Do not write code yet. List open questions at the end.Task list with verification
Each task names its test.
- [ ] Migration: invitations table (token hash, email, team_id, expires_at) — test: migration up/down
- [ ] POST /teams/{id}/invitations — test: admin only, 20-team limit
- [ ] GET /invitations/{token} — test: expired → 410Common mistakes
- Specs that describe implementation details instead of behaviour.
- Skipping plan review and letting the agent choose architecture silently.
- Huge tasks that produce unreviewable diffs.
- Specs that drift from the code and are never updated.
Key takeaways
- Write the spec first: behaviour, constraints, acceptance criteria.
- Derive a plan and small tasks; review both.
- Keep specs and plans in the repo for agents and humans.
- Verify each task against tests tied to acceptance criteria.
FAQ
Is this just waterfall?
No. Specs are short and evolve; the point is clarity per change, not a big upfront design for the whole system.
Do I need special tools?
No. Markdown files and a disciplined prompt work. Tools can automate templates and task tracking.
How detailed should acceptance criteria be?
Detailed enough to be turned into tests without guessing.