Context
“We use AI code generation” = “we write code faster.”
“We use AI code generation responsibly” = “we write code faster, and it matches what we wanted to get.”
The difference is in three artifacts:
- Specification - a formal description of behavior, contracts, invariants.
- DoR - task readiness criteria, including the presence of a spec.
- Conformance - an automated check that implementation matches the spec.
Signals that you need SDD
- AI generates code that “seems to work,” but fails edge cases in production.
- Code review turns into a discussion of “what were we trying to build at all.”
- Juniors and AI agents write code in different styles, without a shared understanding of the contract.
- Postmortems regularly contain the phrase “the requirement was ambiguous.”
- There are 3-4 round trips between scope clarification and development start.
Three levels of SDD
Level 1: Specification
A spec is not a “40-page technical assignment.” It is:
- Scenarios in
given/when/thenform for main flows. - API contract with types, errors, idempotency.
- Invariants - what must remain true before and after the operation.
- Non-goals - what we explicitly do not do.
The spec is written before code. If it cannot be written, the task is not ready.
Level 2: Definition of Ready
DoR is a checklist that says “this task is ready to enter the sprint.” Minimum:
- The spec is written and released in Notion or the repo.
- Acceptance tests are derived from the spec 1:1.
- Dependencies: other teams, external APIs, migrations - identified.
- The business/product owner confirmed scope.
- Non-goals are captured.
Without completed DoR, the task does not enter work. This removes 80% of “what were we doing at all.”
Level 3: Conformance
Conformance is automated alignment checking:
- Property-based tests for invariants.
- Contract tests for APIs against the spec, for example through OpenAPI + Schemathesis.
- Snapshot tests for key scenarios.
- AI reviewer attached to the spec through
agents.mdor steering files.
Conformance runs on every PR. If it does not pass, it does not merge.
What breaks at scale without SDD
| Size | Without SDD | With SDD |
|---|---|---|
| 3-5 engineers | You can live on verbal agreements, but edge cases leak to production | Moderate benefit: capture a spec for disputed cases and external APIs |
| 5-10 engineers | Requirements in Slack, rework on every second task | DoR cuts about 70% of rework without bureaucracy |
| 10-15 engineers | Half of PRs are scope debates | Spec + DoR close 80% of disputes |
| 10-15 engineers + AI agents | Agents hallucinate scope | Agents are constrained by the spec and produce conformant code |
| 50+ engineers | Refactorings break implicit contracts | Property-based + contract tests keep the surface stable |
How to start using this
- Choose one new feature. Write its spec: 1-2 pages, given/when/then + contract.
- Create a DoR checklist. Apply it to this one feature.
- Generate acceptance tests from the spec. Run them in CI.
- After release, compare this feature’s postmortem metrics with the average.
- If the difference is tangible, scale to the next team.
Metrics
- Percentage of tasks that pass DoR on the first iteration. Target: 70%+.
- Average number of “product -> engineering” round trips before work starts. Target: 1.
- Percentage of bugs caught by conformance tests before production. Target: grows over time.
- Time-to-PR for AI agents with access to the spec. Target: falls.
FAQ
SDD slows down the start of work. How do we sell it to the team?
SDD moves work left: time goes into the spec before code instead of iterations of "wrote it -> rewrote it -> fixed it." After 2-3 sprints, total feature time falls.
Can we use AI to generate the spec?
Yes, but carefully. AI is good at turning a draft into formal given/when/then. AI is poor at guessing which invariants matter in your domain. Use AI as a secretary, not as the author.
What do we do with old code without specs?
Do not do it retrospectively. Specs are written for new code and for areas that are actively changing. Covering legacy with specs means spending a quarter documenting what already works.
How does conformance combine with fast experiments?
Conformance applies to features in production. Experiments live in a feature-flag branch with relaxed requirements: a basic contract without property tests.