- Write a work order an agent can execute without guessing
- Tie every task to the exact command that proves it
- Delimit which files the agent may touch
- Close the loop with evidence, not with a promise
The work order
A chat saying “fix the bug” produces a plausible answer. A work order produces a reviewable change. The difference is that the order separates what is asked from how it will be checked.
The format I use has three blocks: numbered specs, tasks with their route, and a decision log. Specs quote the request verbatim; tasks link to the spec they cover.
# fix-checkout — the coupon is not applied on the second attempt
## Specs
S1. A valid coupon discounts the total once, even if the user submits
the form twice in a row.
S2. An invalid coupon shows "Invalid coupon" and leaves the total untouched.
## Tasks
| ID | Specs | Route | Status |
|----|-------|--------|---------|
| T1 | S1 | inline | pending |
| T2 | S2 | inline | pending |
## Log
L1 (request): "if I hit apply twice, it discounts twice".One task, one proof
If you cannot name the command that proves a task is done, the task is not defined. The agent will complete it anyway, with an opinion instead of a fact.
A TypeScript repo needs two commands: the type check and the suite. This site adds the build and a browser suite.
{
"scripts": {
"test": "vitest run",
"lint": "eslint .",
"build": "next build",
"test:e2e": "playwright test"
}
}
# The task is done when this is green:
npm test && npm run lint && npm run build && npm run test:e2eThe allowed surface
An agent with access to the whole repo will “improve” files nobody asked about. The edit surface is an explicit list of paths or globs, and the agent must refuse to write outside it.
It is not bureaucracy: it is what makes the diff reviewable in two minutes.
## Allowed edit surfaces
src/lib/coupon.ts
src/lib/coupon.test.ts
src/components/checkout/coupon-field.tsx
## Not allowed
- package.json
- src/app/**
- any file outside the paths aboveThe full loop
The agent does not start by writing: it starts by reproducing. If it cannot reproduce the failure, it does not understand the problem. Then it changes, verifies, and reports with evidence.
The close is not “done, it works”. The close is the diff and the command output.
# 1. reproduce
npm test -- coupon
# fails: expected 100, received 0
# 2. change (only inside the surface)
# 3. verify
npm test -- coupon && npm run lint
# 4. leave evidence
git diff --stat
git diff src/lib/coupon.tsLayout-level composition. Owns the document structure and orchestrates which features render.
Write the order before the code
Pick a real bug in your repo and write the task file: two specs quoting the request, one task table, and the exact command that proves each one. Do not write code yet.
Show a hint
If the spec cannot become an assertion, it is describing an intention rather than a behaviour.