---
name: review-followup
description: First pass after an MR author answers my review. Lists the replies on my threads, computes the interdiff since the version I reviewed, routes it (verify docs, comment edits, and renames here; send other code changes to a re-review), verifies those fixes against each finding, and checks the reasoning in declined replies. Use for "author has updated", "author replied", "check the replies on !123", "follow up on my review of <MR>".
---

# Review follow-up

This skill is the cheap first pass after an MR author answers a review. Run it
in a fresh Sonnet or Haiku session, not in the session that did the review: a
resumed review session rereads its whole transcript.

The skill clears docs changes, comment edits, renames, and declines whose
reasoning holds up. Any other code change goes to a re-review.

## Rules

1. **The reply is not evidence.** Judge each fix from the diff alone. "Fixed in
   abc123" is a claim that the diff confirms or refutes. Judge each decline
   from the code and the live MR description it cites, never from its say-so.
2. **Judge the whole interdiff,** not only the commit a reply names. The
   author can change other lines in the same push.
3. **Check a decline; don't take it on trust.** The author owns the decision.
   A `declined` reply, or a `partial` one that gives a reason for what it left
   out or did differently, is `verified` when its reasoning holds against the
   evidence (step 5), whether it declines all of a suggestion or part of it.
   Every other decline and partial, and every question or unclear reply, goes
   to the person with the reply quoted word for word.
4. **Never resolve an `escalate:` thread, and never check one.** It waits for
   the person's decision, declined reply or not.
5. **Write to GitLab only when the person's request in this turn asks for it**
   (for example "resolve if verified"). Resolve only threads with the verdict
   `verified`, and only on the `verify-fixes` and `replies-only` routes or a
   `rereview` reviewed inline. On a dispatched `rereview`, resolve only the
   rows the go line of step 6 names. Post the re-review's findings and
   approve only as that go line names them, after the person types it. Post
   no reply unless asked. Read the state back after each write.
6. **Never put a file's change down to the target branch unseen.** Before the
   report says a file changed because of main, open `git diff <merge>^2 <merge>`
   or `git show --cc <merge> -- <path>` for it. A merge can carry conflict
   edits, and the author's own commits can touch the same file.

## Steps

### 1. Collect the facts

Run the script from the root of a checkout of the MR's project, where
`link-skills.sh` links the skill into `.claude/skills/`. It isn't in
`~/.claude/skills/`. Remove the output file when the script fails, so an empty
JSON file doesn't stay behind:

```bash
f=<scratchpad>/review-followup-<iid>-$(date +%s).json
.claude/skills/review-followup/review-followup.py <iid> > "$f" || rm -f "$f"
```

`--reviewer <username>` overrides the reviewer, which defaults to the glab
user. The script reads only. Its JSON gives:

- `reviewed` and `current`: the base and head SHAs of the version I reviewed
  and of the newest version. `rebased` says only that the base moved, not that
  history was rewritten.
- `relationship`: how `current.head_sha` relates to `reviewed.head_sha`.
  `rebase`: the reviewed head is not an ancestor (rebased or amended).
  `merge-of-base`: it is an ancestor and the base moved, which is what an
  author does to resolve a conflict by merging the target branch in.
  `same-base`: it is an ancestor and the base did not move. `unknown`: a
  commit is not available locally.
- `commits`: the author's own non-merge commits since the review, those on
  `current.head_sha` and not on `reviewed.head_sha` or the target branch. Each has
  `sha`, `subject`, `committed_at`, `files`, `added`, `removed`,
  `named_by_reply` with `named_in_threads` (the threads whose replies name
  it), and `touches_anchor_of` (the threads anchored on a file it touches).
  Under `rebase` every commit is rewritten, so the list says what the MR
  holds, not what is new.
- `conflict_resolutions`: one entry per merge on the first-parent chain since
  the review, with the `files` whose merged text matches neither parent (the
  edits made inside the merge), `changed_lines`, and `merges_target`. A merge
  whose `merges_target` is false merged something other than the target
  branch; its commits are in `commits`.
- `interdiff.files`: each file whose own change differs between the two
  versions. A rebase does not add files. `cited_by_a_finding` says whether one
  of my threads anchors on the file or on its `renamed_from` path. `kind` is
  one of these:
  - `docs`: a Markdown file, or a file under `docs/`.
  - `comment`: only comment lines or blank lines changed.
  - `rename`: identifier renames, a file move (`renamed_from`), and comment
    edits. `substitutions` lists the identifier pairs.
  - `code`: any other change. `residue` lists the lines that are not a rename
    or a comment edit.
- `interdiff.substitutions`: each identifier pair, with `count`. `leftover_in`
  lists up to 20 files in the changed directories that still contain the old
  name, and `leftover_files` gives the total. The script makes a file `code`
  when a pair swaps to a name that existed before, or when one old name
  becomes two new names.
- `threads`: one entry per thread I started. `status` is `replied`,
  `resolved-by-other`, `resolved`, or `no-reply`. `prefix` is the lowercase
  label before the first colon, after a leading tag line such as `<:robot:>`.
  Each reply carries every SHA it names, with `exists`,
  `on_head_and_after_review`, and `touches_anchor_file`. `earlier_notes` holds
  the notes between my finding and the pending replies, mine included. Read
  them before the reply: a reply to a second note of mine answers that note,
  and a fix I asked for in it was requested, not volunteered.
- `route.decision` and `route.why`.

### 2. Follow the route

| Route | What to do |
|---|---|
| `nothing-to-do` | Report it and stop. |
| `replies-only` | Nothing changed. Label each reply (step 3), check each decline (step 5), and list the rest for the person. Resolve only verified declines. |
| `rereview` | Some files are `code`. Label each reply (step 3). Map each claim to its commit in the changes table (step 6). Check a decline (step 5) only when neither its thread's anchor file nor a file its reasoning cites is `code`; the re-review covers the rest. Dispatch the re-review, or review inline when no skill matches the project (step 6). Resolve nothing yourself: the go line of step 6 lets the person ask for it. |
| `verify-fixes` | Every file is `docs`, `comment`, or `rename`. Label each reply (step 3), verify each fix (step 4), then check each decline (step 5). |

### 3. Label each reply

Give each `replied` or `resolved-by-other` thread one label, and quote the
reply word for word beside it:

- `fix-claimed`: the reply says the author changed the code or docs as asked.
- `partial`: the reply agrees in part, or changes something other than the
  suggested fix ("Agreed, but I changed X instead").
- `declined`: the reply argues that no change is needed.
- `question`: the reply asks something.
- `unclear`: anything else.

A `resolved-by-other` thread with no reply counts as `fix-claimed`. Say that
the author resolved it.

When a reply names a SHA, report the script's facts on it. If a named commit
does not exist, is outside the range since the review, or does not touch the
anchor file, the claim is unsupported. Say so.

### 4. Verify each fix (`verify-fixes` route, and a `rereview` reviewed inline)

For each `fix-claimed` thread, and for each thread whose anchor file is in the
interdiff:

1. Read the change: `git diff <reviewed.head_sha> <current.head_sha> -- <path>`
   when `relationship` is `same-base`. When it is `merge-of-base`, read the
   path in each commit of `commits` that touches it (`git show <sha> -- <path>`)
   and in each conflict resolution that lists it (`git show --cc <merge> --
   <path>`), because a plain diff includes the target branch's work. When it is
   `rebase`, read
   `git range-diff <reviewed.base_sha>..<reviewed.head_sha> <current.base_sha>..<current.head_sha>`.
2. Compare the change with the finding: the defect it names, and each item of
   its suggested fix.
3. Open every file, function, and line the new text names, and confirm that
   the claim is true. A fix can add a new wrong claim.
4. Give one verdict: `verified` (every item of the suggested fix is present and
   true), `partial` (some items are missing), or `not-fixed`.

Then check the renames:

1. For each entry in `interdiff.substitutions`, name the finding that asked
   for it. A derived name follows its finding: `row_class` to
   `value_object_class` follows `Row` to `ValueObject`.
2. Open each file in `leftover_in` and find the old name. Confirm that each
   hit is an unrelated use, not a missed call site. If `leftover_files` is
   more than 20, search the rest with `git grep -nw <old> <current.head_sha>`.
3. For each file with `renamed_from`, confirm that the new path still loads.
   For example, a Ruby constant name must match its file path.

A substitution, comment edit, or file move that no finding asked for goes
under **Needs your decision**.

### 5. Check each decline (`replies-only`, `verify-fixes`, and `rereview` routes)

For each `declined` thread that isn't `escalate:`, and each `partial` thread
that isn't `escalate:` and whose reply gives a reason for what it left out or
did differently:

1. Split the reply into its claims: what the code does, what the MR
   description says, what a test covers, what another call site does.
2. Check each claim against the evidence at `current.head_sha`. Open every
   file and line the reply cites, and every sentence of the live MR description
   it quotes (read it with `glab-read`, not from the facts file). Don't trust a
   quoted snippet or line number; read the line. A claim about something you
   can't open, such as a search outside the repo or a run the author didn't
   show, is unsupported.
3. Reread my finding. Confirm the reply covers what the finding asked, not only
   what its example showed: the other call sites, other inputs, the failure
   mode, each item of the suggested fix. Where the author took a different path,
   or one of several options the finding offered, the reasoning must show the
   finding's concern is handled.
4. Give one verdict: `verified` (every claim confirmed and the finding is
   covered) or `not-verified` (a claim fails, a claim is unsupported, or the
   finding goes unanswered). A judgement call about scope or priority isn't a
   failure by itself: when every claim checks out and the finding is answered,
   the decision is the author's and the verdict is `verified`.

A `verified` decline counts as a verified thread: it can be resolved under rule
5 and doesn't go under **Needs your decision**. A `partial` reply is `verified`
only if the part it took also passes step 4, so it can't be on `replies-only`,
where nothing changed. For a `not-verified` decline, say which claim failed and
what you read.

### 6. Report

Open with one line that answers what the person wants to know: whether the
MR is approvable, how many new findings there are, and how many threads can
be resolved. For example: "Approvable: every finding is fixed, 0 new findings,
all 6 threads can be resolved." While a dispatched re-review runs, say the
answer waits on it, and give the line again above the final table.

The MR is approvable when every thread of mine is resolved or resolvable on
go, **Needs your decision** is empty, no `escalate:` thread is open, and a
review of every `code` file ran, inline or dispatched, with no blocking
finding. A `rebase` or `unknown` relationship, or a `code` interdiff too big
to review inline with no skill to dispatch, is never approvable from this
pass. Say that a full review is needed.

Next, one **Status** line in plain words: how many threads the author
answered, how many commits they pushed (requested fixes and unrequested), and
whether the base moved.

Then, on every route (`rereview` included), print this table whenever
`commits` or `conflict_resolutions` is not empty:

**Changes since review**

| Commit or merge | Kind | Size | Maps to |
|---|---|---|---|

One row per entry of `commits` and of `conflict_resolutions`, in history
order, plus one row for what the target branch brought in (`main`, no size).
Kinds:

- `requested fix`: the commit addresses a finding, or my later note on its
  thread asked for it. `Maps to` names the thread and says whether the reply
  names the commit.
- `unrequested`: no thread asks for it. Say whether a reply names it. Compare
  its `committed_at` with the reply's `created_at` before saying it came after
  the reply.
- `conflict resolution`: edits inside a merge. List the files.
- `main`: the target branch's own commits and content.

`Size` is `+added/-removed` for a commit and `changed_lines` for a merge. Open
each commit's diff before filling its row. The table is where a reply's claims
meet real commits, and rule 6 covers the files.

Three judgments keep three names. `Verdict` is this skill's own: `verified`,
`partial`, `not-fixed`, or `not-verified`. `Re-review result` is the dispatched
subagent's: `addressed`, `partly addressed`, `not addressed`, or `not checked`.
`Resolved` is the thread's state on GitLab. Never write one where another
belongs.

Then give one row per thread:

| Thread | What I asked | Reply label and quote | What the new head has | Verdict | Action |
|---|---|---|---|---|---|

`Thread` names the thread and its anchor `file:line`, and marks an `escalate:`
thread. `What the new head has` says what the code or text at
`current.head_sha` does now, with `file:line`, such as "`validateApt` stats
/etc/apt, then runs access(2) on auth.conf.d (apt.go:88-100)".

On a dispatched `rereview`, leave out the Verdict and What the new head has
columns. This pass verifies no fix, and a cell that says so reads like a
result. The result comes in the second table.

On a `rereview` with a dispatch, print the two tables above in the message that
launches the subagent, and say the re-review is running. When it returns, print
a final table, one row per thread. It leaves out the reply and quote, which the
first table holds:

| Thread | Prefix | Re-review result | Evidence it cites |
|---|---|---|---|

Take the result from the subagent's fix-commit table. A `partly addressed` or
`not addressed` row names the finding that keeps the thread open ("partly
addressed, B1"). A thread this pass checked itself (a decline, step 5) shows
its own verdict and `(my check)`. A thread with no reply shows `no reply`, and
one that neither source covers shows `not checked`. `Evidence it cites` is what
was read for the row (`file:line`, a note), so the person sees how much it
rests on. Recount any total you state from this table's rows, not from the
subagent's prose.

With no dispatch and no inline review (a `rebase`, a `code` interdiff too big
to review inline, batch mode), print only the first table and say why under
it.

Write `resolve on go` in the Action column of each thread that rule 5 lets
the person ask to resolve (see the go line at the end of this step). On a
dispatched `rereview` the go line names the rows by their Re-review result
instead, so leave it out.

For `rereview`, run a delta review of the interdiff in an Opus subagent. Pick the
skill by the last path component of `origin`'s project (`git remote get-url
origin`):

| Project | Skill |
|---|---|
| `artifact-registry` | `/review-branch` |
| `registry-conformance` | `/review-branch` |
| `gitlab` | `/mr-review` |
| anything else | Review inline (below) when the Size column totals 400 changed lines or fewer; otherwise no dispatch, and say a review is needed. |

To review inline, which batch mode never does, work from `same-base` or
`merge-of-base` only. Run step 4 on every thread and fill its Verdict and
What the new head has. Check each `unrequested` commit against what its
subject and diff claim. Read each `code` file's residue for new defects, such
as a broken contract, an unhandled error, or new behavior with no test. Then
run the tests of the packages the interdiff touches at `current.head_sha`, in
`git worktree add --detach <scratchpad>/review-<iid> <current.head_sha>`, and
remove that worktree afterwards. The thread table holds the result, so print
no final table.

Both delta modes abort when `reviewed.head_sha` is not an ancestor of
`current.head_sha`, so when `relationship` is `rebase` or `unknown`, skip the
dispatch and tell the person to run a full review themselves. `/mr-review`
also aborts on any merge in the range, so a `merge-of-base` gets no dispatch
there either. `/review-branch` takes `merge-of-base`: its delta covers the own
commits and the conflict resolutions, never the target branch's content.

Otherwise make one `Agent` call with `model: "opus"`. For `/mr-review`, the
prompt is:

```plaintext
From <repo_root>, invoke the mr-review skill with `<iid> --delta
<reviewed.head_sha>` and follow it. Reply with the handover. Write nothing to
GitLab.

Start with these changed files and the lines that are neither a rename nor a
comment edit: <each `code` file and its `residue`>
```

For `/review-branch`, the prompt is, filled from the JSON:

```plaintext
Review the new head of GitLab MR !<iid> with the review-branch skill.

1. From <repo_root>, create a detached worktree at the new head:
   git worktree add --detach <scratchpad>/review-<iid> <current.head_sha>
2. Prefix every later Bash command with `cd <scratchpad>/review-<iid> &&`,
   because the working directory does not persist.
3. Invoke the review-branch skill with `--delta <reviewed.head_sha> --mr <iid>`
   and follow it. The facts file at <facts file path> holds my threads, with
   `earlier_notes`, for its prior-stance step.
4. Remove the worktree from <repo_root>:
   git worktree remove --force <scratchpad>/review-<iid>
5. Reply with the review in the skill's output format. Write nothing to GitLab.

Start with these changed files and the lines that are neither a rename nor a
comment edit: <each `code` file and its `residue`>

Own commits since the review: <each `commits` entry: sha, subject, files>
Conflict resolutions: <each `conflict_resolutions` entry with its files, or none>
```

Above the final table, give the subagent's verdict, and name the thread of
each blocking finding, one line each. Under the table, put one plain line
saying the re-review subagent's report follows, then its report unchanged,
as ordinary Markdown with its own headings, tables, and lists: not in a
blockquote or code fence, and no edits to its wording. The one exception:
leave off its closing `go` line and the "post the report" line under it. The
go line at the end of this reply takes over their parts, and a second `go`
would mean something else. Say that the re-review is this subagent, and how to run it by hand
from a checkout of `current.head_sha`: `/review-branch --delta <reviewed short
sha> --mr <iid>`, or `/mr-review <iid> --delta <reviewed short sha>` for
`gitlab`.

Whenever a review of the interdiff ran, inline or dispatched, print **New
findings** after the thread tables. Give the count, 0 included, then one line
per finding with its `file:line` and whether it blocks. On a dispatch, take
them from the subagent's report and recount. Then give one line per
`unrequested` commit saying whether it holds up and what you checked, such as
"`HostnameValidator` rejects `/` and `:` (login.go:490-497)". Give the test run
and its pass count when one ran. A pre-existing issue that doesn't block gets
one line, marked pre-existing.

On every route, when `interdiff.files` has a path under `docs/specs/`,
`docs/plans/`, or `docs/adr/`, close the report with the next step for the
person, ahead of the go line below. When `relationship` is `same-base`, it is `**Next:** /review-spec <iid> --delta
<reviewed.head_sha>`, with the short SHA. Print it and never run it: a spec
review is several Opus subagents, and the person decides whether the fixes
need one. A docs-only interdiff takes `verify-fixes`, which checks the fixes
against my findings and nothing else. Otherwise the base's
commits would read as fixes, so say to run a full `/review-spec <iid>`
instead.

List every `partial` (unless step 5 verified it), `question`, and `unclear`
reply under **Needs your decision**, with its quote. Add every `declined` reply
that isn't `verified`: `not-verified`, left to the re-review on a `rereview`
route, or on an `escalate:` thread.

End the reply with one go line. Like `/review-branch`'s, it names only the
parts that apply, in this order:

```plaintext
Say "go" to: resolve <N> threads, post the Post list, post the Elsewhere list, approve.
```

- **resolve <N> threads**: on `verify-fixes`, `replies-only`, and an inline
  `rereview`, the threads marked `resolve on go`. On a dispatched `rereview`,
  the rows whose Re-review result is `addressed` or `verified (my check)`. A
  `partly addressed`, `not addressed`, `not checked`, or `no reply` row, an
  `escalate:` thread, and a thread that an open blocking finding names never
  count.
- **post the Post list** and **post the Elsewhere list**: on a dispatched
  `rereview`, when the subagent's Post recommendation has them.
- **approve**: only when the MR is approvable (see the top of this step).

On a dispatched `rereview` with both `addressed` and `verified (my check)`
rows, add a line for the person who wants to check the subagent's rows
first:

```plaintext
Or say "go verified" to resolve only the <M> verified threads.
```

Above the go line, say that this pass has written nothing to GitLab. Nothing
follows the go lines. Print none when no part applies, on `nothing-to-do`,
and in batch mode, which ends with its own lines. When the person's request
already asked to resolve, resolve under rule 5 instead and report what was
resolved.

`go` does its parts in the line's order. It resolves each thread with the
`glab api` call under Batch mode and reads it back. It posts the lists the
way `/review-branch`'s Post recommendation says. Then it approves with
`glab api --method POST "projects/:id/merge_requests/<iid>/approve"` and reads
`merge_requests/<iid>/approvals` back to confirm you're in `approved_by`.

## Batch mode

`/review-batch` calls this skill once per MR, in a subagent. Its prompt names
a facts file, the clone, `Resolve: yes|no`, and a scratchpad. In batch mode:

- Step 1: read the facts file instead of running the script.
- Steps 4 and 5: `Resolve: yes` is the person's request that rule 5 asks for. Resolve
  each `verified` thread on the `verify-fixes` and `replies-only` routes with
  `glab api --method PUT "projects/:id/merge_requests/<iid>/discussions/<discussion_id>" -f resolved=true`,
  then read the thread back and confirm it is resolved. With `Resolve: no`,
  resolve nothing.
- Step 6: make no `Agent` call. For `rereview`, when a dispatch applies, write
  the filled prompt to `<scratchpad>/dispatch-<iid>.md` instead.

End the reply with these lines, and write nothing after them:

```plaintext
OUTCOME: approve | needs-you | rereview | waiting
DISPATCH: <prompt path> <skill>
```

- `approve`: no thread of mine is left open once the `verified` threads, fixes
  and declines alike, are resolved (counting those a `Resolve: no` run leaves
  open), and **Needs your decision** is empty. A `verified` decline doesn't
  block this.
- `needs-you`: **Needs your decision** is not empty, or a verdict is `partial`,
  `not-fixed`, or `not-verified`.
- `waiting`: the only open threads are `no-reply`; the author owes the next
  move.
- `rereview`: the route is `rereview`. Add the `DISPATCH` line only when a
  dispatch applies; otherwise omit it (never write `DISPATCH: none`) and say
  why in the report.
