Engineering Guide

Spec-Driven Development (SDD) for AI Agents & When to Skip It

Spec-driven development flips the AI coding workflow: you write a precise, versioned specification first, and the agent implements to it — with the spec, not the code, as the source of truth. It emerged in 2025 as the antidote to vibe coding. This guide separates SDD from TDD, maps the tools that disagree on what the loop even is, and gives you a blast-radius rule for when a spec is worth the token tax.

Diagram of the spec-driven development loop from Specify to Verify for AI coding agents

What SDD actually is

Spec-driven development (SDD) treats the specification as the source of truth and code as a downstream artifact generated to match it. GitHub, whose Spec Kit toolkit popularized the term, frames it bluntly: intent is the source of truth, and code serves specifications, not the reverse. You write the goals, architecture, constraints and acceptance criteria first; the agent turns that into an implementation; and when the two drift, you fix the spec and regenerate — not the other way around.

SDD emerged in 2025 as a direct response to a failure mode of AI coding: agents produce plausible code that drifts from intent, hallucinates APIs, and decays as the project scales. The named villain is vibe coding — Andrej Karpathy's early-2025 coinage for writing a short prompt, letting the agent generate, running it locally, checking whether it matches expectation, and iterating until it is good enough. Note the contrast only holds against that loose prompt-and-hope sense, not against all AI-assisted coding.

Why does this suit agents specifically? Agents are extraordinarily good at generating code and nearly incapable of maintaining long-term coherence without structured context. A spec removes the guessing at thousands of unstated requirements. It lets a human review the plan before a single line of code exists, and it hands the agent checkable acceptance criteria instead of vibes. If you are new to running these agents day to day, our guide to using Claude Code is a useful companion here.

SDD vs vibe coding vs TDD

The most common confusion is SDD versus test-driven development. They are not competitors — they operate at different altitudes and often coexist. TDD's primary artifact is a failing unit test (write test, write code, refactor) that answers a narrow question: is this implementation correct? SDD's primary artifact is a spec — architecture, non-functional requirements, constraints — that answers a broader one: is this the implementation we agreed to build? Crucially, most SDD workflows still produce TDD-style tests as an output of the spec.

DimensionVibe codingTDDSpec-driven (SDD)
Primary artifactA short promptA failing unit testA versioned spec
Question answeredDoes it look right?Is the code correct?Is this what we agreed to build?
When review happensAfter generationPer test cycleBefore any code exists
When cost is paidAlmost nothing upfrontSteady, per unitHeavy upfront
Where it decaysFast, as scope growsRarely, tests pin behaviorOnly if the spec goes stale
Best forThrowaway prototypesWell-scoped logicMulti-person, money, user data

The economics matter. Vibe coding is faster for the first twenty minutes and slower every hour after, because review and rework cost is paid at the end, when changes are most expensive. SDD front-loads that cost into a phase where changing your mind is cheap — you are editing markdown, not untangling generated code.

The Specify-to-Verify loop

The canonical SDD loop is Specify, Plan, Tasks, Implement — each phase producing a markdown artifact that feeds the next. Claude-Code-flavored descriptions often frame it as Specify, Plan, Implement, Validate. Either way, the point is that structure is a chain of reviewable documents, not a single monolithic prompt.

Specify spec.md Plan plan.md Tasks tasks.md Implement code Verify checks Verify fails to meet acceptance criteria — revise the spec, not the code
The four-artifact SDD loop, with the correction path back to the spec highlighted. Phase names follow GitHub Spec Kit; tool naming varies. Chart: DataLLM Lab

The last box is the one teams skip and regret. Specs with checkable success criteria — npm test passes, curl returns 200 — produce more reliable agent outcomes than interpretable criteria like well-structured code or good performance. An agent cannot verify a vibe. It can verify an exit code. That single discipline is most of the value.

The tools disagree on the loop

Here is the information-gain point most definitive guides skip: the loop is not standardized. Every tool recites Specify-Plan-Tasks-Implement, but the actual artifacts and file names differ enough that you cannot copy one team's setup into another tool. Map your own tool before you commit:

The pattern underneath all three: a standing instruction file for durable context, and a per-task spec for the thing you are building right now. If you push this further into reusable capability packs, our write-up on Claude Code Skills covers how to package specs and workflows so agents reuse them. And when you split planning from execution across models, the orchestrator-executor pattern is essentially SDD with the spec-writer and the implementer as different agents.

Run every phase of the loop on one API key

Plan with a frontier reasoner, implement with a cheap coder, verify with something in between — SDD spans models. DataLLM Lab is an OpenAI-compatible gateway with 300+ models behind a single key at https://www.datallmlab.com/v1, so you route each phase to the right model without juggling accounts.

When to spec vs when to vibe

Most posts end with always write a spec. That is wrong, and the honest practitioners say so. SDD is considered overkill for throwaway prototypes, solo short-lived projects, and genuine exploratory coding — anywhere speed to market dominates and the code will not outlive the week. Writing a high-quality spec takes time, domain knowledge, and the discipline to think through edge cases before you know if the idea even works.

Instead of a blanket rule, triage by blast radius and reversibility. The heuristic that shows up across the honest sources: the moment another human touches the code, or it touches money or user data, write the spec first. Below that line, vibe coding is often the rational choice — the review-at-the-end cost never gets large enough to matter.

If you route by phase across many models, a router that swaps model per task keeps this clean — our Claude Code Router guide walks through wiring plan and implement steps to different backends.

The honest costs

SDD is not free, and pretending otherwise is how teams get burned. The core trade-off: SDD shifts investment heavily upfront in exchange for clarity, quality, maintainability, and far fewer regenerate-from-scratch cycles. That upfront phase is a genuine disadvantage where speed to market is the whole game.

Three named failure modes are worth internalizing before you adopt it:

Reported benefits — several-times-higher first-pass success on non-trivial tasks, order-of-magnitude fewer regenerate cycles, tens of thousands of GitHub stars on Spec Kit — circulate widely, but they originate largely from vendor and early-adopter reports rather than verified primary telemetry. Treat them as directionally encouraging, not as measured fact. The reliable claim is the qualitative one: for work with real blast radius, a spec removes wrong turns that vibe coding pays for at the worst possible time.

FAQ

What is spec-driven development?

Spec-driven development (SDD) is a methodology where you write a precise, versioned specification first and an AI agent implements code to match it. The spec is the source of truth and the code is a downstream artifact generated from it. GitHub frames this as intent being the source of truth, with code serving specifications rather than the reverse.

How is SDD different from TDD?

TDD's primary artifact is a failing unit test that answers whether an implementation is correct. SDD's primary artifact is a spec covering goals, architecture, constraints and acceptance criteria that answers whether this is the implementation you agreed to build. They operate at different altitudes, and most SDD workflows still produce TDD-style tests as one of their outputs.

Is spec-driven development just waterfall in markdown?

Critics do dismiss it as waterfall in markdown, and the risk is real when a spec is written once and never maintained. The difference in practice is that specs stay living documents, updated as you learn, and each phase is reviewable before code exists. The honest cost is a token tax paid whenever reality forces you to re-explain an architectural change to the agent.

What tools support spec-driven development?

GitHub Spec Kit, launched September 2, 2025, adds a spec workflow to agents like Copilot, Claude Code and Gemini CLI via slash commands. AWS Kiro is an agentic IDE built on SDD that uses EARS notation for requirements. Claude Code offers a read-only Plan Mode for the planning phase. Cursor and others support similar patterns.

When should I skip writing a spec?

SDD is considered overkill for throwaway prototypes, solo short-lived projects and genuine exploratory coding, where speed to market dominates. A common triage heuristic: the moment another human touches the code, or it touches money or user data, write the spec first. Below that blast radius, vibe coding is often the rational choice.

Why does SDD suit AI agents specifically?

Agents are highly capable at generating code but nearly incapable of maintaining long-term coherence without structured context. A spec removes the guessing at thousands of unstated requirements, enables review before any code exists, and provides checkable acceptance criteria such as npm test passes or curl returns 200, which produce more reliable outcomes than vague criteria like well-structured code.

Written by
Kevin Fan

Founder of DataLLM Lab, the unified LLM gateway. Kevin tests models the boring way — same prompts, real costs, unedited outputs — and writes up what the runs actually show.

One API for every model

One API, every model.

Get a single API key for Claude Opus 4.7, GPT-5.4, and 300+ more — with automatic price comparison and routing to the best model for every request.