Review Spec
Review a spec or plan change on the current branch of the GitLab Artifact Registry (`docs/specs/`, `docs/plans/`, `docs/adr/`) before human review. The deliverable is a terminal report identifying issues such as contradictions, missing acceptance criteria, and other defects.
Editor's Note
Validate every citation under `~/.claude/skills/review-branch/references/protocol.md` before proceeding. Ensure the current branch is correctly set up and that the MR iid (if provided) corresponds to the source branch.
When to Use It
- Identify contradictions in spec changes
- Check for missing acceptance criteria in plan documents
- Validate cross-references in ADR files
- Ensure consistency between spec and code in `main`
SKILL.md
SkillsHunter provides this listing for informational purposes only. Review the skill’s source, license, and required permissions before use. You are responsible for deciding whether to install or run it. Terms of Use
Spec and plan review
A spec is the source of truth an implementer builds from, and a plan is the record a step author sizes their MR from. A defect in either is built into code before anyone notices. Review the document as the implementer will read it: whole, at HEAD, against the tree it describes.
Rules
- Read-only on GitLab, except for the writes the
goline names (see Post recommendation), and only when the operator saysgoin the current turn. Otherwiseglab mr view,glab issue view, andglab apiGETs only: never post, reply, react, approve, or edit an MR or issue. The output is a report in the terminal. - Validate every citation under
~/.claude/skills/review-branch/references/protocol.md, which also sets the severity bar and the findings format. Read it first. - A spec defect blocks when an implementer who follows the text
builds behavior in one of the classes in the repo's
docs/dev/agentic-development.md#what-blocks-a-merge. Wording that misleads without changing what gets built is an OBSERVATION. Report both: the point of this review is that the human round finds nothing. - A fix removes before it adds. Every text a report proposes takes the cheapest form that ends the finding: cut the claim, point at its source ("the flag cache's lifetime", "the run's own timeout"), or describe the behavior without naming another document's step, MR, or section. A proposed fix adds a number, a step or MR number, or a section name only when this document is the one that sets the value. Each such addition is a second copy that goes false when its source changes, and the next round flags it. Check every proposed fix against S1 to S4 before writing it, reading S1 over the whole plan too: a fix that states a rule the rest of the document contradicts ("whichever lands first builds it" against "Step 0 owns it") is a new defect. A fix that adds a claim the document can't verify alone is replaced by one that removes the claim.
- Report what a human round would raise. A finding that a human reviewer reading the diff would not raise goes under Held back, one line each, not under Findings. Three kinds qualify: a conflict that exists only if another unmerged MR lands first, text no step builds on yet, and wording that misleads without changing what gets built. List at most five OBSERVATIONs; count the rest under Held back.
- Trust nothing written down. A count, a file list, a status, or a "today" claim is re-derived from the tree, the step branch, or the cited document. The diff's own justification is not evidence.
- Turns are the cost, as in
/review-branch: batch independent reads into one turn, read a file once, stop at the turn budget.
Files
| File | Read by |
|---|---|
~/.claude/skills/review-branch/references/protocol.md |
every lens |
~/.claude/skills/review-spec/references/checks.md |
every lens; the parent for check D |
~/.claude/skills/review-branch/references/judge.md |
the finding-check subagent |
Setup (parent, no ultrathink)
1. Arguments and base
<base> is the positional argument, or origin/main after
git fetch -q origin main. A positional argument that is a bare integer
or !<iid> is an MR iid, not a base: treat it as --mr <iid> with
<base> = origin/main. When the current branch isn't that MR's source
branch, review the MR head in a throwaway worktree: fetch
refs/merge-requests/<iid>/head as in step 3, run
git worktree add --detach <scratch>/wt-<iid> origin/mr/<iid>, use it as
<repo_root> for every command and lens, and remove it before the
report. <base> is what "main" means in every
check but S10: a claim about main is checked at <base>, never at a
later ref. S10 reads origin/main on purpose, to catch drift since
<base>. --mr <iid> names the branch's MR when glab mr view cannot find
it from the current branch. --description runs check D only (Setup
steps 2 and 4, then check D, then the report): use it after each push.
--delta <sha> reviews the fixes after a full review, where <sha> is
the head that review covered. Use it for every round after the first: a
full re-review re-reads text the last round passed, and re-raises threads
the fixes already closed. Run a full review again only for a new base. Step 2 adds
git diff -U0 <sha>..HEAD -- docs/specs docs/plans, and the bundle
carries it as FIX HUNKS. Each lens runs all of its checks on every
FIX HUNKS line as new text, not only the check that raised the earlier
finding, and still reads the whole document, because a fix changes the
clauses around it. An author's answer to a finding is the likeliest
place for the next one. A finding still has to sit on a FIX HUNKS line
or on a clause one of them made false; text the earlier review read and
passed is not raised again. The report's check D covers only what the
delta changed.
2. Context, one Bash call
git log --oneline <base>..HEAD
git diff --name-status <base>...HEAD
git diff -U0 <base>...HEAD -- docs/specs docs/plans docs/adr
git rev-parse <base> HEAD
Classify each changed file:
| Kind | Path |
|---|---|
spec |
docs/specs/**/S*.md |
plan |
docs/plans/*.md except README.md and TEMPLATE.md |
adr |
docs/adr/[0-9]*.md |
index |
docs/specs/README.md, docs/plans/README.md |
other |
anything else |
No spec, plan, or adr file: abort with review-spec: no spec, plan, or ADR change between <base> and HEAD; use /review-branch. An other file
that is Go or config is named in the report as out of scope for this
skill.
For each changed spec, record its layout: older when it has a
## Acceptance Criteria heading, live otherwise (the current
docs/specs/TEMPLATE.md, which has none). For each changed plan,
record older when it has a Status table or per-step Files lists,
live otherwise (the current docs/plans/TEMPLATE.md bans file lists
and counts).
3. Step MRs (plan changes only)
Collect every !<iid> in the changed plan hunks and in the MR
description. For each, one batched turn:
glab mr view <iid> --output json | jq '{iid,state,title,source_branch,target_branch,sha,merge_commit_sha,squash_commit_sha,description}'
git fetch -q origin "+refs/merge-requests/<iid>/head:refs/remotes/origin/mr/<iid>"
The step's diff is git diff <base>...origin/mr/<iid> for an open MR,
and the merged commit against its first parent for a merged one. Keep
each step MR's description: check P2 reads its merge-order lines.
4. The MR
glab mr view [<iid>] --output json for the title and description.
No MR yet: check D reviews the branch's commit subjects as the future
title and records "no description".
Keep .author.username from that JSON, and read glab api user for the
reviewer's own username: the Post recommendation prints only for another
author's MR. With an MR, also read its unresolved threads (GETs only):
python3 ~/.claude/skills/glab-read/scripts/glab-read.py threads <iid> --unresolved --max 1500
5. Bundle
BUNDLE=/tmp/review-spec-$(git rev-parse --abbrev-ref HEAD | tr / -)-$(date +%s).md
One heredoc: base and head SHAs, repo root, the changed-file table
with kinds and layouts, the -U0 diff from step 2, the MR title and
description, the step MR table from step 3 (iid, state, diff range),
the unresolved threads from step 4, and nothing else. No file contents:
every lens reads from disk. The blind lens gets a second bundle with
only the SHAs, repo root, changed-file table, and -U0 diff (plus
FIX HUNKS under --delta).
Lenses
| Lens | Runs when | Checks | Reads |
|---|---|---|---|
internal |
a spec changed | S1, S2, S3, S6, S9 | each changed spec whole, at HEAD, then the dependency source an S3 bound check names |
external |
a spec changed | S4, S5, S7, S8, S10, F | each changed spec section whole (the ## section around each hunk), then the targets the checks name |
plan |
a plan changed | S2, S3, P1, P2, P3, S4, S5, F | each changed plan step whole, the plan's Status table and ## Dependencies (or Depends-on fields), then the targets the checks name, including the dependency source an S3 bound check names |
adr |
an ADR changed | A, S1, S4, S5, F | each changed ADR whole, at HEAD, docs/adr/README.md at <base>, then the specs and open MRs the ADR names or that cite it |
blind |
a spec changed | X | each changed spec whole, then the source its changed sections name; no description, threads, plan, or earlier report |
The parent runs check D itself. The blind lens takes its own bundle and
prompt (Blind lens, below).
Launch the lenses that apply as parallel Agent subagents, each with
model: "opus", and this prompt (fill <lens>, <checks>, <reads>, <bundle>, <repo_root>):
You are reviewing a spec or plan change in the GitLab Artifact
Registry repository at <repo_root>, before human review. Use ultrathink
for the review work. You are read-only: do not edit files, and on
GitLab run only glab GET commands (mr view, issue view, api GET).
Never post anything.
Turn 1, in parallel:
1. ~/.claude/skills/review-branch/references/protocol.md: citation
rules, severity bar, the exact findings format.
2. ~/.claude/skills/review-spec/references/checks.md: run only
checks <checks>; the rest of the file is context.
3. <bundle>: base and head SHAs, the changed files, the -U0 diff, the
MR description, step MRs.
Turn 2, in parallel: <reads>. A spec larger than the Read limit is
read in consecutive ranges in this one turn, never sampled.
"main" means the base SHA in the bundle. Check a claim about main
with git show <base>:<path> and git grep <pattern> <base>, never
against origin/main or a later ref (check S10 alone reads origin/main,
as its text says). Read the document under review at
HEAD.
Fix text: a Fix you propose cuts the claim, points at its source, or
describes the behavior. It adds a number, a step or MR number, or a
section name of another document only when this document sets that
value. Check each Fix against S1 to S4 before you write it, S1 over
the whole document: grep the Fix's subject and confirm no other passage
says otherwise.
Each check gives a phase in your reply. Batch: when a turn reads or
greps, it does everything you already know you need. Budget: 40 tool
turns. At 34, stop, verify every citation you hold in one batched
turn, and write the findings. A check you could not finish is
`skipped (turn budget)`, never silently thin.
If a lens's reply does not match the protocol format, re-prompt once
with "Return findings in the exact format specified in protocol.md."
A second failure marks its checks unreviewed (subagent failed).
Blind lens
A review that has read the author's reasoning tends to agree with it.
Launch blind in the same message as the other lenses, as a general-purpose
subagent with model: "opus", and this prompt (fill <blind_bundle>, <repo_root>):
You are an implementer about to build from a spec in the GitLab Artifact
Registry repository at <repo_root>. You are read-only: edit nothing and
do not use glab.
Turn 1, in parallel: ~/.claude/skills/review-branch/references/protocol.md
(citation rules and the findings format) and <blind_bundle>.
Turn 2, in parallel: each changed spec whole at HEAD, then the source, at
HEAD, of every type, function, and config key the changed sections name.
Follow the changed sections literally, as code. Name exactly one input or
state where doing what the text says fails, stalls, or contradicts another
clause or the code it cites. Give the spec line, the code line, and the
text that would fix it, in the protocol's findings format under check X.
If you conclude there is none, say which clause you checked last and how.
Do not read docs/plans/, the MR, any review thread, or any review report.
Budget: 25 tool turns. At 20, stop and write the finding.
Synthesis (parent, ultrathink)
-
Collect findings and assign IDs (B1…, W1…, O1…, D1…). Merge two findings on the same passage with the same cause; keep both when the cause is the same and the passages differ, linked with
Related:. Drop nothing silently. -
Re-open the cited line of every BLOCKING and WARNING at HEAD (or at
<base>for a claim about main) in one batched turn. Ablindfinding the cited lines do not support is dropped, with one line of why under Held. -
Finding check. The lens that raised a finding also graded it, and you've read its reasoning, so a fresh subagent verifies it instead, without seeing the severity. Skip this step when another skill invoked this one (that skill checks the findings it takes), or when no BLOCKING, DECISION, or WARNING finding is left. Launch one
Agentsubagent, not a fork, withmodel: "opus", and this prompt:Read ~/.claude/skills/review-branch/references/judge.md and follow it. Repo root: <repo_root>. Base SHA: <base SHA>. Findings: <for each BLOCKING, DECISION, and WARNING finding: ID | path:line | What | Evidence>Pass only those fields: no severity, no check, no Fix, no ship path. Apply every line as returned.
holdsat a different severity, up or down, moves the finding to its new list with the next ID there, carrying Regraded from: with the old ID and the judge's reason; a new WARNING gets the judge's ship path.refutedmoves it to Held back with the judge's reason.can't tellkeeps it as it was, with Unverified: and what the judge couldn't check. When the reply doesn't match judge.md's output, re-prompt once; if it fails again, keep every finding as it was and add "Finding check did not run." under the verdict line. -
Triage. Move each finding a human round would not raise (Rules) to Held back, one line each, and keep at most five OBSERVATIONs. Re-check each remaining Fix against the "removes before it adds" rule and rewrite one that fails it. A WARNING with no ship path (the protocol requires one) becomes an OBSERVATION, or gets its path.
-
Verdict: any BLOCKING → BLOCK; any check
unreviewedor a check S1–S5 or P1skipped (turn budget)→ REQUEST CHANGES; otherwise APPROVE. A WARNING carries a ship path by the protocol's definition ("the MR can ship"), so it doesn't change the verdict: the report lists it under an APPROVE.
Output
## Spec review: <branch> -> <base short SHA>
**Changed:** <spec and plan files, with layout> | **Out of scope:** <other files, or none>
**Lenses:** internal, external, plan, blind (whichever ran)
### Verdict
APPROVE / REQUEST CHANGES / BLOCK
<One sentence naming the findings that drove it.>
### Findings
**Tally:** N BLOCKING, N WARNING, N OBSERVATION, N DECISION
**[B1] <title>**
- **Check:** <ID and name>
- **Location:** `path:line` (HEAD) or `path:line @ <base short SHA>`
- **What:** <the defect, quoting the text>
- **Evidence:** <what the tree, step branch, or cited document says, with its citation>
- **Fix:** <replacement text where it is short>
- **Regraded from:** <old ID>: <judge's reason> (only when the finding check moved it)
- **Unverified:** <what the judge couldn't check> (only on a `can't tell`)
### Checks
| Check | Verdict | B | W | O | D |
|---|---|---|---|---|---|
### Examined / Held / Not verified
<per lens, from its GROUP SUMMARY block>
### Held back
<one line per finding triage moved out of Findings, or "none">
### Post recommendation
**Post** (<N> units from <M> findings)
1. [W1 + O3] `path:line`: <one clause on what the comment asks for>
2. [B1] `path:line`: <...>
**Elsewhere:** [W4] MR description line | follow-up issue: <one clause>
**Skip:** [O1] <reason, one clause> | [O2] <...>
**Next:** `/review-spec <iid or base> --delta <head short SHA>` after the
fixes, never a full re-review.
Say "go" to: post the Post list, post the Elsewhere list, approve.
The Post recommendation answers "which findings go on the MR?" for a
reviewer, so print it only when an MR iid is known and its author isn't
the glab user. Otherwise omit it: the author fixes the branch. It posts
nothing by itself, and Held back stays where it is. When another skill
invoked this one (review-branch does, for a branch that changes specs), omit
the go line and the Next line too: that skill takes the findings and
owns the handover.
Save the report. Unless another skill invoked this one, and with a known
MR iid, write the report to
~/projects/notes/mr-reviews/mr-<iid>-review-spec.md, and a --delta run to
mr-<iid>-review-spec-delta.md. Put
## Spec review: !<iid> <MR title>: <branch> -> <base short SHA> on the first
line: /address-reviewer-inputs and /review-retro count a report only when
the MR title in its heading matches. When the directory doesn't exist, skip
the write and say so; don't create it. With no known iid, as before the MR is
opened, write nothing.
Combine by location. Findings on the same passage and about the same
edit become one unit, whatever their severities: keep the highest
severity, cite every ID, and write one ask that covers each point.
Findings on different passages stay separate, even with one root cause
(Related: carries that).
Pick what to post.
- Post every BLOCKING and DECISION unit.
- Post a WARNING unit when its ship path is a thread or a note to the author. A WARNING whose ship path is an MR description line or a follow-up issue goes under Elsewhere.
- Post an OBSERVATION unit only when the author can act on it in this MR and it would change what they do. Merged into a posted unit, it rides along. Alone, and cosmetic or already covered by a posted unit, it is skipped.
- Skip a finding an open thread already raises, and cite the thread.
Word each ask from the finding's Fix, which already passed the removes-before-adds rule. Don't add a number, a step or MR number, or a section name the Fix left out. Write about the text, not the person: no "you" and no "the author".
Omit an empty line (Elsewhere, Skip). With no findings, write
"Nothing to post." and leave the go line off unless the verdict is APPROVE.
Build the go line from the parts that apply, in this order, and name only
those: "post the Post list" (when it has units), "post the Elsewhere list"
(when that line exists), and "approve" (only when the verdict is APPROVE;
never on REQUEST CHANGES or BLOCK). With no known MR iid, or an MR the glab
user authored, there is no Post recommendation and no go line. Draft no
other MR notes and write no summary.
go, said in the current turn, is the operator's instruction for exactly the
steps the line named, and for nothing else. Run them in order and stop at the
first failure without approving:
- Post each Post unit as one comment at its location, worded from the finding's Fix. An inline position must be an added line in the diff; a unit about unchanged text anchors at the nearest added line.
- Post the Elsewhere list as one top-level note with
--resolvable=false, one bullet per item, worded from the Fix and marked non-blocking. A "follow-up issue" item is a suggestion in that note;gonever creates an issue and never edits the MR description. glab mr approve <iid> --sha <reviewed HEAD>, so a push after the review isn't approved. Read the approvals back to confirm.
Held back, Skip, and every finding the lines above leave out stay unposted.
Without go, post nothing: the operator posts from the list, and the author
fixes the branch.
View original Markdown
---
name: review-spec
description: >
Review a spec or plan change on the current branch of the GitLab
Artifact Registry (`docs/specs/`, `docs/plans/`, `docs/adr/`) before
human review.
Reads the whole amended spec rather than the hunks, and checks what
human reviewers kept finding: clauses the edit contradicts, normative
rules with no acceptance criterion, bounds with no number or wrong
arithmetic, cross-references that do not say what is claimed,
present-tense claims about `main` that the code disproves, enum
vocabulary that drifts between metrics, events, and error rows,
data-model rows that break `docs/dev/database.md`, a named client's
default run that the flow refuses, background jobs with no stated
behavior in each parent lifecycle state, caps with no exit, sibling
format specs that moved on `main` since the base, plan Files lists
and counts that the step branch disproves, Status rows and handoffs
recorded on one side only, an ADR that carries detail its README
sends elsewhere, states an unchecked claim about outside software, or
promises isolation a lower role can defeat, unchanged text elsewhere
in the tree that the edit makes false, and an MR description whose
"What changed" list no longer matches the diff. Read-only on GitLab
until the operator says "go": it lists which findings to post on
another author's MR and posts them, and approves, only on that word. Use for "review this spec", "review the plan MR",
"review the ADR", "self-review before I request review" on a
docs(specs), docs(plans), or docs(adr) branch. Go changes go to
`/review-branch`.
argument-hint: "[base] [--mr <iid>] [--description] [--delta <sha>]"
---
# Spec and plan review
A spec is the source of truth an implementer builds from, and a plan is
the record a step author sizes their MR from. A defect in either is
built into code before anyone notices. Review the document as the
implementer will read it: whole, at HEAD, against the tree it describes.
## Rules
- **Read-only on GitLab,** except for the writes the `go` line names (see
Post recommendation), and only when the operator says `go` in the
current turn. Otherwise `glab mr view`, `glab issue view`, and `glab
api` GETs only: never post, reply, react, approve, or edit an MR or
issue. The output is a report in the terminal.
- **Validate every citation** under
`~/.claude/skills/review-branch/references/protocol.md`, which also
sets the severity bar and the findings format. Read it first.
- **A spec defect blocks** when an implementer who follows the text
builds behavior in one of the classes in the repo's
`docs/dev/agentic-development.md#what-blocks-a-merge`. Wording that
misleads without changing what gets built is an OBSERVATION. Report
both: the point of this review is that the human round finds nothing.
- **A fix removes before it adds.** Every text a report proposes takes
the cheapest form that ends the finding: cut the claim, point at its
source ("the flag cache's lifetime", "the run's own timeout"), or
describe the behavior without naming another document's step, MR, or
section. A proposed fix adds a number, a step or MR number, or a
section name only when this document is the one that sets the value.
Each such addition is a second copy that goes false when its source
changes, and the next round flags it. Check every proposed fix against
S1 to S4 before writing it, reading S1 over the whole plan too: a fix
that states a rule the rest of the document contradicts ("whichever
lands first builds it" against "Step 0 owns it") is a new defect. A fix
that adds a claim the document can't verify alone is replaced by one
that removes the claim.
- **Report what a human round would raise.** A finding that a human
reviewer reading the diff would not raise goes under Held back, one
line each, not under Findings. Three kinds qualify: a conflict that
exists only if another unmerged MR lands first, text no step builds on
yet, and wording that misleads without changing what gets built. List
at most five OBSERVATIONs; count the rest under Held back.
- **Trust nothing written down.** A count, a file list, a status, or a
"today" claim is re-derived from the tree, the step branch, or the
cited document. The diff's own justification is not evidence.
- **Turns are the cost**, as in `/review-branch`: batch independent
reads into one turn, read a file once, stop at the turn budget.
## Files
| File | Read by |
|---|---|
| `~/.claude/skills/review-branch/references/protocol.md` | every lens |
| `~/.claude/skills/review-spec/references/checks.md` | every lens; the parent for check D |
| `~/.claude/skills/review-branch/references/judge.md` | the finding-check subagent |
## Setup (parent, no ultrathink)
### 1. Arguments and base
`<base>` is the positional argument, or `origin/main` after
`git fetch -q origin main`. A positional argument that is a bare integer
or `!<iid>` is an MR iid, not a base: treat it as `--mr <iid>` with
`<base>` = `origin/main`. When the current branch isn't that MR's source
branch, review the MR head in a throwaway worktree: fetch
`refs/merge-requests/<iid>/head` as in step 3, run
`git worktree add --detach <scratch>/wt-<iid> origin/mr/<iid>`, use it as
`<repo_root>` for every command and lens, and remove it before the
report. `<base>` is what "main" means in every
check but S10: a claim about `main` is checked at `<base>`, never at a
later ref. S10 reads `origin/main` on purpose, to catch drift since
`<base>`. `--mr <iid>` names the branch's MR when `glab mr view` cannot find
it from the current branch. `--description` runs check D only (Setup
steps 2 and 4, then check D, then the report): use it after each push.
`--delta <sha>` reviews the fixes after a full review, where `<sha>` is
the head that review covered. Use it for every round after the first: a
full re-review re-reads text the last round passed, and re-raises threads
the fixes already closed. Run a full review again only for a new base. Step 2 adds
`git diff -U0 <sha>..HEAD -- docs/specs docs/plans`, and the bundle
carries it as `FIX HUNKS`. Each lens runs all of its checks on every
FIX HUNKS line as new text, not only the check that raised the earlier
finding, and still reads the whole document, because a fix changes the
clauses around it. An author's answer to a finding is the likeliest
place for the next one. A finding still has to sit on a FIX HUNKS line
or on a clause one of them made false; text the earlier review read and
passed is not raised again. The report's check D covers only what the
delta changed.
### 2. Context, one Bash call
```bash
git log --oneline <base>..HEAD
git diff --name-status <base>...HEAD
git diff -U0 <base>...HEAD -- docs/specs docs/plans docs/adr
git rev-parse <base> HEAD
```
Classify each changed file:
| Kind | Path |
|---|---|
| `spec` | `docs/specs/**/S*.md` |
| `plan` | `docs/plans/*.md` except `README.md` and `TEMPLATE.md` |
| `adr` | `docs/adr/[0-9]*.md` |
| `index` | `docs/specs/README.md`, `docs/plans/README.md` |
| `other` | anything else |
No `spec`, `plan`, or `adr` file: abort with `review-spec: no spec,
plan, or ADR change between <base> and HEAD; use /review-branch`. An `other` file
that is Go or config is named in the report as out of scope for this
skill.
For each changed spec, record its layout: `older` when it has a
`## Acceptance Criteria` heading, `live` otherwise (the current
`docs/specs/TEMPLATE.md`, which has none). For each changed plan,
record `older` when it has a Status table or per-step **Files** lists,
`live` otherwise (the current `docs/plans/TEMPLATE.md` bans file lists
and counts).
### 3. Step MRs (plan changes only)
Collect every `!<iid>` in the changed plan hunks and in the MR
description. For each, one batched turn:
```bash
glab mr view <iid> --output json | jq '{iid,state,title,source_branch,target_branch,sha,merge_commit_sha,squash_commit_sha,description}'
git fetch -q origin "+refs/merge-requests/<iid>/head:refs/remotes/origin/mr/<iid>"
```
The step's diff is `git diff <base>...origin/mr/<iid>` for an open MR,
and the merged commit against its first parent for a merged one. Keep
each step MR's description: check P2 reads its merge-order lines.
### 4. The MR
`glab mr view [<iid>] --output json` for the title and description.
No MR yet: check D reviews the branch's commit subjects as the future
title and records "no description".
Keep `.author.username` from that JSON, and read `glab api user` for the
reviewer's own username: the Post recommendation prints only for another
author's MR. With an MR, also read its unresolved threads (GETs only):
```bash
python3 ~/.claude/skills/glab-read/scripts/glab-read.py threads <iid> --unresolved --max 1500
```
### 5. Bundle
```bash
BUNDLE=/tmp/review-spec-$(git rev-parse --abbrev-ref HEAD | tr / -)-$(date +%s).md
```
One heredoc: base and head SHAs, repo root, the changed-file table
with kinds and layouts, the `-U0` diff from step 2, the MR title and
description, the step MR table from step 3 (iid, state, diff range),
the unresolved threads from step 4, and nothing else. No file contents:
every lens reads from disk. The `blind` lens gets a second bundle with
only the SHAs, repo root, changed-file table, and `-U0` diff (plus
`FIX HUNKS` under `--delta`).
## Lenses
| Lens | Runs when | Checks | Reads |
|---|---|---|---|
| `internal` | a spec changed | S1, S2, S3, S6, S9 | each changed spec whole, at HEAD, then the dependency source an S3 bound check names |
| `external` | a spec changed | S4, S5, S7, S8, S10, F | each changed spec section whole (the `##` section around each hunk), then the targets the checks name |
| `plan` | a plan changed | S2, S3, P1, P2, P3, S4, S5, F | each changed plan step whole, the plan's Status table and `## Dependencies` (or Depends-on fields), then the targets the checks name, including the dependency source an S3 bound check names |
| `adr` | an ADR changed | A, S1, S4, S5, F | each changed ADR whole, at HEAD, `docs/adr/README.md` at `<base>`, then the specs and open MRs the ADR names or that cite it |
| `blind` | a spec changed | X | each changed spec whole, then the source its changed sections name; no description, threads, plan, or earlier report |
The parent runs check D itself. The `blind` lens takes its own bundle and
prompt (Blind lens, below).
Launch the lenses that apply as parallel `Agent` subagents, each with
`model: "opus"`, and this prompt (fill `<lens>`, `<checks>`, `<reads>`, `<bundle>`, `<repo_root>`):
```plaintext
You are reviewing a spec or plan change in the GitLab Artifact
Registry repository at <repo_root>, before human review. Use ultrathink
for the review work. You are read-only: do not edit files, and on
GitLab run only glab GET commands (mr view, issue view, api GET).
Never post anything.
Turn 1, in parallel:
1. ~/.claude/skills/review-branch/references/protocol.md: citation
rules, severity bar, the exact findings format.
2. ~/.claude/skills/review-spec/references/checks.md: run only
checks <checks>; the rest of the file is context.
3. <bundle>: base and head SHAs, the changed files, the -U0 diff, the
MR description, step MRs.
Turn 2, in parallel: <reads>. A spec larger than the Read limit is
read in consecutive ranges in this one turn, never sampled.
"main" means the base SHA in the bundle. Check a claim about main
with git show <base>:<path> and git grep <pattern> <base>, never
against origin/main or a later ref (check S10 alone reads origin/main,
as its text says). Read the document under review at
HEAD.
Fix text: a Fix you propose cuts the claim, points at its source, or
describes the behavior. It adds a number, a step or MR number, or a
section name of another document only when this document sets that
value. Check each Fix against S1 to S4 before you write it, S1 over
the whole document: grep the Fix's subject and confirm no other passage
says otherwise.
Each check gives a phase in your reply. Batch: when a turn reads or
greps, it does everything you already know you need. Budget: 40 tool
turns. At 34, stop, verify every citation you hold in one batched
turn, and write the findings. A check you could not finish is
`skipped (turn budget)`, never silently thin.
```
If a lens's reply does not match the protocol format, re-prompt once
with "Return findings in the exact format specified in protocol.md."
A second failure marks its checks `unreviewed (subagent failed)`.
## Blind lens
A review that has read the author's reasoning tends to agree with it.
Launch `blind` in the same message as the other lenses, as a general-purpose
subagent with `model: "opus"`, and this prompt (fill `<blind_bundle>`, `<repo_root>`):
```plaintext
You are an implementer about to build from a spec in the GitLab Artifact
Registry repository at <repo_root>. You are read-only: edit nothing and
do not use glab.
Turn 1, in parallel: ~/.claude/skills/review-branch/references/protocol.md
(citation rules and the findings format) and <blind_bundle>.
Turn 2, in parallel: each changed spec whole at HEAD, then the source, at
HEAD, of every type, function, and config key the changed sections name.
Follow the changed sections literally, as code. Name exactly one input or
state where doing what the text says fails, stalls, or contradicts another
clause or the code it cites. Give the spec line, the code line, and the
text that would fix it, in the protocol's findings format under check X.
If you conclude there is none, say which clause you checked last and how.
Do not read docs/plans/, the MR, any review thread, or any review report.
Budget: 25 tool turns. At 20, stop and write the finding.
```
## Synthesis (parent, ultrathink)
1. Collect findings and assign IDs (B1…, W1…, O1…, D1…). Merge two
findings on the same passage with the same cause; keep both when the
cause is the same and the passages differ, linked with `Related:`.
Drop nothing silently.
2. Re-open the cited line of every BLOCKING and WARNING at HEAD (or at
`<base>` for a claim about main) in one batched turn. A `blind` finding
the cited lines do not support is dropped, with one line of why under
Held.
3. Finding check. The lens that raised a finding also graded it, and
you've read its reasoning, so a fresh subagent verifies it instead,
without seeing the severity. Skip this step when another skill
invoked this one (that skill checks the findings it takes), or when
no BLOCKING, DECISION, or WARNING finding is left. Launch one `Agent`
subagent, not a fork, with `model: "opus"`, and this prompt:
```plaintext
Read ~/.claude/skills/review-branch/references/judge.md and follow it.
Repo root: <repo_root>. Base SHA: <base SHA>.
Findings:
<for each BLOCKING, DECISION, and WARNING finding:
ID | path:line | What | Evidence>
```
Pass only those fields: no severity, no check, no Fix, no ship path.
Apply every line as returned. `holds` at a different severity, up or
down, moves the finding to its new list with the next ID there,
carrying **Regraded from:** with the old ID and the judge's reason; a
new WARNING gets the judge's ship path. `refuted` moves it to Held
back with the judge's reason. `can't tell` keeps it as it was, with
**Unverified:** and what the judge couldn't check. When the reply
doesn't match judge.md's output, re-prompt once; if it fails again,
keep every finding as it was and add "Finding check did not run."
under the verdict line.
4. Triage. Move each finding a human round would not raise (Rules) to
Held back, one line each, and keep at most five OBSERVATIONs. Re-check
each remaining Fix against the "removes before it adds" rule and
rewrite one that fails it. A WARNING with no ship path (the protocol
requires one) becomes an OBSERVATION, or gets its path.
5. Verdict: any BLOCKING → **BLOCK**; any check `unreviewed` or a
check S1–S5 or P1 `skipped (turn budget)` → **REQUEST CHANGES**;
otherwise **APPROVE**. A WARNING carries a ship path by the protocol's
definition ("the MR can ship"), so it doesn't change the verdict: the
report lists it under an APPROVE.
## Output
```plaintext
## Spec review: <branch> -> <base short SHA>
**Changed:** <spec and plan files, with layout> | **Out of scope:** <other files, or none>
**Lenses:** internal, external, plan, blind (whichever ran)
### Verdict
APPROVE / REQUEST CHANGES / BLOCK
<One sentence naming the findings that drove it.>
### Findings
**Tally:** N BLOCKING, N WARNING, N OBSERVATION, N DECISION
**[B1] <title>**
- **Check:** <ID and name>
- **Location:** `path:line` (HEAD) or `path:line @ <base short SHA>`
- **What:** <the defect, quoting the text>
- **Evidence:** <what the tree, step branch, or cited document says, with its citation>
- **Fix:** <replacement text where it is short>
- **Regraded from:** <old ID>: <judge's reason> (only when the finding check moved it)
- **Unverified:** <what the judge couldn't check> (only on a `can't tell`)
### Checks
| Check | Verdict | B | W | O | D |
|---|---|---|---|---|---|
### Examined / Held / Not verified
<per lens, from its GROUP SUMMARY block>
### Held back
<one line per finding triage moved out of Findings, or "none">
### Post recommendation
**Post** (<N> units from <M> findings)
1. [W1 + O3] `path:line`: <one clause on what the comment asks for>
2. [B1] `path:line`: <...>
**Elsewhere:** [W4] MR description line | follow-up issue: <one clause>
**Skip:** [O1] <reason, one clause> | [O2] <...>
**Next:** `/review-spec <iid or base> --delta <head short SHA>` after the
fixes, never a full re-review.
Say "go" to: post the Post list, post the Elsewhere list, approve.
```
The Post recommendation answers "which findings go on the MR?" for a
reviewer, so print it only when an MR iid is known and its author isn't
the glab user. Otherwise omit it: the author fixes the branch. It posts
nothing by itself, and Held back stays where it is. When another skill
invoked this one (review-branch does, for a branch that changes specs), omit
the `go` line and the `Next` line too: that skill takes the findings and
owns the handover.
**Save the report.** Unless another skill invoked this one, and with a known
MR iid, write the report to
`~/projects/notes/mr-reviews/mr-<iid>-review-spec.md`, and a `--delta` run to
`mr-<iid>-review-spec-delta.md`. Put
`## Spec review: !<iid> <MR title>: <branch> -> <base short SHA>` on the first
line: `/address-reviewer-inputs` and `/review-retro` count a report only when
the MR title in its heading matches. When the directory doesn't exist, skip
the write and say so; don't create it. With no known iid, as before the MR is
opened, write nothing.
**Combine by location.** Findings on the same passage and about the same
edit become one unit, whatever their severities: keep the highest
severity, cite every ID, and write one ask that covers each point.
Findings on different passages stay separate, even with one root cause
(`Related:` carries that).
**Pick what to post.**
- Post every BLOCKING and DECISION unit.
- Post a WARNING unit when its ship path is a thread or a note to the
author. A WARNING whose ship path is an MR description line or a
follow-up issue goes under Elsewhere.
- Post an OBSERVATION unit only when the author can act on it in this MR
and it would change what they do. Merged into a posted unit, it rides
along. Alone, and cosmetic or already covered by a posted unit, it is
skipped.
- Skip a finding an open thread already raises, and cite the thread.
**Word each ask from the finding's Fix**, which already passed the
removes-before-adds rule. Don't add a number, a step or MR number, or a
section name the Fix left out. Write about the text, not the person: no
"you" and no "the author".
Omit an empty line (`Elsewhere`, `Skip`). With no findings, write
"Nothing to post." and leave the `go` line off unless the verdict is APPROVE.
Build the `go` line from the parts that apply, in this order, and name only
those: "post the Post list" (when it has units), "post the Elsewhere list"
(when that line exists), and "approve" (only when the verdict is APPROVE;
never on REQUEST CHANGES or BLOCK). With no known MR iid, or an MR the glab
user authored, there is no Post recommendation and no `go` line. Draft no
other MR notes and write no summary.
`go`, said in the current turn, is the operator's instruction for exactly the
steps the line named, and for nothing else. Run them in order and stop at the
first failure without approving:
1. Post each Post unit as one comment at its location, worded from the
finding's Fix. An inline position must be an added line in the diff; a
unit about unchanged text anchors at the nearest added line.
2. Post the Elsewhere list as one top-level note with `--resolvable=false`,
one bullet per item, worded from the Fix and marked non-blocking. A
"follow-up issue" item is a suggestion in that note; `go` never creates an
issue and never edits the MR description.
3. `glab mr approve <iid> --sha <reviewed HEAD>`, so a push after the review
isn't approved. Read the approvals back to confirm.
Held back, Skip, and every finding the lines above leave out stay unposted.
Without `go`, post nothing: the operator posts from the list, and the author
fixes the branch.
Community Reviews & Field Notes
Tried this skill on your own project? Share the model you used and the results you got.