Writing a spec
A spec is one markdown file. The planner reads it, and the same spec always gives the same plan. Write naturally, but name things the way the code does.
The format
Section titled “The format”| Part | What it does |
|---|---|
| Front matter (optional) | spec: sets the spec id and title: the title. Without them the id comes from the file name (minus SPEC-), then the title. |
# Title |
The title. Text before the first ## is the intro and goes into every agent’s brief as context. |
One ## section per feature |
Each becomes one work package, in order. A Feature: prefix is allowed and dropped. |
| Context sections | ## Overview, Background, Context, Goals, Non-goals, Constraints, Assumptions, Glossary, Notes, Out of scope and Open questions are context, not packages. Out of scope and background go into every brief. |
| Open questions | Each list item becomes a question on the plan. Put (blocking) in an item and it must be answered before you can approve. |
| Acceptance list | In each feature, under ### Acceptance, Acceptance criteria or Done when, or a bold **Acceptance:** label, followed by a list. |
Depends on: |
A line naming a feature title or a package id. |
Touches: |
A line of paths, path#Symbol and kind:identifier hints that prose can’t carry. |
An acceptance item can end with Check: <how> or (test: <name>) to say how it’s checked. Without an acceptance list, the planner uses the section’s “must” and “should” sentences.
Name things the way the code does
Section titled “Name things the way the code does”The planner maps your words to real files and symbols. Help it by being exact, ideally in backticks:
- Routes as
POST /matches/:id/dispute - Files as
demo/api/src/lib/validation.ts - Functions as
applyResult - Tables as “a
disputestable”, and columns as “addseason_idtomatches” - Bindings as
AVATARS - Say “new” when something doesn’t exist yet
- Say “shared module” when other packages will import a file
An example
Section titled “An example”---title: Season 2---
# Season 2
The ladder runs seasons, and disputed results don't count.
## Seasons and divisions
Add seasons and divisions to the ladder. `GET /ladder` takes `?season=`. Add a new`POST /seasons` route and a migration for the `seasons` and `divisions` tables.
### Acceptance
- `POST /seasons` creates a season and returns 201.- `GET /ladder?season=` returns only that season's results. Check: Vitest: ladder.seasons.test.ts
## Match disputes
A player can dispute a result. A disputed result doesn't count towards the ladder.Add a new `isDisputed` helper in `demo/api/src/lib/validation.ts`, shared with other packages.
Depends on: Seasons and divisions
### Acceptance
- `POST /matches/:id/dispute` returns 201 and stores the dispute.- Disputed results don't count towards the ladder.
## Open questions
- What's the maximum avatar size? (blocking)Write criteria a verifier can check
Section titled “Write criteria a verifier can check”A criterion that can’t be checked ends up in the plan’s questions rather than the plan. “Intuitive” and “fast” are the usual suspects. Prefer:
- Observable behaviour: “returns 201 and stores the dispute”.
- A named test:
Check: Vitest: ladder.disputes.test.ts. - A command: “
pnpm --filter api typecheckpasses”. - A file or a schema: “a
disputestable exists after migrations”.
See Verdicts for how each kind of check is decided.
Keep features independent where you can
Section titled “Keep features independent where you can”Packages that touch the same files will overlap, and the agents will have to negotiate. That’s fine, and sometimes unavoidable. But if two features can be built in separate files, the run is faster. Say which one depends on which with Depends on: so the plan sequences them rather than leaving it to a negotiation.