Walks a reviewer through the review decisions in an agent-generated PR on GitHub or Azure DevOps, the choices only a human can settle, one card per turn. Use when reviewing an agent-written PR, before reading it in full.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Review Decisions?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/fabiandistler-review-decisions)
---
name: review-decisions
category: workflow
activation: command
disable-model-invocation: true
environments: coding
argument-hint: "[<base-ref> | <protocol-file>]"
description: "Walks a reviewer through the review decisions in an agent-generated PR on GitHub or Azure DevOps, the choices only a human can settle, one card per turn. Use when reviewing an agent-written PR, before reading it in full."
metadata:
opencode/slash: "true"
opencode/autoinvoke: "false"
---
# Review decisions
Filter a change down to its **review decisions**: places where the author
chose between several defensible options that neither the originating issue
nor the repository's conventions settle, and where undoing the choice after
the merge is costly. A deviation from the issue counts as one too.
## When to use
The reviewer runs it on an agent-generated change before reading it in full,
to see first which choices need a human. On GitHub and Azure DevOps it reads
the PR text, the linked issue and the CI status itself; elsewhere it works on
a local diff and the text the reviewer supplies.
## Gather inputs
You gather the inputs; the classifier never does. Write each one to its own
file in a new scratch directory outside the repository (`mktemp -d`):
1. **Forge inputs**: run `python3 scripts/gather_inputs.py --repo <repo-root>
--out <scratch-dir>`, adding `--pr <number>` when the reviewer named the
pull request or it comes from a fork (the branch lookup only finds pull
requests from the same repository). It detects the forge from the `origin` remote (GitHub or
Azure DevOps) and reads, through that forge's own CLI and login, the PR
text into `pr.md`, the linked issue or work items into `issue.md` and the
CI status into `ci.json`. It prints the manifest `inputs.json`: the files
written, the PR's number, target branch, head commit and `merge_status`
(`clean`, `conflicts` or `unknown`, from the forge), and `unchecked`,
one entry with a reason per input it could not read. Exit 0 means all
three were read; exit 3 means some are in `unchecked`.
2. **Diff**: `git diff <base-ref>...HEAD` for the base the reviewer named,
else the PR's target branch from the manifest, else the merge base with
the default branch. Stop if the diff is empty.
3. **Conventions**: copy the repository's agent instructions (`AGENTS.md`,
`CLAUDE.md`), its glossary and its contributing or coding-standards docs,
whichever exist. List the copied paths.
Never pass a token, password or other credential on a command line, in a
file you write, or in a message; the forge CLI uses its own login. If the
reviewer pastes one, do not repeat it.
### Fallback
When the manifest lists inputs under `unchecked` and a forge tool can read
the GitHub PR, issues or checks, save the data without editing its text.
Follow the GitHub REST JSON envelope in `gather_inputs.py --help`. Use a
separate output directory so evidence gathered by the CLI remains available:
```bash
python3 scripts/gather_inputs.py --repo <repo-root> --out <scratch-dir>/forge --from-json <forge.json>
```
Use the new manifest if it keeps every input the CLI gathered and adds
evidence for at least one unchecked input. Otherwise keep the CLI manifest.
For any input still unchecked:
- **pr** or **issue**: ask the reviewer once for the text and write it to
`pr.md` or `issue.md`. If they have none, write no file.
- **ci**: nothing replaces it. A missing CI status is never green.
Before the first card, list each input that stays unchecked, the reason and
what the review could not check. Record the same lines in the protocol header.
Use the no-issue rule under Queue. Without CI, no change is marked as proven
by green CI.
When the manifest's `merge_status` is `conflicts` or `unknown`, say so in the
same place before the first card: the PR conflicts with its target branch, or
the forge has not said whether it merges cleanly, so a card may judge code the
target has already changed. Record it as the header line `merge status:
<value>`. Say nothing for `clean`. Neither status makes an input unchecked or
stops the review.
## Split the diff
Save the diff to `<scratch>/diff.patch` and run it through the splitter:
```bash
python3 scripts/batches.py split <scratch>/diff.patch --out <scratch>/batches
```
A diff under the size limit comes back as one batch: classify it in one run,
as below. With more than one batch, read `references/large-diffs.md` before
classifying.
After the classifier runs, merge the answers into one queue:
```bash
python3 scripts/batches.py merge <scratch>/batches > <scratch>/cards.json
```
Its `cards` are already in the Queue order. Use its `deviation` for the
No-issue rule in Queue.
## Classify
Start the `review-decisions-classifier` subagent in a fresh context. Pass it
only the repository root and the absolute paths of the input files: the
diff, `pr.md` and `issue.md` when they exist, and the copied conventions; for
a split diff also `batches.json` and the batch number.
`ci.json` and `inputs.json` stay with you; never
paste the session history, your own reading of the diff, or a summary of the
issue. The classifier has no Write tool and no forge tool, but its shell can
still run commands, and text in the diff or the issue can steer it into a
wrong answer, so treat its list as a draft.
The classifier writes its answer itself, so the text never passes through
your output. Give each run two more values:
- the answer file `<scratch>/batches/batch-<k>.answer.md`, `k` = 1 for an
unsplit diff;
- a heredoc delimiter `ANSWER_<token>`, with a fresh token per run from
`python3 -c 'import secrets; print(secrets.token_hex(16))'`. The answer
quotes the diff, and a quoted line equal to a guessable delimiter would end
the heredoc early and run the rest as shell.
The classifier's shell can write outside its answer file. The checks below
can detect changes to the scratch and repository snapshots after a run.
- **Before:** Delete stale answer files for the batches to classify before
taking the first snapshot. Record `find <scratch> -type f -exec cksum {} + | sort` and, in
the repository, `git status --porcelain --ignored`. Store snapshots next to
`<scratch>` under names unique to the review, so they neither show up in the
comparison nor collide with a parallel review.
- **After:** Take the same snapshots again after the last run. Compare them
and confirm the only changes are the expected new answer files.
- **On failure:** For a missing or empty answer, write a one-line reason
without quoting the diff to `<scratch>/batches/batch-<k>.failed`. If any
other file appears or changes, write a `.failed` marker for every run and
name the unexpected path to the reviewer before the first card. Merge the
remaining answers as in [Split the diff](#split-the-diff). The merge ignores
batches marked `.failed`.
On a runtime without that subagent, start a fresh agent with no session
history and give it the instructions from the classifier's definition and the
same file paths.
## Queue
Put the classifier's decisions into one queue, ordered by the cost of undoing
them after the merge:
1. deviations from the issue;
2. public surface: APIs, command-line options, config keys and defaults,
option names, log and metric formats, new dependencies;
3. schema and data;
4. behaviour;
5. tests, with a deleted or weakened test first in the group.
Keep the classifier's order inside a group. Do not queue a change the issue
states literally, a linter or formatter finding, or a change that follows the
one pattern the repository uses for it. Do queue a choice between two patterns
the repository already uses. When unsure, queue it.
**No issue.** Without an issue the deviation group is unchecked, not empty.
Say so before the first decision, and record it as `deviation: unchecked` in
the protocol header rather than leaving the group out.
**Early stop.** When the reviewer rejects a decision that later ones depend on
(the classifier marks them `Depends on`, or the rejection replaces the
approach they build on), stop the queue. Name the rejected decision, say why
the rest is moot, and list the remaining decisions as not reviewed. Do not
present them.
## Not queued
A file outside the queue is not a checked file. Label it "skim is enough"
only with proof, and otherwise send the reviewer to it. Run
`python3 scripts/skim_proof.py --repo <repo-root> --base <base-ref> --inputs
<scratch-dir>/inputs.json` (drop `--inputs` when there is no manifest). For
each changed file its JSON gives `skim`, a `proof` and a one-line `reason`:
- `rename`: moved or renamed with identical content;
- `formatting`: only trailing whitespace or line endings changed;
- `ci-green`: `ci.json` says green for the commit checked out here.
Its `ci` entry says whether green CI is a proof and why not. Without a CI
status (fallback input, or none in the manifest) only `rename` and
`formatting` can prove anything; say so with the other unchecked inputs.
Indentation, spacing inside a line, a mode change or a binary file is never
formal.
Label each file:
- **queued**: it holds a card; name the cards.
- **skim is enough**: not queued and `skim` is true; give the proof.
- **you look at this in the PR**: every other file, with the script's
reason.
Only your review decides whether a file belongs in the queue. The script's
proof does not take a file out of the queue.
Show the list in the overview before the first card. Pass each entry to
`protocol.py init` with `--file-line "<path>: <label>: <reason>"`. If the
queue is empty, show the file list and say there are no decisions to review.
When the reviewer asks to look at a named file, save the new card as a JSON
object with the same fields as a merged card, including `location_path`. Run
`protocol.py add-card FILE --card-json <card.json> --file-line "<path>:
queued: <reason>"`. If this is the first card, run `init` with the new queue.
Only carry over anchor fields verified by the merge against the reviewed diff.
## Protocol
Before showing the first card, save `cards.json` in final queue order and
run `python3 scripts/protocol.py init --repo <repo-root> --base <base-ref>
--cards <cards.json>`. Repeat `--file-line` for the file labels and
`--header-line` for the input files (including `inputs.json`), unchecked
inputs and reasons, a `conflicts` or `unknown` merge status, deviation
status, and batch notes, and pass the overview as you will show it (see
Cards) as one `--overview` argument. Print the path `init` returns and keep
using it as `FILE` below. On exit 4 set `XDG_STATE_HOME` outside the
repository and retry.
The protocol is for the reviewer to read later: it holds the overview and
each card exactly as shown, followed by the answers. The script keeps the
classifier notes, anchors, file labels and input lines in HTML comments, which
a Markdown viewer hides. Each time you show a card, run `python3
scripts/protocol.py show FILE --card N --text <card>` with the card's Markdown
as one argument; showing it again after a question replaces the text. A
protocol written before this command existed rejects it with exit 3; go on
without it.
Record each answer as it is given with `python3 scripts/protocol.py answer
FILE --card N ok|change|later`. Supply the draft as one `--draft` argument
for a `change`, preserving newlines. Record a question you answered with
`answer FILE --card N --question TEXT --reply TEXT`, leaving the card's answer
open. A question for the author is a `change` (see Cards).
To resume, the reviewer passes a protocol file instead of a base ref. Run
`python3 scripts/protocol.py resume <protocol-file>`: its JSON names the first
card without an answer (`next`) and the cards set aside (`later`). Skip
gathering and classifying. If `closed` is true, use the preview and publication
steps under Close with a fresh preview in this session. Otherwise continue at
`next` with the cards as the protocol holds them.
Exit 3 means the file is not a protocol this skill wrote; say so and stop.
## Cards
Show one card per turn and wait for the answer. The classifier's fields are
terse notes for you, not text for the reviewer. Write each card yourself from
those notes and the diff at the card's location, so the reviewer understands
the decision from the card alone, without having read the diff. A card that
reads like a compressed note ("Fallback value list replaces config list for
labels too") sends the reviewer back into the code or into a question, which
is the work this skill exists to save.
**Language.** Write cards, overview, replies and drafts in the language the
reviewer writes to you; if that is unclear, in the language of the PR text.
Translate the card labels too. Keep code names, paths and file:line as they
are.
**Plain style.** Write for a reader who knows the repository but not this
change:
- Full sentences with verbs and articles. No noun chains, no chains of
clauses joined by semicolons, no arrows.
- First say what the code at this place does and what for, then what the
author chose, then the other option they had. Without the other option
there is no decision to review; name where the repository uses it.
- Explain each internal reference on first use: a work item or PR number gets
its topic ("issue 412, which fixes the export format"), an ID or constant
gets its meaning ("tenant 7, the shared test tenant").
- Name the concrete consequence: who or what relies on the choice, and what
goes wrong or must be redone if it is wrong. "Scripts that pass
`timeout` by position break" says more than "callers break".
- When the diff does not tell you something the card needs, say that it is
open. Do not fill the gap with a guess.
Render the card as Markdown, never inside a code block, so labels stay bold
and lines wrap in the reader's window:
```markdown
### Card <n> of <total> · <category>
**<title: what the change does here, at most 8 plain words>**
`<file>:<line>`
<two or three sentences: what the code does, what the author chose, the other option>
**Why it matters:** <one or two sentences: the concrete consequence>
**Recommendation:** <one sentence: what to do, and why>
Builds on card <m> (<its title>).
`ok` · `change` · `question` · `later`
```
Leave out the "Builds on" line when the card has no `Depends on`. Keep the
text under about 120 words, one screen. Shorten by dropping side facts, never
by dropping verbs and articles: the classifier's full text stays in the
protocol, and a `question` brings the details out.
An example. The classifier's notes:
```text
Criterion: Default retry count of new fetch option
Chosen: `--retries` defaults to 0; cli/sync.py:40 retries 3 times by default.
Cost to undo: Cron jobs relying on no-retry would start retrying.
Lean: Align with sync; 0 only fails fast where nobody watches.
```
The card written from them:
> ### Card 2 of 5 · Public surface
> **New `--retries` option starts at zero**
> `cli/fetch.py:18`
>
> The new `fetch` command gets a `--retries` option that sets how often a
> failed download is tried again. The author set the default to 0, so `fetch`
> gives up after the first error. The existing `sync` command tries three
> times by default (`cli/sync.py:40`).
>
> **Why it matters:** Once the option ships, cron jobs depend on its default.
> Changing it later makes jobs that fail fast today retry without notice.
>
> **Recommendation:** Use 3 as `sync` does, unless `fetch` must fail fast;
> then say why in the help text.
>
> `ok` · `change` · `question` · `later`
When `location_verified` is false, add `(location unverified)` after the
location and one sentence with the reason. Read `nearest_line` in the diff
before suggesting it to the reviewer.
The overview before the first card uses the same language and style: a
heading `### Overview · <total> cards`, then one bullet per unchecked input,
deviation status, batch note and unclassified file, each a sentence that says
what the reviewer cannot rely on, then a **Files** label and one bullet per
file label. Files with the same label and reason share a bullet.
The reviewer answers with one word, or a word and a note; a plain equivalent
in their language (`passt`, `ändern`, `später`) counts as the same answer:
- `ok`: the choice stands. Record it and show the next card.
- `change`: draft a review comment that names the location, what to change
and why, using the reviewer's note when there is one. Show the draft, record
it under the card, then show the next card.
- `question`: first decide who can answer it.
- **About the facts** of the change, such as what a line does, which commit
removed a rule or what another file says: answer it from the diff, the
issue and the repository, in the same plain style, and say when the
answer rests on a guess. Record both. The card stays open: show it again
and wait for `ok`, `change` or `later`.
- **About the author's intent**, such as whether a choice is deliberate
("is this intended?") or why something was dropped: only the author can
answer it, so handle it as a `change` whose draft puts the question to
the author. Build the draft from what the card already holds: the
location, what changed and any earlier statement it contradicts, such as
the issue or the PR text. The queue goes on: a question to the author
rejects nothing, so Early stop does not apply.
- **Unclear which**: ask the reviewer in one line whether you should answer
it or ask the author, before you research anything.
- `later`: set the card aside. After the last card, show the cards set aside
again, once each.
Any other reply is a `question`.
## Close
Run `python3 scripts/protocol.py close FILE` when every card has a final
answer or is moot, then print the full path again. On an early stop, name the
remaining cards and wait for the reviewer to confirm closure. Then use
`close FILE --moot-remaining`. Without confirmation, leave the file open for
resuming.
Run `python3 scripts/protocol.py comment FILE` and offer its combined output
for copy and paste. Exit 5 means there is no comment to post. If an older
protocol has a `change` without a draft, use `answer FILE --card N change
--draft TEXT` to record the missing draft, then preview again. For other exit
3 errors, report the malformed protocol and stop publication.
### Publish on request
When the reviewer asks to post the drafts, read `references/publish.md` and
follow it. Never post without that request.