pr-review
Have a finished pull request reviewed in a fresh thread - one review thread per pull request reads its diff itself, judges what it found, and proves the one safety fact by running code (pstack's review, with no reviewer subagents and no fixes), and records the findings in the brief, where jbus reads them and tells the thread that did the work when it owes a line. Use when the user invokes /pr-review or $pr-review in a home or in a crewmate's thread, or asks to review the pull requests that have finished.
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- tip
- has a finished pull request reviewed in a fresh thread | review the pull request | review the pull requests | review the pr | review this pr | review my pr
- card
- Run the pipeline | 4 | Starts one review thread per pull request. It reads the diff itself, judges what it found, and one command proves the fact the change is safe because of. It fixes nothing, and jbus archives it when the pull request merges or closes. | Reach for it when a pull request opens. The crewmate does this by itself. | model: a crewmate; op: the operator | look: rev
- name
- pr-review
- description
- Have a finished pull request reviewed in a fresh thread - one review thread per pull request reads its diff itself, judges what it found, and proves the one safety fact by running code (pstack's review, with no reviewer subagents and no fixes), and records the findings in the brief, where jbus reads them and tells the thread that did the work when it owes a line. Use when the user invokes /pr-review or $pr-review in a home or in a crewmate's thread, or asks to review the pull requests that have finished.
- user-invocable
- true
- disable-model-invocation
- true
02 资源文件 14
- 参考文档a-scoped-pass.md9.2 KB
- 参考文档after-the-review.md4.5 KB
- 参考文档feature.json187 B
- 参考文档launching.md14.8 KB
- 参考文档outside-the-diff.md2.7 KB
- 参考文档templates/pr-body.md675 B
- 参考文档templates/review.md1.9 KB
- 脚本tests/test_meets_line.py2.9 KB
- 脚本tests/test_pr_review_skill.py61.0 KB
- 脚本tests/test_review_references.py1.3 KB
- 脚本tests/test_reviewer_stop.py1.6 KB
- 脚本tests/test_scoped_review.py7.6 KB
- 参考文档the-review.md26.9 KB
- 参考文档verify.md797 B
03 SKILL.md 正文
pr-review
This is the reviewer's text: a thread started with /pr-review run <slug>, which only a launcher sends, reviews that brief's pull request, as "The reviewer" says.
Any other message makes this thread a launcher.
R=$(basename "$(dirname "$(git rev-parse --path-format=absolute --git-common-dir)")")
H=~/.local/state/home/$R
T=$(realpath ~/.claude/skills/pr-review/../../templates)
$T is the templates/ directory of the repo this skill lives in. Each template there is the one copy of its text: read it when a step names it, not before.
Launching
When this thread launches a reviewer, for /pr-review in a home or a crewmate's thread, /pr-review <slug>, or the crew skill's launch: read $T/../skills/pr-review/launching.md now.
The reviewer
This thread is a reviewer. It reads the diff, judges what it found, proves one fact, reports, and ends. It starts no subagent and no other thread: the review is this one thread. It never edits a file, commits, pushes, or changes the pull request, and it never reads the crewmate's thread.
A reviewer runs no test step and no suite, whatever the brief says.
The tests are the crewmate's desk proof, its Checked: and Proved: lines, which bind the head before jbus launches a reviewer (jbus.prereview), and CI's check, which runs on the pull request the crewmate opens after the review.
The one thing a reviewer runs is a targeted proof of the fact the change is safe because of ("The review", step 5).
New prose is one sentence per line, and an old line the pull request did not touch is no finding for how many sentences it holds.
Start
-
Read
$H/tasks/<slug>.md. Nothing else from$H, but for what the blocks under "After the review" read by themselves. Then work out who this reviewer is, and then whether this message may start a review.Who this reviewer is goes on the section's
By:line, under its heading: the provider, the model and the effort this thread runs on, and its number,#<n>. Ask the thread itself: thet3-codeserver'st3_thread_configurewith no arguments (if your harness defers it, load it first). Run this with the block at the top, with what it printed, whole, and the message this thread was started with in place of the words in angle brackets. Keep what it prints, theBy:line:asked='<the message this thread was started with, whole>' config='<what t3_thread_configure printed, or nothing where this session has no such tool>' case $config in "<"*) config= ;; esac n=$(printf '%s\n' "$asked" | awk 'NR == 1 {print ($(4) ~ /^[0-9]+$/ ? $(4) : 1)}') by=$(printf '%s' "$config" | jq -r '.modelSelection | [(.provider // .instanceId), .model, (.options[]? | select(.id | test("effort$"; "i")) | .value)] | join(" ")' 2> /dev/null) if [ -z "$by" ]; then by=$(uv run --project "$T/../source" jroles review 2> /dev/null | sed -n "${n}p" | jq -r '[.provider, .model, (.options[]? | select(.id | test("effort$"; "i")) | .value)] | join(" ")' 2> /dev/null) fi echo "By: ${by:-inherit} #$n"The number is the message's, the line of the role map's review list this reviewer was launched for, and 1 for a message with none: a scoped pass and a second pass are the first line's. So the two reviewers of one pull request have two
By:lines, also on one model:By: claudeAgent claude-sonnet-5-5 high #1andBy: claudeAgent claude-sonnet-5-5 high #2, andjmergecounts them by the number. Then decide whether this message may start a review, with this, with the same message and thatBy:line in place of the words in angle brackets:B="$H/tasks/<slug>.md" asked='<the message this thread was started with, whole>' by='<the By: line the block above printed>' case $asked in "/pr-review run <slug> scoped "*) echo "go: a scoped pass, as \"A scoped pass\" says" ;; *" again") echo "go: a second pass, or the review the brief is still owed, the message ends in again" ;; "/pr-review run <slug> "[0-9]*) if awk -v by="$by" '/^## / {review = ($(0) == "## Review")} review && $(0) == by {found = 1} END {exit !found}' "$B"; then echo "stop: the brief has a ## Review with $by, and a reviewer writes one section for its line" echo "the line I accept: /pr-review run <slug> again" sed 's|{slug}|<slug>|g' "$T/rerun.md" else echo "go: the brief has no ## Review with $by, so this is that line's review" fi ;; *) if ! command grep -qx '## Review' "$B"; then echo "go: the brief has no ## Review, so this is the review it is owed" else echo "stop: the brief has a ## Review and the message does not end in again" echo "the line I accept: /pr-review run <slug> again" sed 's|{slug}|<slug>|g' "$T/rerun.md" fi ;; esacOn
stop, say what it printed, the line it would accept included, and end: no review, no section. Ongo, go on. -
Find the change under review: the branch this worktree is on, at the head origin has, over its base. The review comes before the pull request, so there may be none yet: the change is read from git, never from GitHub. Run this with the block at the top:
B="$H/tasks/<slug>.md" branch=$(git branch --show-current) on=$(uv run --project "$T/../source" jbriefs line base "$B") [ "$on" != none ] || on= [ -n "$on" ] || on=$(git symbolic-ref -q --short refs/remotes/origin/HEAD | sed 's|^origin/||') on=${on:-main} if [ -z "$branch" ] || ! git fetch -q origin "$branch" "$on"; then echo "stop: could not fetch origin's $branch and $on, this worktree is at $(git rev-parse HEAD)" elif [ -n "$(git status --porcelain)" ] || [ "$(git rev-parse HEAD)" != "$(git rev-parse "origin/$branch")" ]; then echo "stop: this worktree is not at origin's $branch, $(git rev-parse "origin/$branch"), with nothing uncommitted" else echo "head $(git rev-parse HEAD) base $(git merge-base "origin/$on" HEAD) on $on" fiOn
stop, say what it printed, write the section "A stop" says, and end: no review. Otherwise keep the head and the base it printed: the head is the head under review, and wherever this skill reads the diff it isgit diff --no-color <the base> <the head>. The diff is read in step 3 of "The review". Open a file only to judge a finding, or to find and prove the safety fact. -
Read the brief's last Result: its
Checked:andProved:lines name the head under review, or a head whose patch it carries, since jbus launched this review on them. -
Say in two lines what is about to be reviewed, then start.
A stop
A reviewer that Start's step 1 let begin and that stops all the same, on step 2 of Start or on step 1 of "A scoped pass", writes a ## Review that says so.
Its launch put a reviewer line under the Result, so jbus and the crew read the brief as reviewing (jbriefs line reviewing) until a section with a Head: line follows it, and the crew rebases nothing while it reads so: a stop with no section holds the pull request until somebody notices.
Run this with the block at the top, with the head the review was to be of, the stop line the step printed and the By: line Start printed in place of the words in angle brackets.
The head is, on step 2 of Start, the commit its stop line names, and on step 1 of "A scoped pass", the end of the message's new range.
For a scoped pass, scope is Scope: range-diff <old range> <new range>, with the message's two ranges, and for any other pass it is left empty:
B="$H/tasks/<slug>.md"
head='<the head the review was to be of>'
said='<the stop line the step printed>'
by='<the By: line Start printed>'
scope=''
case $by in "<"*) by= ;; esac
case $scope in "<"*) scope= ;; esac
uv run --project "$T/../source" jbriefs not-run "$B" "$head" "the reviewer stopped before its review: $said" "$by" "$scope"
A stop of step 2 that could not fetch names this worktree's commit, since it could ask origin for none, and writes its section at that commit all the same.
The section is the one "No room" writes, read the same way: jmerge merges nothing on it, its Head: line lets the crew rebase, and jbus's stall clock asks this reviewer again.
Sent a second time for the same head, it writes no second section.
Then say what the step and the block printed, and end without settling.
The review
When "Start" is done, and whenever a step names "The review" or one of its steps: read $T/../skills/pr-review/the-review.md now.
No room
A reviewer that gives up says so in the brief, so that the pull request never waits for a review nobody is going to run. It gives up only on exit 69 of the block of step 1, which is its sixth send that did not go on. It sends nobody anything.
-
Write the section. Run this with the block at the top, with the head kept at the start, the last line the block of step 1 printed and the
By:line Start printed in place of the words in angle brackets. For a scoped pass,scopeis theScope:line step 1 of "A scoped pass" printed, and for any other pass it is left empty:B="$H/tasks/<slug>.md" kept='<the head kept at the start>' why='<the last line the block of step 1 printed>' by='<the By: line Start printed>' scope='' case $by in "<"*) by= ;; esac case $scope in "<"*) scope= ;; esac uv run --project "$T/../source" jbriefs not-run "$B" "$kept" "the run block was sent six times and never went on, and its last answer was \"$why\"" "$by" "$scope"The section is not a review:
jmergereads it as a review with no verdict and merges nothing on it. ItsBy:line says whose it is, so that this reviewer's section at the same head, once it runs again, takes its place, and another reviewer's does not. ItsScope:line, on a scoped pass, keeps it a scoped pass: a scoped section takes the place of no section but a scoped one, so the first review of the same head keeps its findings. ItsHead:line is what lets the crewmate's thread rebase again (the crew skill, "A conflict"). jbus's stall clock (jbus.clock) reads a review with no verdict as a wait on the review: it asks this reviewer again, with/pr-review run <slug> again, and then tells the home. Sent a second time for the same head, the block writes no second section. -
Say the same in this thread in two lines, and stop without settling: a thread that settled would look like a review that was done.
After the review
When the review has its verdict, and whenever a step names "After the review" or one of its steps, as "No room", "Outside the diff" and "A scoped pass" do: read $T/../skills/pr-review/after-the-review.md now.
Outside the diff
When step 2 of "After the review" drops what is outside the diff, and whenever a step names "Outside the diff": read $T/../skills/pr-review/outside-the-diff.md now.
Wider than the brief
uv run --project "$T/../source" jmerge --scope <slug>
It compares the diff with the brief's Where:: it asks jmerge which changed files that line does not cover, with the one parser of that line (jbriefs.parse.where), and prints nothing when all are inside.
What it prints goes on the section's Outside Where: line, each outside: <path> as its path, joined with , , or none when it printed nothing.
That line is no finding: it carries no severity, asks the crewmate for no line, and holds no merge, since the command, not the reader, is the check, and anyone can run it again.
So no finding restates it, and a finding of the reading that says only that a file is outside Where is dismissed (the lead judgment of "The review").
Do not judge the width by reading the diff: the command's answer is the answer.
A command that exits with something other than 0 (the brief's Where: names no path, or neither the branch nor the pull request can be read) printed why on stderr: the line is then Outside Where: not checked, <why>, not none.
A finding can be wider than the brief in a second way: it is about a changed line, and what it asks for is not in the brief's Where.
That happens with the fifth question's things to look for (a restructuring, a file to split, a branch to move into a module of its own, a wrapper to remove, logic to move to its canonical layer), when the remedy would change a file outside Where.
The SCOPE text asks the reading to say so in the finding.
Such a finding is kept, sent and recorded like any other, with these words at the end of its line: outside Where, not this pull request.
It asks the crewmate for no fix: the crewmate queues it as a row of its own, as templates/a-fault-outside.md says, or leaves it.
A finding whose remedy stays inside Where is an ordinary finding.
In flight
BRIEF="$H/tasks/<slug>.md"
FILES=$(git diff --name-only '<the base>' '<the head>') || exit 1
PR=$(printf '%s\n' "$FILES" | jq -R 'select(. != "")' | jq -s --arg branch "$(git branch --show-current)" '{branch: $branch, files: map({path: .})}') || exit 1
OPEN=$(gh pr list --state open --json number,title,files,headRefName) || exit 1
printf '%s\n' "$OPEN" | jq -r --argjson pr "$PR" '
($pr.files | map(.path)) as $mine
| .[] | select(.headRefName != $pr.branch)
| (.files | map(.path) | map(select(IN($mine[])))) as $both
| select($both | length > 0)
| "pull request \(.number) (\(.title)): \($both | join(", "))"'
lines=$(uv run --project "$T/../source" jbriefs line pr,path "$H"/tasks/*.md 2> /dev/null)
for other in "$H"/tasks/*.md; do
[ "$other" = "$BRIEF" ] && continue
if command grep -q '^## Result' "$other"; then
printf '%s\n' "$lines" | command grep -qxF "$(printf 'after the review\t%s' "$other")" || continue
fi
where=$(sed -n 's/^Where: //p' "$other" | command grep -o '`[^`]*`' | tr -d '`' | tr '\n' ' ')
both=$(printf '%s\n' "$PR" | jq -r '.files[].path' | awk -v where="$where" '
BEGIN { n = split(where, w, " "); for (i = 1; i <= n; i++) sub(/\/$/, "", w[i]) }
{ for (i = 1; i <= n; i++) if ($(0) == w[i] || index($(0), w[i] "/") == 1) { print; next } }' |
paste -sd, - | sed 's/,/, /g')
if [ -n "$both" ]; then echo "brief $(basename "$other" .md): $both"; fi
done
It prints one line for each open pull request that changes a file this one changes, and one for each brief with no pull request yet whose Where: covers a file this one changes: a brief with no Result, or one whose last Result says its pull request opens after its review.
Those lines go into the section's In flight: line, as they are.
They say that two pieces of work touch the same file, so that whoever merges second knows: they are not a fault in this pull request and carry no severity.
Do not open the other pull requests or briefs to look further.
A failed git diff or gh ends the block with exit code 1, and then the section's In flight: line says "not checked", not "none".
A scoped pass
When this thread was started with /pr-review run <slug> scoped <old range> <new range>, and whenever a step names "A scoped pass": read $T/../skills/pr-review/a-scoped-pass.md now.
04 同仓库更多 Skills
no-key
A skill its skills.json lists as hidden that a model may still call by itself, kept broken so the lint is seen to catch it.
fake-skill
A FAKE skill in a FAKE tree, named for its folder until the test renames the folder.
extra-key
A skill its skills.json does not list as hidden that a model still cannot call, kept broken so the lint is seen to catch it.
unslop
Cut AI tells from writing. Use when the user says text reads like AI, asks to unslop it, or before prose ships to people.
technical-writing
Write or review docs, READMEs, RFCs, PR descriptions and commit messages to a layered standard: Diataxis structure, Google developer style, STE rules and Global English.
why
Find why code is the way it is, from its history and every evidence source this session can query, with citations. Use for 'why does X work this way', 'why did we pick Y', regressions and postmortems. Use how for runtime behavior.