The Spec Guide

How we build with specs and an AI coding agent

This is how we work on SpecPilot itself. The specs come first, in .specs/, before any code. We pick up tasks from the board alongside our agent, review everything it finishes and keep the specs in step with the code as it changes. Take what helps. Every prompt has a Copy button.

Specs first#

An AI coding agent, like Claude Code or Cursor, is fast, and it never says "I'm not sure". Give it a vague task and it fills the gaps with guesses, and every guess looks reasonable on its own. So the specs come first, before any code: in the repo, where the agent reads them at the start of every session and updates them as things change.

The specs live in the repo

Everything we know about the project sits in .specs/: what it must do in requirements.md, how it is built and why in architecture.md, what is next in tasks.md, and the calls we made along the way in context.md. It goes into git with the code, so a new session, a different agent altogether (Claude today, Codex or Cursor tomorrow) or a new teammate works from the same specs, the ones that matter for the task. Nothing we know is locked inside an AI tool's memory, and nobody spends tokens having an agent work the project out again.

We don't write the specs by hand. A guided setup asks us what we're building: in the terminal, in the web app, or through our own agent. For a brand new project there's no code yet, so it asks about the idea, and we answer the questions ourselves or let our agent answer them for us. For an existing one, our agent reads the code first, answers what it can and asks us only what is left. After that, keeping the specs current is part of the agent's job, not a chore we come back to.

Size the change first

Not every change deserves a meeting. Before our agent codes, it decides how big the change is, and that decides how much planning comes first:

  • Trivial (a typo, a style tweak, a config value): no planning step. It makes the change we asked for and notes it in tasks.md.
  • Feature (a new page, a new behaviour): it reads the one or two specs that matter, updates requirements.md and tasks.md, then codes.
  • Architectural (a new system, a new dependency, a change in how parts talk to each other): it updates every spec it touches and the changelog, shows us a Spec Report and waits.

When we built this Guide page, that was a feature: one new requirement, REQ-035, then the code. When we moved our docs into their own repo, that was architectural: a new decision record, eight spec files updated and a Spec Report before a single file moved. If it's not clear which it is, we call it a feature.

Nothing big starts without a yes

A Spec Report lists what kind of change it is, which files changed, what changed in each and what the specs now say. The agent writes no code until we reply with the exact words yes, proceed. If we say no, it puts the specs back the way they were and stops.

It takes us a minute to read. It has saved us whole afternoons of undoing code built on the wrong idea.

In the docs: The .specs folder ↗ · Review and Spec Reports ↗ · Set up specs with your agent ↗

Prompts we use

When we're not sure it has understood the task:

Tell me in three lines what you understood before you change anything.

Before any change we're unsure about:

Before you write code: is this change trivial, a feature or architectural? Name the spec files it touches and what you would change in each. Don't edit anything yet.

When it's big, we say so and let the rules do the rest (/specpilot-report runs the same check on demand):

This is architectural, not a feature.

The board#

Our tasks live in one file, .specs/planning/tasks.md, and the SpecPilot App shows that file as a board. There's no database and no sync: drag a card and one line moves in the file, and when our agent changes the file, the board updates by itself. Every move is a one-line change in that file, so once we commit, git has the record of what moved and when.

Four lanes, one gate

  • Backlog holds everything we might do. Ideas go here first, even half-formed ones.
  • Current Sprint is what we're doing now.
  • Review is finished work waiting for us.
  • Completed is work we approved, each row with its commit.

Cards move between Backlog and Current Sprint freely, and from Current Sprint to Review when the work is done. A card gets to Completed one way only: we approve it in Review, then tell our agent to wrap up, and it commits the work and writes the Completed row with that commit. There's no dragging a card there, for us or for the agent.

Backlog

Everything we might do

drag either way

Current Sprint

What we're doing now

done, by us or the agent

Review

Finished, waiting for us

only when we approve

Completed

Approved, with its commit

Review back to the top of Current Sprint: Send back… with a note on what to change

A card reaches Completed one way: we approve it in Review, and our agent records it with its commit.

How we plan a sprint

We keep the Backlog honest rather than tidy. Each card gets a type (feat, bug or chore) and a priority (P1, P2 or P3), and a short description of the task, two or three lines. If a card needs more than a few lines to describe, it's probably two cards.

Planning is dragging. We pull the few cards that matter most into Current Sprint. That's the whole meeting. What comes next isn't decided by a card's position: the highest priority goes first (P1 before P2), and among those, the order the features have to be built in. When we name a card that's still in Backlog, our agent moves it into Current Sprint itself.

We both work the board

The board isn't the agent's to-do list. Whoever is free takes the next card in Current Sprint, by that same rule: our agent through the local MCP connection, or one of us in the App. Both move cards the same way, and both end up in the same file.

If we and the agent move cards at the same moment, nothing gets overwritten. Every change from the App or the agent carries the version of the file it was made on, and a change made on an old version is turned away, so whoever was second just tries again on the fresh board. The one gap is editing tasks.md by hand: a save from a text editor at the very instant the App writes can be lost, so we make board changes on the board.

Review is the human in the loop

Finished work stops in Review, whoever did it, and we decide: yes or no. When our agent finishes a task, it moves it to Review and stops, and a task one of us did goes there too, for a second look. We open the card and choose:

  • Approve. The card is marked Approved with the date. Then we tell our agent to wrap up, and it records the task in Completed with its commit.
  • Send back… We say what needs to change in a short note, and the card goes back to the top of Current Sprint with it. A sent-back card goes first, ahead of everything else, so the fix is the very next thing our agent picks up.

Our agent finishes a task

Moves the card to Review and stops. Nothing committed.

We open the card

And read what it changed, what it checked and what it couldn't.

Approve

The card says "Approved" with the date

We tell our agent to wrap up

It commits only this task's files and records it in Completed with the commit

Send back…

We note what needs to change

The card goes to the top of Current Sprint

It's the next thing our agent picks up

Every task stops here once. The commit comes after our yes, not before.

We send things back without guilt. A note like "the button is right but the copy isn't, use the words from the Draft" costs us ten seconds and saves a round of guessing.

In the docs: Tasks and lanes ↗ · The board ↗ · tasks.md ↗

Prompts we use

To start work, we name the card. Our agent moves it into Current Sprint if it isn't there, does the work and stops in Review:

Do BL-###

When we want our agent to choose the next card. The order is never open: priority first, then the order the features have to be built in:

Pick the next task in Current Sprint by priority, then by the order the features have to be built in. Tell me which and why, then do it.

To turn a list of ideas into cards:

Add each of these to Backlog as its own task, each with a short description, a type and a priority:

After we approve something:

I approved it. Commit only the files for this task, then record it in Completed with the commit.

Working with agents#

Our agent is the fastest teammate we've had, and it forgets everything between sessions. Switch from Claude to Codex or Cursor and it's worse: the new agent has never seen the project at all. A new teammate brings the same problem, because their agent starts from zero too, and without the specs it burns tokens reading the whole codebase just to catch up. So we don't rely on any agent's memory, or ours. The specs, the board and the instruction files carry everything it needs, so a new session, a different agent or a new teammate picks up exactly where the last one stopped.

One connection, one set of rules

npx specpilot serve prints the line Claude Code needs for .mcp.json, and Connect your AI IDE in the App gives the config for Cursor, VS Code (for Copilot), Windsurf, Antigravity and Codex. Once it's connected, our agent reads the specs and lists, adds and moves tasks on the same board we use.

SpecPilot also writes an instruction file our agent reads at the start of every session (CLAUDE.md for Claude Code, a rules or instructions file for each of the others). It holds the house rules ↗: no commit, push or deploy unless we ask, read a file before quoting it, change no file we didn't ask it to, keep the specs current, write only what's needed (reuse first, no new dependencies), make the shortest correct change (fix the cause, not the symptom), and the spec check before code. Under those we add our own. When we switch agents, the specs come with us. The new one needs only its own instruction file and its own connection.

Our rule of thumb: if we've explained something to the agent twice, it belongs in the specs or the instruction file, not the chat.

One task at a time

We hand over a card, not a conversation. The card's short description plus the specs it points to is the whole brief. If the card isn't enough for the agent to start, the card is wrong, and we fix the card.

One card, one change, one review. When we let a session drift into a second task "while it's there", the review gets harder and the commit gets muddy, so we stop and make it a new card instead.

What we expect back

When the agent says it's done, we expect three things:

  • The card in Review, not Completed, and nothing committed.
  • The specs updated in the same change, so the next session starts from the truth.
  • A short account: what it changed, what it checked and what it couldn't check. "Done" with no evidence isn't done yet.

That last one matters most. An agent that says "I couldn't test this on a phone" is far more useful than one that says nothing and hopes.

When it loses the thread

Long sessions drift. The agent starts repeating itself, forgets a rule it followed an hour ago or contradicts a spec. When that happens we don't argue with it. We run /specpilot-reanchor, which has it reread the project from .specs/, or we simply start a fresh session. Because everything lives in the specs, a fresh session, even with a different agent, costs us a minute, not an afternoon.

In the docs: Connect your AI IDE ↗ · Local MCP overview ↗ · Slash commands ↗

Prompts we use

Before it starts:

Before you start, tell me which spec files you read and what you plan to change. Then do it.

When it's done:

Tell me what you changed, what you checked and what you couldn't check. Then move the task to Review.

When we've said something twice:

Add this as a project rule to every instruction file SpecPilot set up for this project, so I don't have to say it again:

When it drifts:

/specpilot-reanchor
Now tell me where your last change disagrees with the specs.

Combating drift#

Specs only help while they're true. The moment the code says one thing and the specs say another, our agent has two sources of truth, and it will pick the wrong one at the worst time. We call that drift, and we treat it like a bug.

Where drift comes from

It's rarely dramatic. A quick fix nobody wrote down. A renamed file. A version bump. Most often, a fact typed by hand into a second place and then forgotten there.

We've had all of these on this very site. Checking our install page against the CLI's source, we found the homepage still asking for Node.js 16 when SpecPilot had long moved on to 22, and still promising the App "opens in your browser" when it only does that if you ask. Our own docs said Approve moves a task to Completed. It doesn't: it marks the task approved, and the agent records it. And when we wrote this page, the CLI's README said nine MCP tools while the source had ten.

None of it was anyone's mistake on the day it was written. It was true, and then it wasn't.

The cheapest fix is not to drift

Most of our defence is habit, not tooling:

  • Specs change in the same change as the code. Our agent's instruction file says so, and we don't approve a task whose specs are behind.
  • We check facts against the source, not memory. Not the agent's memory and not ours. When a page states a version, a flag or a count, someone has opened the file it comes from.
  • When we copy a fact, we write down where it came from. Our page drafts note the source file for every product fact, so the next check knows where to look.

Checks we run

  • specpilot validate, or /specpilot-validate in the AI IDE, checks that .specs/ is complete and its cross-references resolve. With --fix, the CLI fixes the common issues itself.
  • /specpilot-sync has our agent read the architecture, requirements and tests, compare them with the actual code and package.json, and list every mismatch with a proposed fix. It changes nothing until we say yes.

We run sync before a release, after any big refactor, and whenever the agent seems confused about something the specs should have settled.

When they disagree, decide

A mismatch is a question, not an answer. Sometimes the code is right and the spec is stale, so we update the spec. Sometimes the spec is right and the code wandered off, so it becomes a card on the board. Either way, we decide on purpose and write the reason in context.md, so nobody has the same argument twice.

Keep the files short

Stale lines hide in long files. When Completed or the prompt log gets long, we archive the old rows with /specpilot-archive. For Completed, Archive in the App does the same. The history stays in the repo; the files our agent reads every session stay lean.

Rows aren't the only thing that piles up. context.md and requirements.md are read on most tasks, and they only grow. For those we use /specpilot-compact. Our agent picks the context.md entries that no longer bind the work and rewrites the largest requirements to what the project does now, and SpecPilot moves every original, unchanged, into an archive file beside it (context-archive.md, requirements-archive.md). Security decisions and anything about a task that's still open stay where they are.

In the docs: specpilot validate ↗ · Slash commands ↗ · context.md ↗

Prompts we use

To check a page or a spec:

Check every product fact here against the source code, not your memory. For each one, show the file you checked and whether it still matches.

When code and spec disagree:

The code and the spec disagree about this. Tell me which one is right and why, then propose the change to the other one. Don't edit anything yet.

At the end of a task:

Before you move this to Review, list any spec this change has made out of date, and update it.

Prompt library#

These are the prompts we reach for most. None of them is magic. Each is a starting point: paste it, then add the task or the detail it needs. The ones from earlier sections are here too, so you don't have to scroll back for them.

In the docs: Slash commands ↗ · Set up specs with your agent ↗

From Specs first

When we're not sure it has understood the task:

Tell me in three lines what you understood before you change anything.

Before any change we're unsure about:

Before you write code: is this change trivial, a feature or architectural? Name the spec files it touches and what you would change in each. Don't edit anything yet.

When it's big, we say so and let the rules do the rest (/specpilot-report runs the same check on demand):

This is architectural, not a feature.

From The board

To start work, we name the card. Our agent moves it into Current Sprint if it isn't there, does the work and stops in Review:

Do BL-###

When we want our agent to choose the next card. The order is never open: priority first, then the order the features have to be built in:

Pick the next task in Current Sprint by priority, then by the order the features have to be built in. Tell me which and why, then do it.

To turn a list of ideas into cards:

Add each of these to Backlog as its own task, each with a short description, a type and a priority:

After we approve something:

I approved it. Commit only the files for this task, then record it in Completed with the commit.

From Working with agents

Before it starts:

Before you start, tell me which spec files you read and what you plan to change. Then do it.

When it's done:

Tell me what you changed, what you checked and what you couldn't check. Then move the task to Review.

When we've said something twice:

Add this as a project rule to every instruction file SpecPilot set up for this project, so I don't have to say it again:

When it drifts:

/specpilot-reanchor
Now tell me where your last change disagrees with the specs.

From Combating drift

To check a page or a spec:

Check every product fact here against the source code, not your memory. For each one, show the file you checked and whether it still matches.

When code and spec disagree:

The code and the spec disagree about this. Tell me which one is right and why, then propose the change to the other one. Don't edit anything yet.

At the end of a task:

Before you move this to Review, list any spec this change has made out of date, and update it.

Setting up

For a project that has no specs yet, we open its folder in the SpecPilot App first: the setup tools only work on a folder the App is setting up, and Tell it what to do has the prompt ready to copy. In our own words, it's this:

Set up SpecPilot for this project. Read the code first and answer every setup question you can from it. Ask me only what's left, all in one go, then write the specs.

For a brand new project with no code yet, we choose Start a New Project in the App, name it and say where it goes. Our agent creates the folder and writes the specs from our answers:

Start a SpecPilot project called <name> in <folder>. There's no code to read yet, so ask me the setup questions, all in one go, then create the project and write the specs.

Planning

When the Backlog has grown:

Read requirements.md and the Backlog in tasks.md. Suggest the tasks that should go into Current Sprint next, in order, with one line on why for each. Don't move anything.

For a new requirement, we use the command SpecPilot already gave our AI IDE. It shows the change before writing it:

/specpilot-refine <the requirement in a sentence or two>

Reviewing

When a task lands in Review:

Walk me through this change as if I'm reviewing it: which files changed, why, and what I should check by hand before I approve it.

Ending a session

Before we close the chat:

We're stopping here. Make sure the specs and tasks.md say everything the next session needs, then tell me what's left.

Coming next: Planning · Keeping specs honest · Verification · Brownfield projects

Want the reference instead? Read the docs ↗