Definition: A development approach in which the system’s behavior and requirements are precisely defined in a Specification before implementation.
Simply put: Instead of saying “go write the code,” you first specify exactly what should be built and what requirements it must satisfy.
Examples:
- Write the API Contract first, then build the API.
- Write Acceptance Criteria first, then implement the feature.
- Define Login behavior first, then start coding.
STD = Spec-Driven Development / Specification-Driven Development
It means:
Define the expected behavior/specification first, then implement the code to satisfy that specification.
A simple flow is:
Specification
↓
Tests
↓
Implementation
↓
Run tests
↓
RefineExample
Suppose you’re building a login API.
First, define the specification:
POST /login
Given:
- valid email
- valid password
Then:
- return 200
- return an access token
Given:
- wrong password
Then:
- return 401Then you can write tests for those requirements:
✓ valid credentials → 200
✓ wrong password → 401
✓ missing email → 400Then implement the login functionality until the tests pass.
STD vs TDD
They’re related but not exactly the same.
TDD — Test-Driven Development
Test
↓
Code
↓
RefactorYou write a test before the implementation.
Spec-Driven Development
Specification
↓
Implementation
↓
Tests/verificationThe specification is the source of truth. Tests are often derived from or used to verify the specification.
So if you’re working with an AI coding agent, STD can be particularly useful:
Requirements/spec
↓
Agent understands what must be built
↓
Agent implements
↓
Agent writes/runs tests
↓
Verify against specShort version:
STD = build according to a clearly defined specification, rather than starting by writing code and figuring out the requirements afterward.