Spec-Driven Development
Write the specification first, then let the agent implement against it - so the argument about what to build happens before any code exists
What Spec-Driven Development Is
The specification becomes the source of truth, and the code becomes its output
Spec-driven development inverts the usual order of an AI coding session. Instead of describing a change in a chat message and steering the result, you write a specification first - what the feature must do, what counts as done, what is out of scope - and the agent implements against that document. The spec is reviewed, versioned, and amended like code. The code is what falls out of it.
The argument for doing this is economic rather than moral. Give a capable agent a vague prompt and it does not stall or ask for help. It produces plausible, well-formed, confidently-written code that compiles, passes a linter, and solves a problem adjacent to the one you had. Because the output looks finished, nothing signals that a decision was guessed. The mistake then surfaces in review, in QA, or in production - each a more expensive place to have the conversation than a paragraph nobody has implemented yet.
A specification moves the disagreement to the cheapest possible moment. Two engineers who read the same acceptance criterion differently discover that in minutes, and the fix costs one sentence. The same disagreement found in a nine-hundred-line diff costs a re-implementation. Agents worsen that asymmetry, because they produce the expensive artifact so fast that there is no natural pause in which somebody would have noticed.
Intent Before Implementation
The spec holds what and why; the plan holds how. Separating them stops an implementation detail from silently becoming a requirement
Cheap Disagreement
Rewriting a paragraph costs minutes. Rewriting a merged feature costs a sprint. The spec is where you want to be wrong
A Durable Record
Six months on, the spec answers why a behavior exists. A chat transcript answers nothing and is usually gone
Vibe Coding, and Where It Stops Working
Not a rebuke - a different tool for a different level of stakes
Vibe coding is prompt-and-accept: you describe roughly what you want, look at what comes back, and iterate on results you never specified. It deserves more respect than it gets. For a throwaway script, a prototype answering one question, or a spike into an unfamiliar library - anywhere the cost of being wrong is a deleted branch - it is the fastest way to work.
It stops working at a predictable point: when the artifact must be maintained, reviewed by somebody who was not in the conversation, or held to a requirement a customer or auditor will later check. The absence of written intent is then not a stylistic gap but a missing contract - nobody can say whether the code is correct, because correct was never defined.
Spec-driven development is therefore not the opposite of vibe coding but what you graduate to when the stakes change, and most teams need both. The failure worth avoiding is using the throwaway technique on work that was not throwaway.
Vibe Coding Fits
Prototypes, spikes, one-off data munging, internal tooling with one user - anything you would delete rather than debug
Spec-Driven Fits
Multi-person features, anything touching money, identity, or personal data, public API surface, and any behavior somebody must later justify in an audit
The Loop, Artifact by Artifact
Constitution, specify, plan, tasks, implement - with clarify, analyze, and checklist as optional gates
The loop is usually summarized as specify, plan, tasks, implement, which is one step short. GitHub's Spec Kit, the reference implementation, lists constitution as step three of seven in its own getting-started sequence and puts it in the core command table, not the optional one. The accurate core loop is constitution, specify, plan, tasks, implement - and each stage has a characteristic failure when skipped.
Constitution
Durable rules that outlive any one feature: language choices, testing obligations, security constraints, house style. Skip it and every spec re-litigates the same decisions, differently each time
Specify
The what and the why, deliberately free of implementation detail. Skip it and there is no definition of done, so review becomes a matter of taste
Clarify
An explicit pass that surfaces what the spec left ambiguous and forces a human answer. Spec Kit marks it optional but recommends it before planning. Skip it and the agent resolves the ambiguity invisibly
Plan
The how: architecture, data model, libraries, migration order, rollout. Keeping it out of the spec lets you change approach later without appearing to change the requirement
Tasks
The plan decomposed into units small enough to verify independently. Skip it and the agent attempts the whole feature at once, producing the enormous diff the spec was meant to prevent
Implement
The agent executes the task list against the plan, checking its work as it goes. This stage assumes it can run the build and the tests - a bigger assumption than it looks
The optional commands are gates, not stages. Analyze cross-checks spec, plan, and task list and reports where they have drifted apart; checklist generates review criteria to walk through before accepting work. Neither writes code. Both exist because the expensive errors here are inconsistencies between documents that each look fine alone.
Anatomy of a Spec Worth Implementing
Acceptance criteria a machine could check, non-goals stated out loud, and open questions left open
Most specs fail on the same three things. Acceptance criteria are written as adjectives rather than observations, so nobody can tell when they are met. Non-goals are absent, so the agent helpfully builds adjacent features nobody asked for. And open questions get quietly resolved by whoever writes the prompt, reintroducing the vagueness the spec was meant to remove. A useful test: could a reviewer who has never seen the code decide, from the criteria alone, whether the implementation passes?
# Feature: Idle Workspace Auto-Suspend
## Why
Cloud development workspaces bill for compute while idle. Suspending is manual
today, and most developers never do it, so platform spend tracks headcount
rather than usage.
## User stories
US-1 As a developer, I want an idle workspace suspended automatically, so that
I am not billed for time I did not use.
US-2 As a developer, I want to resume a suspended workspace with my uncommitted
work intact.
US-3 As a platform admin, I want to set the idle threshold per template, so
that GPU workspaces can suspend sooner than CPU workspaces.
## Acceptance criteria
AC-1 Given a workspace with no SSH session, no request to a forwarded port, and
no terminal input for the configured threshold, when the reconciler runs,
then the workspace transitions to state `suspended`.
AC-2 Suspend and resume preserve the contents of $HOME and of any volume
mounted at /workspace, byte for byte.
AC-3 A workspace running a process named in `keepalive_processes` never
suspends, regardless of idle time.
AC-4 The developer receives exactly one warning notification 5 minutes before
suspension, and no more than one per idle period.
AC-5 Resume completes in under 90 seconds at p95, measured over 100 resumes of
the default template on a warm node pool.
AC-6 Every suspend and resume emits an audit event carrying workspace id, actor
(`system` or a user id), and reason.
## Non-goals
- Deleting workspaces. This feature suspends only; deletion stays manual.
- Scheduled or calendar-based suspension. Idle detection only.
- Cross-region migration on resume.
- Changing how billing is calculated. This feature emits events; billing
consumes them.
## Open questions
- Q1 Does an attached but idle debugger count as activity? Owner: platform.
- Q2 Default threshold when a template sets none? Proposed 30 minutes,
needs finance sign-off.
- Q3 Suspend a workspace holding unpushed commits, or warn and skip?
Notice what the criteria do not say: nothing about which scheduler runs the reconciler, which channel delivers the warning, or how state is persisted. Those belong in the plan. Notice also that AC-5 carries a measurement method. "Resume should be fast" is not a criterion but a mood, and an agent will treat it as satisfied by whatever it built.
Running the Loop with Spec Kit
A CLI that scaffolds the workflow, plus namespaced slash commands inside your coding agent
Spec Kit is MIT licensed and installs as a CLI called specify, which scaffolds prompt templates and directory layout into an existing project. One detail catches out anyone following an older tutorial: every slash command is namespaced with a speckit. prefix. The bare /specify and /plan forms are pre-v0.0.30 names and no longer appear in the README.
# Install the CLI, pinned to a release you have tested against
uv tool install specify-cli --from git+https://github.com/github/[email protected]
# Scaffold the workflow into a project, wired to your agent of choice
specify init my-project --integration copilot
# Then, inside the coding agent, run the core loop:
/speckit.constitution # durable project-wide rules
/speckit.specify # the WHAT and the WHY
/speckit.clarify # optional, recommended before planning
/speckit.plan # the HOW: stack, architecture, constraints
/speckit.tasks # decompose into independently verifiable units
/speckit.analyze # optional gate: cross-check spec, plan, tasks
/speckit.implement # the agent executes the task list
# Also in the core set:
/speckit.taskstoissues # push the task list out as tracker issues
/speckit.converge # reconcile drift between artifacts
/speckit.checklist # optional: generate review criteria
The README describes support for "30+ AI coding agents", so the workflow is not tied to one vendor's assistant. Pin the version you scaffolded from: the command surface has already been renamed once, and templates from one release need not match the prompts of the next. Spec Kit is among the most-starred repositories in this space, at 123,823 stars with v0.14.2 current - both observed July 26, 2026, and both a snapshot rather than a stable figure.
The Tooling Landscape
Four implementations that agree on the shape of the workflow and differ on almost everything else
| Tool | Artifacts Produced | Command Prefix | License | Where It Runs |
|---|---|---|---|---|
| spec-kit | Constitution, spec, plan, task list, optional checklists | /speckit. | MIT | The specify CLI, driving a stated "30+ AI coding agents" |
| OpenSpec | proposal.md, design.md, tasks.md | /opsx: | MIT | Inside AI coding assistants; loop is explore, propose, apply, archive |
| Kiro | requirements.md (or bugfix.md), design.md, tasks.md | - | Commercial, AWS | An agentic IDE, with specs, steering, and hooks as first-class features |
| BMAD-METHOD | Agent-role workflow packs spanning planning through implementation | - | MIT with an added trademark reservation | npm package bmad-method, currently V6 |
| Antigravity | Artifacts emitted during a run: task lists, implementation plans, walkthroughs, screenshots, browser recordings. Not spec-driven | - | Commercial, Google | Standalone desktop app, plus a CLI and an SDK |
A dash in the command-prefix column means the tool exposes no namespaced prefix, or the prefix was not verified for this page. OpenSpec calls itself "spec-driven development (SDD) for AI coding assistants" and organizes work as change proposals that are applied then archived, which suits teams already thinking in RFCs. Kiro keeps specs on disk in a per-feature directory - though a bug-fix spec emits a bug analysis instead of requirements, so the file set is not fixed. BMAD-METHOD is the most opinionated, shipping role-playing agent personas for planning; its own repository expands the acronym two different ways, so treat any expansion as unreliable.
Antigravity Is a Useful Contrast, Not an Example
Google's Antigravity is often listed as spec-driven. It is not, and Google does not use the word - its launch material describes agents producing Artifacts, "tangible deliverables in formats that are easier for users to validate than raw tool calls, such as task lists, implementation plans, walkthroughs, screenshots, and browser recordings". The distinction is worth holding onto: a spec is written before the work and is the contract; an artifact is emitted during the work and is evidence. Only one can be wrong before any code exists
The Spec Is the Better Review Artifact
Two pages a reviewer will actually read beats nine hundred lines they will skim
Review is where agent-generated code accumulates, because generation is far cheaper than the attention needed to check it. Large machine-written diffs are also unusually hard to review well: the code is stylistically consistent, plausibly commented, and free of the small tells - a clumsy variable name, an obvious copy-paste - that normally warn a reviewer something was not thought through. Reviewers compensate by skimming, and skimming catches typos rather than misunderstood requirements.
A two-page spec inverts the yield. It is short enough to read properly, written in the domain's language rather than the framework's, and it exposes the expensive errors: the wrong feature, the missed edge case, the requirement nobody agreed to. Code review does not disappear but changes character. Instead of "is this right?", the reviewer asks the far more tractable "does this match AC-3?" - and where a criterion is mechanically checkable, a test answers it with no human at all.
That connects directly to the AI code review bottleneck: you cannot out-hire a generation rate, so the only durable fix is moving judgment earlier, where it is cheap. Spec-driven development is one half of that answer; agentic engineering is the other, covering how the agents themselves are designed and supervised.
The Honest Counter-Case
The ceremony can exceed the work, and a stale spec is worse than none
Writing a rigorous specification is expensive, and it is a distinct skill most engineering teams have never had to develop. Requirements engineering fell out of fashion for reasons, and not everyone who lost the habit can pick it back up on demand. For a small, well-understood change - a copy fix, a config bump, a one-file refactor you could make in four minutes - the full loop is strictly slower than doing the work. Running it anyway makes the process performative, not the change safer.
Specs also rot, and one that no longer matches the shipped code is worse than none, because it is trusted: the next engineer or agent reads it as current and builds on a false premise. A badly written spec does not remove vagueness either, it relocates it - the ambiguity now carries the authority of having been reviewed. Apply the discipline deliberately rather than universally.
Do Not Spec This
Changes smaller than the spec describing them. Spikes whose point is to learn what to build. Prototypes with a deletion date. Emergency fixes, where the write-up belongs in the incident review. And work whose requirements you do not know yet - a spec written to discover a requirement just invents one
Keeping Specs Honest
Keep the spec in the repository so it moves through the same pull request as the code. Amend it in the change that contradicts it, or delete it. Archive completed specs instead of leaving them as ambient documentation. Treat an open question as a blocker - it is what the agent will guess
Be realistic, too, about what tooling can fix. The 2025 DORA report, State of AI-assisted Software Development, frames AI as "an amplifier, magnifying an organization's existing strengths and weaknesses". That cuts both ways: a team that already writes clear requirements gets a great deal out of a spec loop, while a team that cannot articulate what it wants produces a vague spec and the agent implements the vagueness faithfully and fast. Google Cloud, announcing that report in September 2025, said that of nearly 5,000 respondents surveyed, 90% use AI at work and more than 80% believe it raised their productivity, while 30% report little or no trust in the code it generates.
The Environment Is the Silent Dependency
Verifiable acceptance criteria are only verifiable if the agent can run the build
Every stage before implement is a document problem. Implement is an infrastructure problem, and that is where teams are most often surprised. The value of checkable acceptance criteria is that something can check them, which means the agent must install dependencies, start services, run the tests, and read the failures. If setup lives in a senior engineer's shell history, or the tests only pass on a machine that has been up for three weeks, implement quietly degrades into generating code nobody has verified.
That is the prerequisite agent readiness covers, best audited before adopting a spec workflow rather than after. A machine-runnable setup - an AGENTS.md the agent reads on entry, plus hermetic builds giving the same result on a cold container as on a laptop - is what turns an acceptance criterion from an aspiration into a gate. Once it holds, the loop can run unattended: see headless agents in CI, and autonomous development for how far that can be pushed.
The ordering matters. Adopting spec-driven development on top of an environment your agents cannot reproduce buys the cost of the ceremony and none of the verification. Fix the environment first; the spec loop is what you build on top of it.
Related
The practices and infrastructure a spec loop depends on
Agentic Engineering
The discipline of designing and supervising the agents that implement your specs
AGENTS.md
The in-repo file that tells an agent how to build, test, and behave in your codebase
Agent Readiness
Auditing whether an agent can actually run your build and verify its own work
Autonomous Development
How far the implement stage can be pushed without a human in the loop
AI Code Review Bottleneck
Why generation outruns review, and what moving judgment earlier actually buys
Headless Agents in CI
Running the specify-to-implement loop unattended inside your pipeline
