Dev tools
Spec-Driven Development With AI Coding Agents
Spec-driven development: write a spec, plan and task list before an AI agent codes. How it works, a full example, GitHub Spec Kit, Kiro and Claude Code.
Spec-driven development is a way of building software with AI coding agents where you write a clear specification first, describing what the feature should do and why, then turn it into a technical plan and a list of small tasks, and only then let the agent write code, checking its work against the spec. The spec becomes the source of truth that keeps the agent on track, instead of a chat history of half-remembered prompts. It works best for features of medium size and up, where vague prompts lead to rework.
This guide explains what spec-driven development is, how it differs from vibe coding, TDD and waterfall, the step-by-step workflow, a complete spec-driven development example, tools such as GitHub Spec Kit and Kiro, spec-driven development with Claude Code, and when it's worth the extra effort.
What Is Spec-Driven Development?
In spec-driven development (SDD), the main thing you write and review is a specification, not a prompt. Birgitta Böckeler, writing on Martin Fowler's site, describes a spec as a structured, behaviour-oriented artefact written in natural language that describes software functionality and guides AI coding agents.
A spec usually covers:
- The goal: what problem the feature solves and for whom.
- User stories and requirements: what the system must do, in testable statements.
- Acceptance criteria: how you'll know each requirement is met.
- Constraints: performance, security, compatibility, things that must not change.
- Out of scope: what this feature deliberately doesn't do.
From the spec, the agent (with your review) produces a technical plan, then a task list, then code. Each step is a document you can read, edit and keep in version control.
SDD is not a new idea. Writing requirements before code is decades old. What's new is that AI agents can turn a good spec into a plan and working code quickly, which makes the spec far more valuable, and a bad or missing spec far more costly.
Why Spec-Driven Development Took Off
AI coding agents are fast but literal. Given a one-line prompt, they fill gaps with guesses: an extra database table, a library you don't use, an API shape that doesn't match the rest of the app. In long sessions they also lose track of earlier decisions.
A written spec fixes several of these problems:
- Fewer guesses: the agent sees the requirements, edge cases and constraints up front.
- A stable reference: the spec survives across sessions, context resets and different agents.
- Reviewable intent: a teammate can review a two-page spec far faster than 2,000 lines of generated code.
- Better verification: acceptance criteria become tests and checklists the agent can run.
GitHub's open-source Spec Kit and Amazon's Kiro IDE, both launched in 2025, made the approach popular by building it into tools.
Spec-Driven Development vs Vibe Coding
Spec-driven development vs vibe coding is the most common comparison, because they sit at opposite ends of how much you plan:
| Vibe coding | Spec-driven development | |
|---|---|---|
| Starting point | A prompt and a vibe | A written spec with requirements |
| Planning | Little or none | Plan and task list before code |
| Best for | Prototypes, experiments, throwaway tools | Production features, team work, larger changes |
| Review | Mostly by running the app | Spec, plan, then code |
| Risk | Drift, hidden bugs, messy code | More upfront time; specs can go stale |
They're not enemies. Many teams vibe code a quick prototype to learn what they want, then write a spec for the real version. Our guide to vibe coding covers the prototype side.
Is Spec-Driven Development Just Waterfall?
No, though it borrows the good part of it. Waterfall wrote big specifications for whole systems, months before coding, and resisted change. Spec-driven development with AI works in small slices: one feature at a time, specs written in hours, and changes made by editing the spec and re-planning. The loop is short enough that you can still iterate.
It also differs from:
- TDD (test-driven development): TDD writes tests before code. SDD writes requirements before tests and code; good specs produce acceptance criteria that become tests, so the two fit together.
- BDD (behaviour-driven development): BDD's Given/When/Then scenarios are a natural format for SDD acceptance criteria.
- Plan mode: many agents, including Claude Code, have a planning mode where the agent proposes a plan before editing. That's a lightweight form of SDD, but the plan usually lives only in the session. SDD keeps the spec and plan as files in the repository.
Three Levels of Spec-Driven Development
Böckeler describes three levels:
- Spec-first: you write a careful spec before coding a task, and use it to guide the agent. Afterwards, the spec may be discarded.
- Spec-anchored: the spec is kept and updated as the feature evolves, so it stays a useful reference for future changes.
- Spec-as-source: the spec is the main artefact; humans edit only the spec, and code is regenerated from it.
Most teams today work at the first or second level. Spec-as-source is experimental, partly because regenerating code from the same spec doesn't always give the same result.
The Spec-Driven Development Workflow
The tools differ in names, but the workflow is similar:
- Set project principles (once). Coding standards, testing rules, architecture choices and things to avoid. GitHub Spec Kit calls this a "constitution"; it's similar to what you might keep in AGENTS.md or CLAUDE.md.
- Specify. Describe what to build and why. Focus on behaviour, not implementation.
- Clarify. Have the agent ask questions about gaps and ambiguities, and fold the answers back into the spec.
- Plan. Choose the technical approach: stack, data model, APIs, components. The agent drafts; you review.
- Break into tasks. A dependency-ordered list of small, testable steps.
- Implement. The agent works through the tasks, ideally one at a time, running tests as it goes.
- Verify. Check the result against the spec and acceptance criteria; add tasks for gaps.
You review at every step, and the most valuable review is the earliest: fixing a wrong requirement in the spec takes a minute; fixing it in code takes much longer.
A Spec-Driven Development Example
Here's a compact spec-driven development example for one feature: letting users export their invoices as a CSV file.
1. Spec (`specs/invoice-export/spec.md`)
# Feature: Export invoices to CSV
## Why
Accountants ask support for invoice data every month. Let users export it themselves.
## User stories
- As an account owner, I want to download my invoices as CSV so I can import them into my accounting tool.
## Requirements
1. WHEN the user clicks "Export CSV" on the Invoices page, THE SYSTEM SHALL download a CSV of the invoices matching the current filters.
2. THE SYSTEM SHALL include: invoice number, date, customer name, net amount, tax, total, currency, status.
3. WHEN there are more than 10,000 matching invoices, THE SYSTEM SHALL email a download link instead of downloading directly.
4. IF the user is not an account owner or admin, THEN THE SYSTEM SHALL hide the export button.
## Acceptance criteria
- Given 3 paid invoices, when I export, then the file has a header row and 3 data rows.
- Amounts use a dot as decimal separator and no thousands separator.
- Dates use ISO format (YYYY-MM-DD).
## Out of scope
- PDF export, scheduled exports, custom columns.The requirements use EARS ("Easy Approach to Requirements Syntax"), a format of short, testable "WHEN ... THE SYSTEM SHALL ..." sentences that Kiro also uses.
2. Plan (`plan.md`), drafted by the agent and reviewed by you:
- Add
GET /api/invoices/exportreusing the existing invoice filter parser. - Stream rows with the existing CSV helper to avoid loading everything into memory.
- For more than 10,000 rows, enqueue a job on the existing background queue and email a signed link that expires after 24 hours.
- Permission check through the existing role middleware.
- Tests: unit tests for row formatting, an integration test for the endpoint, and a permissions test.
3. Tasks (`tasks.md`):
- Write row-formatting function and unit tests (dates, amounts, currency).
- Add the export endpoint with filter reuse and streaming; integration test.
- Add the role check; permissions test.
- Add the background job and email for large exports; test with a mocked queue.
- Add the button to the Invoices page, hidden for other roles.
- Update the help-centre article.
4. Implement and verify. The agent completes one task at a time, runs the tests, and you check the result against the acceptance criteria. If you change your mind (say, adding a "paid date" column), you edit the spec first, then update the plan and tasks.
Notice what the spec prevents: the agent won't invent a new CSV library, won't load 50,000 rows into memory, and won't show the button to everyone.
EARS Notation: Requirements Agents Can Follow
EARS (Easy Approach to Requirements Syntax) was developed at Rolls-Royce to make requirements clearer, and it suits AI agents because each sentence is short, specific and testable. Its main patterns:
| Pattern | Template | Example |
|---|---|---|
| Ubiquitous (always true) | THE SYSTEM SHALL ... | THE SYSTEM SHALL store amounts in the invoice's currency. |
| Event-driven | WHEN [trigger], THE SYSTEM SHALL ... | WHEN a user clicks Export, THE SYSTEM SHALL download a CSV. |
| State-driven | WHILE [state], THE SYSTEM SHALL ... | WHILE an export is running, THE SYSTEM SHALL disable the Export button. |
| Unwanted behaviour | IF [condition], THEN THE SYSTEM SHALL ... | IF the export fails, THEN THE SYSTEM SHALL show an error and log it. |
| Optional feature | WHERE [feature is included], THE SYSTEM SHALL ... | WHERE multi-currency is enabled, THE SYSTEM SHALL add a currency column. |
You don't have to use EARS, but writing requirements this way makes gaps obvious: if you can't fill in the trigger or the response, the requirement isn't ready.
Spec-Driven Development Tools
GitHub Spec Kit
GitHub Spec Kit is an open-source, MIT-licensed toolkit that adds a spec-driven workflow to existing AI coding agents. You install its specify command-line tool with uv tool install specify-cli, run specify init in a project, and choose which agent to set it up for. It then gives the agent commands for each step. In GitHub Copilot's default mode they are:
/speckit-constitutionfor project principles/speckit-specifyto write the spec/speckit-clarifyto resolve open questions/speckit-planfor the technical plan/speckit-checklistto review requirement quality/speckit-tasksfor the task list/speckit-analyzeto check spec, plan and tasks for consistency/speckit-implementto carry out the tasks/speckit-convergeto check the code against the spec and add tasks for gaps
How you invoke them varies slightly between agents, so check the Spec Kit docs for yours. The output is a set of Markdown files (spec, plan, tasks and checklists) that you commit with the code.
Kiro
Kiro is an AI IDE from Amazon built around specs. For each feature it creates three files: requirements.md with user stories and acceptance criteria in EARS notation, design.md with the architecture and approach, and tasks.md with an implementation checklist you can run task by task. It also keeps "steering" files with project-wide context.
Other approaches
- Tessl explores the spec-as-source end of the spectrum, where code is generated from specs and marked as not to be edited by hand.
- Plain Markdown: you don't need a special tool. A
specs/folder with spec, plan and task files works with any agent.
Spec-Driven Development With Claude Code
Spec-driven development with Claude Code works well with or without extra tools. A simple setup:
- Keep project rules in `CLAUDE.md`: stack, conventions, test commands, things to avoid.
- Write the spec in
specs/<feature>/spec.md, or ask Claude to draft it from your description and interview you about gaps: "Ask me questions until the requirements are unambiguous, then write spec.md." - Use plan mode to have Claude propose a plan without editing files, then save the agreed plan as
plan.md. - Generate `tasks.md` as a numbered checklist of small, testable tasks.
- Implement one task at a time: "Do task 2 only, run the tests, then stop." Review the diff before moving on.
- Verify against the spec: ask Claude to compare the code with each acceptance criterion and list gaps.
You can also run Spec Kit's commands inside Claude Code by choosing it as the agent when you run specify init. For more on day-to-day use, see our guide on how to use Claude Code.
Spec-Driven Development With GitHub Copilot and Cursor
The same workflow works in other agents:
- GitHub Copilot: Spec Kit's default setup targets Copilot, so
specify initwith the Copilot integration gives you the full set of commands in its agent mode. Specs, plans and tasks live as Markdown files in the repository, where Copilot's coding agent can pick them up. - Cursor: keep project rules in Cursor's rules files or AGENTS.md, write the spec and plan as Markdown, and ask the agent to work through
tasks.mdone item at a time. Spec Kit can also be set up for Cursor. - Any agent: the core of spec-driven development is plain files and discipline. If your agent can read files and run tests, it can follow a spec.
Spec-Driven Development for Teams
For a team, specs become a shared contract between product, design and engineering:
- Keep specs in the repository, in a predictable folder such as
specs/<feature>/, so they're versioned with the code. - Review specs in pull requests before any code is written. A spec review is often the most valuable review of the whole feature.
- Let product managers draft the "why" and requirements, and engineers add constraints and the technical plan.
- Use a template so every spec has the same sections: goal, user stories, requirements, acceptance criteria, constraints, out of scope.
- Update the spec with the code. When behaviour changes, change the spec in the same pull request, or it quickly becomes misleading.
How Much Process Do You Need?
Match the process to the change:
| Change | Suggested approach |
|---|---|
| Typo, small bug, one-line fix | Just ask the agent; review the diff |
| Small feature (under an hour of agent work) | Plan mode or a short written plan |
| Medium feature, several files | Spec + plan + task list in Markdown |
| Large feature, team project or risky area | Full workflow with clarify, analysis and spec review, using a tool like Spec Kit or Kiro |
How to Write a Good Spec for an AI Agent
- Describe behaviour, not code. "Users can export invoices as CSV" beats "add an ExportService class".
- Make requirements testable. Each should have a clear pass or fail.
- Include edge cases and limits: empty states, large inputs, permissions, errors.
- State constraints: existing libraries to reuse, performance targets, security rules.
- List what's out of scope, so the agent doesn't build extras.
- Keep it short. One to three pages per feature. If it's longer, split the feature.
- Version it in Git next to the code, and update it when requirements change.
When Spec-Driven Development Is Worth It
Spec-driven development pays off for:
- Features that take more than an hour or two of agent work.
- Changes that touch several parts of a system.
- Team projects where others need to review intent.
- Regulated or high-risk code where you need a record of requirements.
- Long-running agent sessions that would otherwise drift.
It's usually not worth it for small bug fixes, one-line changes, quick experiments or throwaway scripts. Böckeler found that heavy spec workflows can be overkill for small problems, generating more Markdown to review than code, and that agents sometimes ignore parts of the spec anyway. Match the amount of process to the size and risk of the change.
Common Spec-Driven Development Mistakes
- Specs that are really code designs, which leave no room for the plan step and go stale quickly.
- Specs too vague to test, such as "export should be fast".
- Skipping review of the generated plan and tasks.
- Letting the spec and code drift apart after changes.
- Huge tasks that the agent can't finish or you can't review in one sitting.
- Using a heavy workflow for tiny changes.
- Trusting the agent's own "done" without running tests and checking the acceptance criteria.
FAQ
What is spec-driven development in simple terms?
It's writing down exactly what a feature should do, including requirements and acceptance criteria, before asking an AI agent to build it. The agent turns the spec into a plan, tasks and code, and you check the result against the spec.
Is spec-driven development the same as waterfall?
No. Waterfall specified whole systems far in advance. Spec-driven development works one feature at a time, with short specs that you change and re-plan as you learn, so it stays iterative.
Do I need GitHub Spec Kit or Kiro?
No. They add structure and commands, but you can do spec-driven development with Markdown files and any coding agent: write the spec, plan and tasks in your repository and have the agent work through them.
Does spec-driven development replace tests?
No. Good specs make better tests, because acceptance criteria become test cases. You still need automated tests to check that the agent's code really meets the spec.
Is spec-driven development worth it?
For medium and large features, team work and code that matters, usually yes: it reduces rework and makes AI output easier to review. For small fixes and quick prototypes, a short prompt or plan mode is often enough.