O que spec-check faz?
The way this skill expects you to work: plan with Claude in a claude.ai artifact (decisions, constraints, design), tell the implementer "use that as the plan, go build", then run this skill to check the result. This skill does the checking. It never trusts the implementer's own account of its work.
Files next to this one:
reviewer-brief.mdis the brief for the fresh reviewer. Fill it in and pass it unchanged.verifier-brief.mdis the brief for the agent that tries to disprove each finding.spec-template.mdis the spec format. Use it whenever you help write a spec artifact.
Rules
- Independence. The reviewer and the verifier are new agents (Agent tool,
subagent_type: general-purpose, neverfork). Their briefs hold only what the brief files list. Never pass the implementer's chat, its summaries, the PR description, commit messages or your own opinion of the code. If this session is the implementer's, say so to the user once and keep going. The fresh agents are what make the check independent. - The spec decides. Specs are short: a one-line goal, a drawn mock of the
design, and medium-level bullets for what it must deliver, with no logic, code or endpoints
(see
spec-template.md). A finding quotes the spec line it breaks. A finding that breaks no spec line goes under EXTRA or RISK. - Only the user changes the spec. The implementer can fix code or propose that the spec change. It can't accept drift. Only the user can, by saying "accept DR-n".
- Reviewers don't edit anything. They don't write code, publish or send messages. This session writes the Drift tab and sends the messages after the verify step.
Steps
1. Inputs
- Spec URL. Take it from the user's message. If there isn't one, use the URL saved for
this repo in
$(git rev-parse --git-dir)/spec-check.json. If neither exists, ask for it. Save it to that file once you have it. The file sits inside .git, so it is never committed. - Range. By default this is
git merge-base HEAD origin/maintoHEAD. Use a PR number or base ref if the user gives one (gh pr view N --json baseRefName,headRefOid). If the working tree has uncommitted changes, tell the user that the check only covers committed work. - Earlier drift log. Read the spec with the Artifact tool (
action: read). If it is a Claude Doc, load theanthropic-skills:docsskill and read the doc and its tabs with the docs tools. Copy the existing Drift tab's entries, if there is a tab.
2. Review (one fresh agent)
Fill in reviewer-brief.md and start one general-purpose agent with it (model opus).
For a second opinion from a different model, run Codex as well, at the same time. Do this when
the user asks, or when the diff touches auth, payments, keys or user data:
codex exec -s read-only -C <repo> -o <scratch>/codex-review.md "<the same filled brief>".
Codex can't read claude.ai artifacts. Save the spec text to <scratch>/spec.md and change the
brief's first step to read that file. Codex can't run the tests in its
read-only sandbox, so tell it to skip step 4 and only read the tests. The Claude
reviewer runs them.
3. Verify (one fresh agent)
Gather every DRIFT, MISSING, EXTRA and RISK finding from the reviewers. Number them in the
order found, and when both reviewers report the same thing, count it once. Fill in
verifier-brief.md with that list and start one general-purpose agent. It tries to disprove
each finding against the code. Drop any it disproves and keep a note of what you dropped.
A finding both reviewers report is still verified.
4. Drift tab
Merge the verified findings into the drift log. Keep every old entry and its ID. If an old open
entry is now MET, change its status to fixed and add the commit. Give new entries the next free
DR-n. Never reuse or renumber an ID.
Each entry has:
DR-n · spec line (short quote) · type · severity · evidence (file:line, what the code does) · fix wanted · status · found (date, short SHA) · last update
The status is one of: open, sent (the implementer has it), fixed (commit), accepted
(the user changed the spec, so say what changed), wontfix (the user's reason).
At the top of the tab, put a short summary: the date, the range checked, how many spec items were met out of the total, open entries by severity, and any UNCLEAR spec items for the user to tighten.
Where the tab goes:
- Claude Doc: a tab named
Drift. Make it the first time, then replace its contents on each run. Use the docs tools;guide(["topic.tabs"])explains tabs. - HTML page: edit the saved file the Artifact read names. If the page has tabs, add a
Drifttab built the same way as its others. If it doesn't, add aDriftsection at the end. Keep everything you add between<!-- spec-check:drift -->and<!-- /spec-check:drift -->, change nothing outside those markers, and republish to the sameurl. Make the tab easy to read: one row per entry, the status as a colored chip, open entries first.
5. Stop and show the user
One run is one review. After the Drift tab is written, stop. Don't send anything to the
implementer, don't fix anything and don't run the check again. Open the spec for the user
(Artifact open) and write a short message: met/total, open entries by severity with their IDs
and one line each, any UNCLEAR items, and the link.
The user reads the Drift tab and decides. They can comment on a Drift row or a spec line, edit the spec, or just tell you in chat. A comment is the user's call on that entry, for example "fix", "leave it", "accept" or a new instruction.
6. Send to the implementer, only when the user says so
When the user says "send it" (or /spec-check send):
-
Read the comments on the doc:
querythe utterances under the Drift tab's body and the Spec tab's body (guide(["topic.comments"])first). For an HTML page, read its comments withArtifactComments. -
Build one message from what the user decided. Send the entries they commented on or named, each with their comment word for word, plus any spec lines they changed. Don't send entries they marked "leave it" or "accept". If they said "send all", send every
openentry. -
Find the implementer. If this session started it as a subagent, send to its agent id. A finished subagent picks the message up and carries on. Otherwise use the session name the user gives.
ListAgentsshows every session on the account, often hundreds, with no repo or branch, so ask the user when it isn't clear. -
Send it with
SendMessage. If the spec changed since the build, include the new spec text:Spec check of against . The user wants these fixed. Their comment is under each one. If you think the spec is wrong, say so in your reply. Don't change the spec yourself. Reply with the commit SHA when you're done. <entries: ID, spec line, evidence, the user's comment>
-
Mark those entries
sentin the tab, and reply in each comment thread: "Sent to the implementer."
When the implementer replies, tell the user it's done and give the SHA. Don't check it again
until the user runs spec-check again. That next run marks fixed entries fixed and adds any
new ones.
When the user says "accept DR-n", change that spec line to match the code. Add
(changed by DR-n, <date>) next to it and mark the entry accepted.