Key idea
An agent fills every gap in your request with a likely guess. A brief closes the gaps that matter before it starts: what done looks like, what it must not touch, and what's out of scope. Ten minutes of writing saves an hour of unpicking.
A one-line prompt like "add a done button" works in a demo. In a real app the agent has to guess: which endpoint, who may use it, whether to add a library, whether to restyle the page while it's there. Each guess is plausible. Together they make a diff you can't review.
The four parts
- Goal. One or two sentences on what the user can do afterwards. Not how.
- Acceptance criteria. Checkable statements: a request and its response, a thing on the page, a test that passes. If you can't check it, it isn't a criterion.
- Constraints. What must stay true: no new dependencies, the same data store, who's allowed to do what.
- Non-goals. What looks related but isn't part of this job. This is what stops a small change growing into a rewrite.
A brief for the starter
The starter stores a done flag on every task, but nothing sets it. Here's a brief for that change:
## Goal
Let a user mark one of their tasks as done from the page.
## Acceptance criteria
- PATCH /api/tasks/:id with {"done": true} sets done and returns the task with 200.
- An unknown id returns 404.
- Only the task's owner (the x-user header) may change it; anyone else gets 403.
- The page shows a Done button on each of the current user's open tasks (with no x-user header the server treats you as demo), and none on anyone else's.
- npm test passes, including new tests for the rules above.
## Constraints
- No new dependencies.
- Keep the in-memory store.
- Don't change existing endpoints.
## Non-goals
- Editing titles or due dates.
- Undoing a done task.
## Before you edit
Reply with a plan: the files you'll change and why. Wait for my OK.
Paste it as your first message, or save it in the repository, for example as docs/briefs/mark-done.md, and point the agent at it. A saved brief doubles as the description when you open the pull request.
What a good brief buys you
- Review gets easier. You check the diff against the criteria, line by line, instead of against a feeling.
- Tests write themselves. Every criterion is a test waiting to happen (module 5).
- Scope stays put. When the agent suggests something outside the brief, you can say no without arguing about it.
You don't need a brief for "explain this file" or "rename this variable". You need one whenever the change touches behaviour a user or an attacker could notice.
Check yourself