Spec-driven development

Definition
Spec-driven development is writing down exactly what you are building, its scope, states and data, before any code gets written, so the spec becomes the contract the build follows.

Why it matters

Guesses compound. A missing edge case here and an assumed default there, and the shipped result drifts from what was needed. Writing the spec forces the hard cases into view while they are still cheap to fix. It also gives a plain test at the end: does the finished feature behave as the spec says in each state?

How to apply it

  1. Write the problem and the out-of-scope list first.
  2. Describe behaviour as User story items a person could check.
  3. List the unhappy paths, such as failed payment or empty results. See Edge case.
  4. Keep the spec next to the work, in the issue or the repository.
  5. Change the spec before changing the code when a decision changes.

What it is

A spec, short for specification, is a written description of what a feature must do. In this approach the spec comes first and the code follows it. That matters more now that AI coding agents write much of the code. An agent given a vague title fills every gap with a guess. An agent given a clear spec has something to build against and something to be checked against.

A useful spec is short and specific. It usually holds:

  • The problem and who has it.
  • What is out of scope.
  • User stories that can be tested.
  • Every state the feature can be in, including empty, loading, error and cancelled.
  • The data it reads and writes.
  • How success will be checked.

Common mistakes

  • Describing how to build it instead of what it should do.
  • A long document nobody rereads.
  • Never updating it after launch.
  1. Article

    User story

    The testable unit a spec is built from.

  2. Article

    Prototype

    A fast way to test a spec's assumptions.

  3. Article

    Scope creep

    What a written out-of-scope line prevents.

  4. Article

    Vibe coding

    The looser style this approach tightens.

Where it shows up

  • Writing copy that feels like conversation instead of marketing. How to sound like yourself.
    12 chapters