Skip to content

Spec-Driven Development

Spec-Driven Development, or SDD, is a development model where the specification is the primary source of truth and code is treated as one implementation of that specification.

In AI-assisted development, SDD matters because agents are very sensitive to ambiguity. A vague prompt creates plausible but unreliable code. A precise spec gives the agent a stable target.

mermaid
flowchart TB
    I[Intent] --> S[Specification]
    S --> C[Clarification]
    C --> P[Implementation plan]
    P --> T[Tasks]
    T --> X[Code]
    T --> V[Tests]
    X --> F[Feedback]
    V --> F
    F --> S

What changes in SDD

Traditional habitSDD habit
Code becomes the only real truthSpec remains the authoritative intent
Requirements are written onceSpecs evolve with implementation and feedback
Technical work starts quicklyAmbiguity is resolved before implementation
Tests are added after codeAcceptance criteria and tests are derived from the spec
AI gets a promptAI gets structured context

A strong AI-ready spec

An AI-ready spec should include:

  1. Business goal.
  2. Users or actors.
  3. Main user journeys.
  4. Acceptance criteria.
  5. Non-goals.
  6. Edge cases.
  7. Data model or API contracts.
  8. Error handling.
  9. Security and privacy constraints.
  10. Performance or reliability constraints when relevant.
  11. Open questions.
  12. Test expectations.

Weak specs tend to use words like "nice", "fast", "smart", or "simple" without measurable criteria.

SDD is not waterfall

SDD does not mean freezing requirements upfront. Good SDD is iterative:

mermaid
flowchart LR
    S[Living spec] --> P[Plan]
    P --> T[Tasks]
    T --> C[Code]
    C --> V[Validation]
    V --> F[User and operational feedback]
    F --> S

The key is that when the intent changes, the spec changes first or at least changes together with the code.

Best use cases

Use caseWhy SDD helps
New product featureClarifies user value, acceptance, and edge cases
API or contract designConnects requirements to implementation and tests
Multi-agent developmentGives every agent the same source of truth
Refactor with preserved behaviorDefines the expected behavior before changing internals
Team onboardingExplains why the code exists, not just how it works

Where SDD can be wasteful

SituationRisk
Very small editsThe process can cost more than the change
Research spikesThe spec may pretend certainty before discovery
Teams that do not update docsThe spec becomes stale and misleading
Product discovery is still unclearDiscovery should happen before formalization

Built as a static bilingual AI engineering stack guide.