← Back to Tutorials

Specification-Driven Development, Explained Simply

AI

The Short Version

Specification-Driven Development (SDD) means writing down what you're building and why before you or an AI assistant writes a single line of code. The documentation isn't a chore you do afterward for a boss who wants a paper trail — it is the project. The code is just the documentation, translated into a language a computer can run.

Think of it like building a house. Nobody hands a contractor a two-sentence description and expects a house that matches what was in their head. You draw blueprints first: where the walls go, where the plumbing runs, how many bedrooms. The blueprint is the single source of truth. The construction crew builds from it, and if reality and blueprint disagree, you update the blueprint — you don't just wing it and hope everyone remembers the plan the same way.

SDD applies that same idea to software, and it matters more than ever now that AI assistants like Claude Code are doing a lot of the actual typing.

Why Most AI-Assisted Projects Fall Apart

If you've used an AI coding assistant for more than a few sessions, this will sound familiar:

  • The AI forgets context. You explain your project on Monday. By Thursday's session, it has no memory of Monday's decisions unless you re-explain everything.
  • Features drift. What you're building slowly wanders away from what you originally wanted, one small "sure, I can add that" at a time.
  • Decisions aren't documented. You decided three weeks ago to use approach A instead of approach B, for a good reason. Nobody — human or AI — remembers that reason today.
  • The code outgrows the prompts. Your project is now bigger than any single conversation could ever describe from memory.

Here's the key insight: the problem was never that the AI wasn't smart enough. The problem is that there was no shared, written-down source of truth both you and the AI could return to. Ask ten people to describe a project from memory and you'll get ten slightly different answers. Ask an AI the same question across ten separate sessions, and you get the same problem — just faster.

The Core Philosophy: Good Software Is Written Twice

There's an old software engineering idea that SDD leans on directly: good software gets written twice.

  • First, as documentation. Plain language describing what you're building, why it matters, how it's structured, and what "done" looks like.
  • Second, as code. The actual implementation, which should do nothing more and nothing less than what the documentation already decided.

Documentation reduces uncertainty. Code implements decisions that have already been made. When you skip the first write and jump straight to code, you're making architectural decisions on the fly, buried inside implementation details, with nobody — including future-you — able to easily find or question them later.

The Specification Pyramid

SDD organizes a project into layers, each one more concrete than the layer above it. Every layer should be able to justify itself by pointing up to the layer above — and nothing should skip a layer.

Vision                  →  Why does this exist?
    ↓
Product Specification   →  What are we building?
    ↓
Architecture             →  How does it work, technically?
    ↓
Database / API           →  What's the exact structure?
    ↓
Roadmap                  →  In what order do we build it?
    ↓
Tasks                    →  What's the actionable to-do list?
    ↓
Active Work               →  What am I doing right now, today?
    ↓
Current Context            →  What does the AI need to remember between sessions?
    ↓
Code

Notice that Code is at the very bottom. It's the last thing that happens, not the first. If a piece of code can't be traced back up this chain to a reason it exists, that's a sign something got built that was never actually decided on.

The 12 Essential Files

In practice, this pyramid becomes a folder of Markdown files sitting right next to your code. Here's what each one is for, in plain language:

The Foundation

  • VISION.md — The why. The big picture: the problem, the solution, the goals, and how you'll know it worked (success metrics).
  • SPEC.md — What the product actually is and does: features, user stories, acceptance criteria, and just as important, what's explicitly out of scope.
  • ARCHITECTURE.md — The high-level technical blueprint: system overview, tech stack, components, how data flows, what integrates with what.
  • DATABASE.md — The data models and how they relate: entities, relationships, schema, indexes, constraints.

Contracts & Safety

  • API.md — The contracts between parts of the system: authentication, endpoints, request/response shapes, status codes, rate limits.
  • SECURITY.md — The rules that keep the system safe: authentication, authorization, data protection, audit logging.
  • UI_UX.md — The interface guide: user flows, wireframes, the design system, components, branding.

Planning

  • ROADMAP.md — The plan: phases, milestones, priorities, timeline. What gets built, and roughly when.
  • TASKS.md — The roadmap broken into bite-sized, actionable work: backlog, current tasks, completed, blocked.

Delivery & Memory

  • TESTING.md — The quality strategy: test types, test cases, coverage goals, how bugs get triaged.
  • DEPLOYMENT.md — How the thing actually ships and runs: environments, CI/CD pipeline, deployment steps, rollback plan, monitoring.
  • README.md — The human-friendly front door: what it is, how to run it, how to contribute, where to find things.

Two more documents don't appear on the infographic but earn their place in day-to-day AI-assisted work: ACTIVE_WORK.md (what's happening right now, today) and CURRENT_CONTEXT.md (the AI's memory between sessions — current phase, recent decisions, open questions). Together with an AI_START.md that tells any AI assistant what order to read things in, these are what make SDD actually usable session after session, not just a one-time document dump.

A Typical Project Folder

my-project/
├── docs/
│   ├── 01-VISION.md
│   ├── 02-SPEC.md
│   ├── 03-ARCHITECTURE.md
│   ├── 04-DATABASE.md
│   ├── 05-API.md
│   ├── 06-SECURITY.md
│   ├── 07-UI_UX.md
│   ├── 08-ROADMAP.md
│   ├── 09-TASKS.md
│   ├── 10-TESTING.md
│   ├── 11-DEPLOYMENT.md
│   └── README.md
├── src/
├── tests/
├── .env.example
└── .gitignore

The Daily Workflow

SDD isn't a one-time setup you do and forget — it's a daily habit, and it's simple:

  • Morning: Read AI_START.md, then ACTIVE_WORK.md, then CURRENT_CONTEXT.md. Three short files, and you (or the AI) are instantly caught up on exactly where things stand.
  • During the day: Work naturally. Build, iterate, ask questions — the documentation isn't a cage, it's a map.
  • End of day: Update the docs, tasks, roadmap, and a short session log entry. Future-you (and every future AI session) inherits an accurate picture instead of a guess.

Handling Bugs Without Losing the Plan

Bugs are inevitable, and the temptation is always to just fix them and move on. SDD has a small ritual for this that keeps a bug fix from silently rewriting your roadmap:

  1. Pause the current task.
  2. Create a temporary bug task — write down what's broken.
  3. Fix the issue.
  4. Resume the original roadmap task exactly where you left off.

The roadmap stays stable and trustworthy; only ACTIVE_WORK.md flexes to absorb the interruption. Nobody has to wonder later why the roadmap has a weird detour baked into it.

Using This With an AI Coding Assistant

This is where SDD earns its keep. Instead of re-explaining your entire project every session, you point the AI at the documentation and let it read:

"Follow all docs in the /docs folder as the source of truth.
Do not add features that aren't in the spec.
Work on the tasks listed in TASKS.md.
Update the docs if anything changes."

With that one instruction, sitting on top of well-written docs:

  • The AI reads the docs instead of guessing
  • The AI understands the actual context, not a summary you had to reconstruct from memory
  • The AI implements what was actually decided, not what sounds reasonable in the moment
  • You get consistent results across sessions, weeks apart, even with different AI tools

Why Bother? The Benefits

  • Consistent AI sessions — every session starts from the same shared understanding, not a fresh guess.
  • Lower token usage — you stop re-explaining the same context over and over.
  • Better onboarding — a new teammate (or a future you, six months later) can read the docs and be productive same-day.
  • Less project drift — it's much harder to quietly wander off-spec when the spec is a document everyone, including the AI, is explicitly working against.
  • A genuinely professional engineering process — the same discipline serious engineering teams have always used, now made practical for a solo builder working with AI.

The Golden Rules

  • Document first, code second. Clarity saves time — every time you skip this, you pay for it later, with interest.
  • Docs are the single source of truth. If the code and the docs disagree, that's a bug in one of them — figure out which, don't just pick whichever is more convenient.
  • Keep docs updated as the project evolves. A stale doc is worse than no doc — it actively lies to the next person (or AI) who trusts it.
  • Small docs, confusion. Good docs, velocity. Thin, vague documents don't actually save you time; they just move the confusion downstream.

The Bottom Line

Specification-Driven Development turns an AI coding assistant from a chatbot that forgets everything between conversations into a genuine long-term engineering partner. Good documentation isn't extra work bolted onto "real" engineering — it is the force multiplier. Write the blueprint. Then build the house.