2 min read

Spec-Driven Development

Spec-Driven Development
Photo by John Moeses Bauan / Unsplash

The plan-then-execute pattern hints at something bigger. Taken seriously, "write the plan first" becomes a full, tool-independent workflow: spec-driven development. It's the durable evolution of "Plan mode" β€” and it scales far past a single prompt.

The idea

πŸ“œ Write the specification first. Make the spec the source of truth. Have the agent implement against it β€” and verify the code back against it.

Instead of describing a feature in a throwaway chat message and hoping the agent guessed right, you produce a durable artifact β€” a spec β€” that says what to build and how you'll know it's done. The agent builds to that spec; you review against that spec.

Why it works so well with agents

  • 🎯 Removes ambiguity up front. Most bad AI output traces to an underspecified request. A spec forces the decisions before code exists, when they're cheap to change.
  • πŸ” Turns review into spec-checking. Reviewing 400 lines of AI diff line-by-line is exhausting and error-prone. Reviewing "does this satisfy the spec?" is faster and catches the errors that matter β€” the semantic ones. (This is the heart of Verifying AI Output.)
  • πŸ” It's re-runnable. If the implementation is wrong, you fix the spec and regenerate β€” rather than patching a mystery diff.
  • πŸ‘₯ It's shareable. A spec is reviewable by teammates who'd never read the raw diff.

A lightweight flow

  1. Draft the spec. Goal, acceptance criteria, constraints, out-of-scope. Often you co-write it with the AI ("ask me clarifying questions, then draft a spec").
  2. Review & approve the spec β€” this is where you spend your judgment, before any code.
  3. Agent implements against the spec β€” feed the spec in as context; let it build.
  4. Verify the implementation against the spec β€” does each acceptance criterion hold? Tests pass?
  5. Iterate on the spec, not the diff β€” when something's off, update the spec and regenerate.

Guard against spec–code drift

The main failure mode: the code evolves, the spec doesn't (or vice versa), and they quietly diverge. Defenses:

  • ✍️ Keep the spec in the repo, versioned alongside the code (a specs/ folder, or a design doc per feature).
  • πŸ”— Reference the spec from the PR; update it in the same change when behavior changes.
  • βœ… Encode acceptance criteria as tests where possible β€” an executable spec can't silently drift from the code.

Tooling β€” one example, not a requirement

The workflow is tool-agnostic β€” you can do it with a Markdown file and any agent. If you want structure, GitHub Spec Kit is one open, model-agnostic toolkit for spec-driven development worth knowing. Treat it as an example of the pattern, not the pattern itself β€” the discipline (spec first, implement against it, verify against it) is what's durable.


Bottom line: for anything beyond a trivial change, the plan/spec is the work. Get it right and the code is almost a formality the agent fills in; get it wrong and no amount of clever prompting saves you.

Next: how tools get external context and capabilities β†’ MCP Servers.