Skip to content

What are SDD and TDD?

SDD and TDD guide development with specifications and tests: the first tells an AI agent what to build, the second puts a test before each small step of code.

SDD and TDD are two software development approaches that start with what a program must do. Spec-Driven Development (SDD) uses a specification (a document describing expected behavior and constraints) to guide an AI agent, a program that uses a model to carry out tasks, as it writes the code. Test-Driven Development (TDD) instead starts with a test, an executable check, written before the code: the developer watches it fail, writes just enough code to make it pass, and then refactors, or reorganizes the code. The cycle repeats in small steps. A specification helps even people in different roles agree on the intended result; a test checks a concrete behavior each time it runs. The methods can work together: tests also check the code the agent writes. Neither the specification nor the tests alone prove that every requirement is correct or covered. Human review and checks proportionate to the risk are still needed.

See also: Test automation pyramidThe test automation pyramid guides the mix of automated checks, favoring narrowly scoped tests and pairing them with checks on integrations and workflows.

Specifications, tests, and AI agents

Spec Kit is a tool for organizing work around specifications. It can pair a specification with tests written before code, without making TDD mandatory in every project. Specifications may be used only at the outset or maintained throughout the software's life. In her hands-on review of SDD tools, Birgitta Böckeler often saw the agent fail to follow instructions, despite templates and checklists. An approved specification therefore does not guarantee that code conforms to it. AI agents need checks on their output, not just initial instructions.

What TDD studies show

In the four industrial teams studied by Nagappan and colleagues in 2008, pre-release defect density fell by 40% to 90% compared with similar projects without TDD. Teams subjectively estimated a 15% to 35% increase in initial development time. These are case studies, not a randomized controlled trial.

In a 2017 study by Fucci and colleagues of 39 professionals, quality (measured as functional correctness) and productivity were associated mainly with small, regular steps; test-first versus test-last order showed no meaningful effect. This does not prove that writing tests first is useless everywhere; it suggests weighing the frequency and size of checks too. The test automation pyramid covers the separate question of testing levels.

The cost of specifications

In a comparison by Colin Eberhardt, the author, working alone, rebuilt a feature of his personal app with Spec Kit, using manual checks instead of the default TDD, and with iterative prompting. With Spec Kit, he reported 689 lines of code, 2,577 lines of documentation, and about three and a half hours of review. He estimated he was about ten times faster without SDD and observed neither better code nor fewer defects. This is one person's experience and cannot be generalized.

An enterprise example

To change order approval rules, a team might agree in the specification on who can authorize an order and which cases must be rejected. Then, one behavior at a time, the team writes a test, watches it fail, and asks an agent for the minimum code to pass it. Human review checks both the specification and the changes; tests that run in the CI/CD pipeline (the automated sequence for checking and releasing software) detect the violations they were designed to catch. A missing test cannot protect a forgotten requirement.

Why it matters for decision makers

Anyone commissioning software development can ask which requirements will be kept current, who approves changes, and how much time review and maintenance require. A preprint on SDD practices reports that participants saw more reliable agent behavior along with higher planning and review costs; implementation details can help agents but make specifications go stale more easily. Weigh that overhead against the work at hand and keep executable checks on critical requirements, rather than treating the existence of a specification as proof of conformance.

Frequently asked questions

SDD uses a specification of behavior and constraints to guide an AI agent that writes code; TDD uses tests written before code in short, repeated cycles.

Yes. The specification describes the intended result, and tests check concrete behaviors, even when an AI agent proposes the code.

No. A specification can be incomplete or not followed: key requirements need review and verification.
  • Test automation pyramidThe test automation pyramid guides the mix of automated checks, favoring narrowly scoped tests and pairing them with checks on integrations and workflows.
  • AI-Assisted TestingAI-Assisted Testing uses artificial intelligence to propose and maintain software tests, which people then check against expected outcomes and business risks.
  • AI workflows vs AI agentsA workflow follows predefined code paths; an agent decides its own steps. A workflow is enough for most SMBs.
  • CI/CDContinuous Integration and Continuous Delivery: every software change is tested and shipped to production automatically and frequently.
  • LeanLean is a proof assistant: a trusted kernel checks every proof, and Mathlib collects already verified mathematics, ready for reuse.

See it in the universe

If you need the AI in production, not in a demo, that is my job.

See AI integrations

Or write to me.