An annotated example spec, and a checklist.

One real spec, followed from a requirement to its design, its task and its test. Then one page of questions to ask before an agent builds from yours.

20 minutes to read

A spec is ready for an AI coding agent when a stranger could build from the folder alone and you could tell, from a test, whether they got it right.

In practice that means seven things. Every requirement has an id and one check a test can fail. The spec says what it leaves out. The choices a person may change are named. The design records what is easy to get wrong. The tasks come in build order, each with a check. The commands and secrets the build touches are listed. And a fresh agent can start from the files without asking you anything. The checklist turns those seven into 15 yes-or-no questions.

A spec for an agent is not a product brief. An agent cannot ask what you meant, so anything the folder leaves out, it will decide for itself. The annotated example below shows where a good spec puts those decisions.

The spec we annotate

dwrtz/whiteboard, version 0.2.2, is a published spec for a hand-drawn whiteboard that runs on Cloudflare Workers. It has 28 requirements (R1 to R28), a design file of about 700 lines and a build order of 10 tasks. Most of it is not on this page. A whole spec is too long to annotate line by line, so this page follows one requirement, R24, through every file it touches. R24 is encrypted share links: a person makes a link, and only someone with the link can open the drawing.

R24 is a good one to follow for three reasons. It has a rule that is easy to get wrong (where the key lives). It makes a choice a model would not guess (links never expire). And it shows up in spec.md, design.md, tasks.md and the tests.

Every quote below is copied from the published files. A line break inside a quote is the file's own. Where this page skips lines, it shows …. The folder is public: you can open the spec, or pull it into your own agent and read the files yourself.

1. The manifest: spekkr.json

The manifest is the one file that is not prose. It is read by tools, and check_spec lists every problem in it at once. This is the published manifest, without its keywords, screenshot list and changelog.

{
  "author": {
    "id": "dwrtz",
    "name": "David Wurtz"
  },
  "customize": {
    "settings": [
      {
        "default": "Whiteboard",
        "help": "Shown as the page title and on the canvas's welcome text.",
        "key": "app_name",
        "label": "Product name"
      },
      {
        "default": "#4c6ef5",
        "help": "As #rrggbb. Primary buttons, the active tool, selection outlines and handles, focus rings.",
        "key": "accent_color",
        "label": "Accent colour"
      }
    ]
  },
  "files": [
    {
      "about": "Requirements R1–R28 with acceptance checks: drawing tools, styles, files, library, export, the browser canvas, encrypted share links, live collaboration, limits, deploy and hosted MCP collaboration.",
      "path": "spec.md"
    },
    {
      "about": "Stack, Cloudflare config and deploy, browser and R2 storage, element model and file format, restore and ordering rules, rendering, encryption, live session protocol, API, limits, unit and end-to-end tests, screens, look.",
      "path": "design.md"
    },
    {
      "about": "Build tasks in order, each with a check.",
      "path": "tasks.md"
    },
    {
      "about": "Provenance only, not needed to build: sources, how the spec was checked, and where it differs from the app it was modelled on.",
      "path": "research.md"
    }
  ],
  "id": "dwrtz/whiteboard",
  "kind": "web app",
  "lineage": {},
  "name": "Whiteboard",
  "needs": {
    "permissions": [
      "shell",
      "network"
    ]
  },
  "safety": {
    "commands": [
      "npm install",
      "npx wrangler dev",
      "npx playwright install chromium"
    ]
  },
  "spekkr": 1,
  "summary": "A local-first whiteboard with encrypted snapshots, live rooms and an optional hosted MCP collaborator on Cloudflare Workers.",
  "targets": {
    "platforms": [
      "web",
      "backend"
    ],
    "stack": [
      "TypeScript",
      "Cloudflare Workers",
      "Cloudflare R2",
      "Cloudflare Durable Objects",
      "Workers Rate Limiting",
      "Wrangler",
      "React",
      "Vite",
      "roughjs",
      "perfect-freehand",
      "Vitest",
      "Playwright",
      "Model Context Protocol"
    ]
  },
  "version": "0.2.2"
}

What each part is for:

  • id and version. dwrtz/whiteboard is who and what. 0.2.2 is the version an agent builds, and the spec's page keeps earlier versions, so an agent that built 0.2.1 can ask what changed.
  • summary. One line, at most 140 characters. This is what a person and a search result see. It says what the spec builds, in plain words.
  • targets. The platforms and the stack the spec assumes. An agent that is told the stack does not choose a different one halfway through.
  • customize.settings. Two choices a person may change without leaving the tested path: app_name and accent_color. Each has a default, so the spec builds if nobody chooses. The choices are written to spekkr.inputs.json, and the spec's text says so (see the next section).
  • files. Each file has an about line that says what it is. The order is the order the agent reads them in.
  • needs. What the build asks of the agent's machine: here, shell and network.
  • safety. The commands the build runs. An agent asks the person before it runs a command a spec file names that is not on this list. secrets would be the names of environment variables the build reads. This spec lists none.
  • lineage. Empty. It would name another Spekkr spec this one was forked from.

2. The top of spec.md

The first part of spec.md does not contain a single requirement. It says what the thing is, what to read first, what the words mean and what is not being built. Those six jobs stop a builder from guessing. Here they are, in the order they appear.

It says what it builds, and the shape it has.

A virtual whiteboard for sketching diagrams that look hand-drawn. People draw on an infinite canvas with these tools:
- rectangles, diamonds, ellipses
- arrows that stick to shapes, lines
- freehand strokes, text, images

Why: the first sentence is the plainest statement of the job. It is a description, not a pitch. The bullet list underneath is the tool list, so "what is in" is settled at the start.

It says where the build starts.

Read `spekkr.inputs.json` first. It sits at the repository root. If it is missing, create it from the `customize.settings` defaults in `spekkr.json`; with the defaults its full contents are:

```json
{ "app_name": "Whiteboard", "accent_color": "#4c6ef5" }
```

Why: this is the hand-off from the manifest to the text. A person's choices live in a file at the repository root, and the spec says what to do when the file is missing. The agent never has to ask.

It says what each file is for.

`design.md` has:

- the stack, Cloudflare config and storage layout
- the element model and file formats
- the rendering rules, sync and collaboration protocols, and API
- every screen and the look

`tasks.md` is the build order. `research.md` records where the design came from; the builder does not need it, and nothing in it is a requirement.

Why: the agent reads in order and knows what each file will give it. The last line matters most. research.md is provenance, and "nothing in it is a requirement". A spec that says which files to ignore keeps notes from turning into rules.

It fixes the words.

- **Browser canvas:** the scene kept in this browser's storage.
- **Session:** a live collaboration room. **Session link:** `<origin>/#room=<20 hex>,<22-char key>`.
- **Shareable link:** `<origin>/#json=<22-char id>,<22-char key>`.

Why: a word used two ways is a bug waiting to be built. "Shareable link" is a specific address shape here, not any link a person might share. R24 uses that shape, and the browser test checks it: "The link matches /#json=<22>,<22>."

It says what is out.

These are not built:
- frames, embeds and iframes
- the laser pointer, sticky notes
…
- accounts, sign-in, drawings stored on the server, read-only links that follow later edits, teams or shared folders (sharing is by encrypted link and live session only)

Why: this is one of the cheapest parts of a spec to write, and it saves work. An agent that is not told "accounts" are out may add them. check_spec's advice flags a spec with no "Out of scope" part. The last item also says that "sharing is by encrypted link and live session only", which settles what R24 is for.

It says how requirements are checked.

Each requirement ends with an "Accept when" line naming the tests that prove it. Test names are in "Tests" at the end.

Why: every requirement that follows ends in a check, and this line promises that. It also points to where the test names are, so the check and the test cannot drift apart.

3. One requirement, line by line: R24

This is the requirement in full. The sections after it follow the same rule into the design, the task list and the tests.

### R24. Shareable links

- **Creating:** the Share dialog has a "Shareable link" section. It says the snapshot is encrypted in this browser, only people with the link can open it, and later changes are not included.
  - "Create encrypted link" (disabled on an empty canvas):
    - Makes a fresh AES-GCM 128-bit key.
    - Compresses the scene file JSON (R19, with images) with zlib deflate, as Excalidraw does with pako before encrypting. Use the browser's built-in `CompressionStream("deflate")`; no library is needed.
    - Encrypts the compressed bytes as `IV (12 bytes) ‖ ciphertext`.
    - Uploads the bytes with `POST /api/links` (R26 limits).
    - Shows `<origin>/#json=<id>,<key>` in a textbox named "Encrypted link" and copies it ("Link copied").
  - The key is the JWK `k` value (22 base64url characters). It is only in the URL fragment, so it never reaches the server.
  - The server stores the bytes in R2 at `links/<id>`, where the id is 16 random bytes as base64url (22 characters), and returns `{ id }` with 201.
- **Opening the link at `/`:** the app fetches `GET /api/links/<id>` (the bytes, `application/octet-stream`, with the R26 headers), decrypts and inflates them (a plaintext that starts with `{` is read as uncompressed JSON), restores them (R19), and shows the drawing as "Shared drawing" with the banner "Opened from an encrypted link — not saved yet."
  - The drawing is not written to this browser's canvas until the person presses "Keep in this browser". If that canvas has elements, it first asks "Replace the drawing in this browser?". Then it opens `/`.
  - A wrong key shows "Couldn't decrypt this drawing: the key in the link is wrong."
  - An unknown id shows "This link doesn't exist or was mistyped."
  - Changing the address bar to a `#json=` or `#room=` link in an open tab reloads onto that link.
- **Lifetime: share links never expire.** This is a deliberate choice that mirrors Excalidraw: the app never deletes a link, there is no expiry date and no "turn off" button, and the spec sets no R2 lifecycle rule. Nobody can list links. Only someone with the link (id and key) can open one.
- **Size cap:** the 10 MB cap (R26) applies to the encrypted, compressed bytes. The server checks the upload size and nothing else.

Accept when: "R24 shareable links: the server stores only ciphertext; the key in the fragment opens it" and the unit tests "encryption" pass.

What each part is doing:

What the spec saysWhy it is there
**Creating:** with the steps as nested bulletsThe steps are in the order the code runs: key, compress, encrypt, upload, show. A builder follows them in order, and a reviewer can tick them off.
Makes a fresh AES-GCM 128-bit key.One algorithm and one key size, named. "Encrypt it" would leave both open.
Use the browser's built-in `CompressionStream("deflate")`; no library is needed.A choice that saves a dependency, with the reason beside it. The agent does not need to pick a compression library.
Encrypts the compressed bytes as `IV (12 bytes) ‖ ciphertext`.The exact byte layout. Two builders that follow this line write files that can open each other's links.
The key is the JWK `k` value (22 base64url characters). It is only in the URL fragment, so it never reaches the server.The rule that is easy to get wrong, with its reason. The reason, "so it never reaches the server", is the whole point of the feature. A builder who skipped the reason could put the key in a query string, where the server would see it.
where the id is 16 random bytes as base64url (22 characters), and returns `{ id }` with 201.A concrete id length and a status code. These are the numbers a test asserts.
**Opening the link at `/`:** and the messages in quotesThe exact words for a wrong key and an unknown id. A test can match them, and an agent does not invent its own.
The drawing is not written to this browser's canvas until the person presses "Keep in this browser".A negative rule: what must not happen yet. Lines like this are easy to leave out.
**Lifetime: share links never expire.** This is a deliberate choice …A decision that looks like an omission. The spec says it is deliberate, then lists what it means: no expiry date, no turn-off button, no storage lifecycle rule. Without this line a builder could reasonably add an expiry.
**Size cap:** the 10 MB cap (R26) applies to the encrypted, compressed bytes.A number, and what it is measured on. The cross-reference R26 points to the requirement that sets the limits, so the number lives in one place.
Accept when: "R24 shareable links: …" and the unit tests "encryption" pass.The check. It names a test by its exact title and a group of unit tests. This is the line a build is judged on.

4. The design: design.md

R24 says what must be true. design.md says how, for the parts where a wrong guess costs the most. It does not repeat the requirement. It adds the detail the requirement was too high-level for, and it names files and functions so the build has a shape.

The functions.

- **`generateKey()`:** AES-GCM 128, exported as a JWK, returning `k` (22 base64url characters).
- **`encrypt(k, data)`:** a random 12-byte IV, then `IV ‖ AES-GCM(ciphertext + tag)`. **`decrypt(k, payload)`** throws on a wrong key. **`decryptText`.**
- **`toB64` / `fromB64`:** standard base64 for WebSocket payloads.
- **`sealScene(k, json)`:** the share-link body, `encrypt(k, deflate(json))`. `deflate` is zlib deflate through the built-in `CompressionStream("deflate")`, the same format as Excalidraw's pako deflate. **`openScene(k, bytes)`** decrypts, then inflates with `DecompressionStream("deflate")`. A plaintext whose first byte is `{` is read as plain JSON. Live-session messages are not compressed, as in Excalidraw.
- **`sha1Hex(bytes)`:** the image file id.

Why: function names (sealScene, openScene) and the file they live in. The task list and the test names use the same words. When all four files say sealScene, an agent never wonders whether two things are one thing.

The storage layout.

R2 keys:
- `links/<id>`: a share link's bytes, `IV ‖ AES-GCM(scene file JSON)`. The id is 16 random bytes as base64url.

Why: where the bytes go, and what they are. IV ‖ AES-GCM(scene file JSON) repeats the byte layout from R24, in the place a person building the Worker will look for it.

The route.

| POST | /api/links | 10 MB, then `LINK_LIMIT` | raw encrypted (deflated) bytes → R2 `links/<id>` → 201 `{ id }`. Never expires |
| GET | /api/links/:id | — | the bytes (`application/octet-stream`, `cache-control: public, max-age=31536000, immutable`) or 404 "This link doesn't exist" |

Why: a table row a builder can turn straight into a route handler. It carries the limit, the status code and the headers, including immutable, which tells a cache the bytes will never change. That is correct only because ids are random and links never expire, so the design and the requirement have to agree.

The order of checks.

- **Order:** the existing link, room and file routes run the checks below before their rate limits. MCP and issuance count valid incoming requests before doing room or cryptographic work. `POST /api/links`: origin, body size, too short, then `LINK_LIMIT`. WebSocket: origin, room id, upgrade, then `ROOM_LIMIT`. Image PUT: origin, room id, file id, body size, already stored (200), session full, then `FILE_LIMIT`.

Why: the rule most likely to be built backwards. The rate limit runs last, so a refused request does not use up an allowance. The design says so, and tasks.md repeats it in the task text. The order of checks is easy to build backwards unless it is written down.

5. The task list: tasks.md

Work in this order, and finish each task's check before starting the next. Never log in to Cloudflare or deploy as part of these tasks.

Why this line: the rules that apply to every task are said once, at the top. "Never log in to Cloudflare or deploy as part of these tasks" is a safety rule, stated where it cannot be missed.

Task 3 builds the crypto. Task 7 builds the feature on top of it.

3. **Files and crypto (R19, R20, R24).** Write `restore.ts` (restore, parse and serialize scenes and libraries), `crypto.ts` and `limits.ts`.
7. **Shareable links (R24, R26).**
   - `POST /api/links` and `GET /api/links/:id` on R2 with the Origin check, id formats, the 10 MB limit, `LINK_LIMIT` (checked last, so refused requests don't count) and the blob headers. Links never expire.
   - `sealScene` / `openScene`: deflate with `CompressionStream` before encrypting.
   - The Share dialog's "Shareable link" section.
   - Opening `#json=` links with the banner and "Keep in this browser".
   Check: the 4-share e2e tests and `6-rate-limits.spec.ts` pass.

What the tasks do that the requirement does not:

  • They cite requirement ids. (R19, R20, R24) and (R24, R26) say which requirements the task is for. A reviewer can find every task that touches R24, and an agent knows which sections to reread.
  • They are in build order. The crypto comes before the routes, and the routes before the Share dialog. Each step has something to stand on.
  • They list the parts. Task 7 names the routes, sealScene and openScene, the dialog section and the #json= banner. Nothing in the list is left for the agent to remember.
  • They repeat the rule that is easy to forget. "LINK_LIMIT (checked last, so refused requests don't count)" is in the task as well as the design. The design is the reference. The task is where the work happens.
  • They end with a check an agent can run. "Check: the 4-share e2e tests and 6-rate-limits.spec.ts pass." The agent does not move on until that is true.

6. The tests, named

spec.md ends with a list of test names. design.md says what each one covers. This is the part that closes the loop.

From the "Tests" section of spec.md:

- `4-share.spec.ts`:
  - "R24 shareable links: the server stores only ciphertext; the key in the fragment opens it"
  - "R26 limits: oversized links, cross-site requests and bad ids are refused"

From design.md, what the "encryption" unit tests cover:

- **"encryption"**
  - A round trip with the right key works; a wrong key throws.
  - `sealScene` deflates before encrypting (a repetitive 200-element scene seals to under a quarter of its JSON size, and the decrypted bytes don't start with `{`); `openScene` opens it, and also opens an uncompressed body.
  - SHA-1 hex of known bytes; base64 helpers.

And the browser test for R24, from design.md:

- **4-share.spec.ts:**
  - R24:
    - Draw a rectangle, then Share → "Create encrypted link". The link matches `/#json=<22>,<22>`.
    - `GET /api/links/<id>` is `application/octet-stream` with `nosniff`, and its bytes don't contain "rectangle".
    - A second browser context opens the link and sees the banner and the rectangle. "Keep in this browser" moves to `/` with the rectangle kept.
    - A wrong key and an unknown id show their messages.

Why: this is where "Accept when" stops being a sentence and becomes a test. The title in the requirement, the title in the test list and the title in the test file are the same words. A test is a written promise, and an agent can run it.

One requirement, five places

Here is R24 end to end. Every row uses the same words.

FileWhat it holds for R24
spekkr.jsonNo entry for R24. It sets the stack, the choices and the commands the build may run.
spec.mdThe rule, the messages, the lifetime and the size cap, and the "Accept when" line.
design.mdsealScene and openScene, the storage keys, the route table, and the order of checks.
tasks.mdTask 3 builds the crypto. Task 7 builds the routes and the dialog. Each ends with a check.
The testsThe "encryption" unit tests and the browser test titled "R24 shareable links…".

If a builder reads one file and misses another, the rest still point to it by name: R24, sealScene, LINK_LIMIT, "Keep in this browser". That is what makes a spec hard to build wrong.

The readiness checklist

Use this before you hand a spec to an agent. Each item is a yes or no. A "no" is a missing line. The note at the end of each item says whether check_spec will tell you. It reads the manifest and, when you send it the text files, it adds advice on five things. Advice never blocks a publish.

Download the checklist as Markdown, with a box on each line.

The manifest

  1. 1. The name and summary say what it builds. One line each, and the summary is at most 140 characters. (check_spec refuses a manifest without them.)
  2. 2. Every file the manifest lists exists, and each has an about line. (publish_spec checks that the files are there. Whether the about is useful is yours to judge.)
  3. 3. Each choice a person may change is in customize, with a default. And a file says where each one applies, with the key in backticks. (check_spec advice: it names a choice no file mentions.)
  4. 4. Every command the build runs, and every secret it reads, is under safety. Names of secrets, never values. (Not checked. Read your tasks and design for any npm, curl or environment variable that is not listed.)

The requirements

  1. 5. Every requirement has an id, and no id is used twice. (check_spec advice, both ways.)
  2. 6. Every requirement ends with one "Accept when" line. (check_spec advice.)
  3. 7. Each check names something a test can fail: a value, a count, a status code, a message. "Works well" and "is fast" are not checks. (Not checked. Read each "Accept when" and ask what the test would assert.)
  4. 8. The spec has an "Out of scope" part. (check_spec advice.)
  5. 9. Words with a specific meaning are defined once, and the rest of the spec uses them the same way. (Not checked.)
  6. 10. The numbers are written down: limits, sizes, lifetimes, retry counts, and the exact words of messages a person will see. (Not checked.)
  7. 11. The hard cases are stated: duplicates, empty input, a wrong key, an expired link, abuse, and the thing that must not happen yet. (Not checked. The R24 lines about a wrong key and "not written until" are the model.)

The design and tasks

  1. 12. The design covers what is easy to get wrong, not a second copy of the requirements: the stack and versions, where data is stored, the API, the order of checks. (Not checked.)
  2. 13. Names are the same in every file. A function, a route, a limit and a setting each has one name. (Not checked.)
  3. 14. The tasks are in build order, cite requirement ids, and each ends with a check the agent can run. (Not checked.)

The hand-off

  1. 15. A fresh agent can build from the folder alone. Pull the spec into an empty folder, start an agent, and write down every question it asks you. Each question is a line the spec is missing. (Not checked, and the best test there is.)

How to score it. Fifteen yes answers is a spec you can hand over. Items 5, 6, 8 and 3 are the ones check_spec finds for you, so run it first. Items 7, 10 and 11 ask for decisions the author may not have made yet. Writing them down is the work, and it is the part a short prompt skips.

How check_spec fits

check_spec is a tool on Spekkr's MCP server. Give it the text of spekkr.json and it reports every problem in the manifest at once, and nothing is saved. Give it the text files as well and it adds advice, from five rules: a file with requirements that have no ids, an id used twice in one file, a requirement with no "Accept when" line, a spec with no "Out of scope" part, and a choice no file mentions. The advice stops nothing. It reads text only, runs nothing and checks no code.

The checklist is wider than the tool on purpose. The tool can tell that a requirement has no check. It cannot tell whether the check is any good.

FAQ

What makes a spec ready for an AI coding agent?

An agent cannot ask what you meant, so a ready spec answers the questions it would ask. Each requirement has an id and one check a test can fail. The spec says what is out of scope. The design records the parts that are easy to get wrong. The tasks are in order, each with a check. The commands and secrets the build uses are listed.

How long should a spec be?

As long as the decisions need. The example here has 28 requirements and a long design file, because it is a whole app with live collaboration. A spec for one small feature can be a page. Length is not the test. Whether a fresh agent can build from it is.

Do I need to publish a spec to use the checklist?

No. The checklist works on any folder of Markdown files. check_spec needs a Spekkr connection, and nothing is published when you run it.

Is the checklist only for Spekkr specs?

No. Items 5 to 15 apply to any spec an agent will build from, including a Spec Kit feature or a Kiro spec. The portability reference shows how a Spekkr spec lands in those folders.

Why does the example quote so much?

So you can check it. Every quote is copied from the published files, and the spec's page is public.

Questions or corrections: support@spekkr.com.