/review-toolkit:branch-review [path] [--target branch] [--nitpick] [--type go|node|python|rust|kernel] [--exclude pattern,pattern] [--ticket URL|ID] [--round1-head sha]from review-toolkit
Reviews current branch changes in isolation using git merge-base attribution. Outputs an LGTM verdict based only on defects the diff introduces, with pre-existing issues reported separately.
Ships in review-toolkit. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Important: If the current directory is not a git repository, ask the user where the target repository is located before proceeding.
CRITICAL: Do not switch branches in the user's repo. If the active branch is the one to review, analyze it in place using git diff, git log, git show. If the active branch is NOT the target (for example when the active branch is master/main while the target is a feature branch), create a temporary git worktree pinned to the target branch and run all analysis there:
WORKTREE_DIR=$(mktemp -d -t branch-review-XXXX)
trap 'git worktree remove --force "$WORKTREE_DIR" 2>/dev/null' EXIT INT TERM
git worktree add "$WORKTREE_DIR" <target-branch>
# All git operations use: git -C "$WORKTREE_DIR" diff/log/show ...
# All file reads are relative to "$WORKTREE_DIR"
# The trap above removes the worktree on every exit path (success, error, interrupt)
Rationale: switching branches in the user's main repo would clobber their working state. A worktree gives an isolated checkout of the target branch without disturbing the active one. The "stay on the active branch" intent is preserved — the active branch is never touched.
Parse $ARGUMENTS for:
~/git/github.com/org/repo or ../my-worktree). If provided, ALL git and file operations must run inside this directory--target the branch this PR is merging INTO (e.g. next, develop, main). This is the most important parameter for determining the correct diff scope--nitpick flag for pedantic mode--type project type (e.g. go, node, python, rust, kernel) — skips auto-detection. kernel means a patch series bound for a kernel mailing list: the unit of review is each commit over the base, and the "Kernel patch series" criteria below apply--exclude additional exclude patterns, comma-separated (e.g. docs/,*.gen.go)--ticket ticket reference — URL (GitHub issue, Jira, Linear, Notion, etc.) or ID (e.g. #123, PROJ-456). When provided, the review includes a Ticket Compliance section that validates whether the changes fulfil the ticket requirements--round1-head the head SHA the FIRST review round of this gate ran on — copy it from that round's output header (the Reviewed <branch> at <sha> line). Used only to compute finding-origin labels (feature vs churn, see "Finding origin and the churn mark"); it never affects severity or the verdict, so it is an auditable record of a past run, not a scope declaration. Omit on the first round; every later round passes this same SHA. The previous round's SHA instead measures origin against that round, not round 1: lines the gate added in earlier rounds count as feature, and the convergence rule sees only the last round's churnExamples:
/review-branch → auto-detect everything in current directory/review-branch ~/git/github.com/org/repo → review in that directory/review-branch --target next → review changes going into next/review-branch --nitpick → pedantic mode/review-branch --type go --exclude "api/generated/" → Go project, extra excludes/review-branch --ticket https://github.com/org/repo/issues/42 → validate against GitHub issue/review-branch --ticket PROJ-456 → validate against ticket ID (fetched via appropriate tool)/review-branch ~/worktrees/feature --target develop --nitpick --type node → all combined/review-branch --target main --ticket #123 --nitpick → target main, validate against ticket, pedantic mode/review-branch --target main --round1-head 1a2b3c4 → re-review round with churn diagnosticsIf a path argument was provided, use it as the working directory for ALL git and file operations throughout the review. Pass -C <path> to every git command, and use the path as the base for all file reads. When a path is provided, assume the user has pointed at the right tree — do not create a worktree even if the active branch differs from the target.
First, record the current branch (you will need it throughout):
# Without path argument:
REVIEW_BRANCH=$(git branch --show-current)
# With path argument:
REVIEW_BRANCH=$(git -C <path> branch --show-current)
# A detached HEAD (a PR head fetched by SHA) has no branch name
[ -n "$REVIEW_BRANCH" ] || REVIEW_BRANCH="detached HEAD"
Determine target branch (the branch this PR is merging INTO):
--target argument provided: use itgh pr view --json baseRefName --jq .baseRefName 2>/dev/null
git rev-parse --abbrev-ref @{upstream} (tracking branch), stripping the remote prefix (e.g. origin/next → next)main, fallback to masterDecide whether a worktree is needed. Compare REVIEW_BRANCH to the branch being reviewed:
REVIEW_BRANCH matches the branch to review: analyze in place, no worktree.<path> refers to that worktree path. Cleanup runs via the trap on exit.Find the merge base (the point where the branch being reviewed diverged from the target) and record the head being reviewed:
MERGE_BASE=$(git -C <path> merge-base HEAD <target-branch>)
REVIEW_HEAD=$(git -C <path> rev-parse HEAD)
Print the review header so the user can verify the scope: Reviewing <REVIEW_BRANCH> at <REVIEW_HEAD> against <target-branch> (short SHA is fine). The output header restates the same SHA as Reviewed <REVIEW_BRANCH> at <REVIEW_HEAD> — that output line is the auditable record --round1-head refers to on later rounds, so the round-1 ref can always be recovered from the round-1 review output.
<if --ticket>
If --ticket is provided, fetch the ticket content BEFORE reviewing the diff:
http:// or https://): use gh CLI for GitHub URLs (e.g. gh issue view <number> --repo <owner/repo>), or WebFetch for other URLs (Jira, Linear, Notion, etc.)#123): use gh issue view 123 in the repository being reviewedPROJ-456): attempt to resolve via web search or ask the user for the full URLExtract from the ticket:
If the ticket cannot be fetched (404, auth required, etc.), warn the user and continue the review without ticket validation.
If --type provided, use it. Otherwise detect the project type (Go, Node, Python, Rust, etc.) and build an exclude list dynamically:
Append any --exclude patterns from arguments.
Run the diff excluding those patterns:
git diff <MERGE_BASE> -- . ':!<pattern1>' ':!<pattern2>' ...
(Note: no HEAD — this compares the working tree against the merge base, capturing all changes including uncommitted ones. The merge base is the point where the current branch diverged from the target branch.)
You are NOT limited to the diff. When the diff alone is not enough to understand the change:
Do whatever is needed to review competently. The diff is the starting point, not the boundary.
Review the diff for:
ethtool_validate_speed() sounded like a drop-in for a speed check and by definition accepts the one value the check rejects. If the definition does not fit, say why in one line instead of proposing it<if --type kernel>
The unit of review is the commit, not the branch: every commit must build alone, carry one logical change, and have a message that stands without the thread that produced it. Review each commit's diff and message in series order, then the series as a whole.
What list reviewers bounce, each item learned from an actual bounce:
---) or into the cover letter. A body that narrates the diff reads as machine-written and comes back with "is it AI generated?"./* X is not supported */ in place of a paragraph; the reasoning belongs in the commit message, and an added comment longer than a line needs a reason the code itself cannot carry.Report per commit: build result at the warning level the tree uses, checkpatch totals, and which of the items above the commit violates. A message or comment defect on this list is a verdict finding: on a mailing list it costs a respin exactly like a code defect does.
Every finding — from the diff or from the surrounding code — gets one mechanical question, answered from git, not from anyone's claim: does this defect exist at the merge base? Check with git show $MERGE_BASE:<file> and git -C <path> blame.
The PR owns what it changed and what its changes interact with — nothing more. There is no "the PR touched this area, so the PR owns the area". Attribution is computed by the reviewer from git; the authoring session has no channel to influence it.
The remedy lives in the same layer as the defect:
A review gate is a control loop. While findings come from the feature, the loop converges: each fix shrinks what can be found. When each finding spawns a guard and the guard spawns new findings, the loop grows the code it is reviewing and diverges — while from inside, every round looks identical ("N findings, fix, re-run"). The origin mark is the instrument that distinguishes the two regimes.
Three origins, all computed from git, zero declarations:
| Origin | Definition | Role |
|---|---|---|
| pre-existing | line exists at merge base | "Found outside this diff" section |
| feature | line absent at merge base, present at the round-1 head | normal verdict finding |
| churn | line introduced after the round-1 head, i.e. by the gate loop itself | normal verdict finding, plus loop diagnostics |
Mechanics: git blame the finding's line, take the commit, check git merge-base --is-ancestor <commit> <round1-head>. The unit of attribution is the line — blame survives line moves; file-level heuristics do not. Blame per finding is cheap (findings number in the dozens). A line not yet committed has no blame commit and counts as introduced after the round-1 head — churn on a re-review round.
Without --round1-head (first round, or the record is unavailable): every non-pre-existing finding is feature; skip churn diagnostics.
What the mark does:
6 findings: 1 feature, 5 churn.When a finding is a second instance of a class an earlier round of this gate already reported (the earlier findings come from their review records, passed in the invocation context like the prior ratio; this holds with or without --round1-head), the finding names the invariant both instances break and asks for that invariant to be fixed, not this instance.
The mark never touches verdict logic. Severity and blocking are computed blind to origin; the label exists only in the header diagnostics. A bug in review-added code is a bug and blocks — "it came from review, so it's not a bug" is not derivable anywhere. A fix to feature code made during the gate is churn by mechanics, and that is correct semantics (second-generation work); that is why the trigger is majority-for-two-rounds, not mere presence.
A majority-churn state has exactly three legal exits, none of which skips a bug:
Explicitly illegal: merging with an open churn finding in code that remains in the PR. Backstop the mark never touches: the terminal gate condition is LGTM on the final tree, computed origin-blind — for the final reviewer the churn category does not exist. Labels influence the route, never the exit check.
<if --ticket>
Compare the changes against the ticket requirements:
Ticket compliance issues are blocking (NOT LGTM) when requirements are missing or the implementation contradicts the ticket.
<if --nitpick> Pedantic mode: include style nitpicks, naming suggestions, minor improvements. Leave no stone unturned.
<if not --nitpick> Be direct. If something is fine, don't mention it. Focus on what matters, skip nitpicks.
Open with the review header, in this order:
Reviewed <REVIEW_BRANCH> at <REVIEW_HEAD> against <target-branch>.6 findings: 1 feature, 5 churn (+ 2 outside this diff).Verdict semantics:
--ticket requirements when --ticket was provided.Then two sections, same quality bar, same evidence discipline:
Findings attributed to the diff (introduced / worsened / interacts with), written as free-form text like a human reviewer would write. Only these decide the verdict. Each carries its origin mark when churn diagnostics are on. Non-blocking suggestions go under a Recommended subheading here, and dropped scenarios under Considered and dropped — neither flips the verdict.
Everything discovered that already existed at the merge base, with full severity — a security hole found here is still reported as a security hole. Nothing is dropped; it is just not held hostage by this PR. When this section is non-empty, end it with the operator obligation: the gate is not closed until every finding here has a home — a filed issue, a parked branch, or a project-memory entry.
<if --ticket> Include a Ticket Compliance section after the main review with:
Close with a short reminder of the three routing rules (adapt the wording to context; do not inflate it):
What SKILL.md sets; muted values are Claude Code's defaults
general-purpose), in the background3 skills in this plugin
/pr-reviewDraft a GitHub PR review: an own judgement of the change before the author's framing, a five-line card for the owner when that judgement doubts the change, a code pass by two models with every finding checked against the sources, and an LGTM or NOT LGTM verdict; publish only with `--publish` after the user approves the draft. An LGTM goes out as APPROVE only when the PR can merge right now. TRIGGER: invoke whenever the user asks to review, audit, or quality-check a GitHub Pull Request — by URL, `owner/repo#N`, bare number, or a "this PR" / "этот PR" reference resolvable from context. Examples — "review PR 2541", "сделай ревью на https://github.com/foo/bar/pull/123", "оцени этот PR". DO NOT trigger for replying to existing review comments, labeling or triaging, a TLDR, or questions about a branch with no PR.
/series-reviewReview what a subsystem has become across a series of merged PRs, not one PR: one page for the subsystem's owner with the subsystem in plain words, the growth of machinery, contradictions with its theory note, and candidates for removal. Run by whoever manages the review queue, on a schedule, never during a PR review. TRIGGER: invoke when the user asks for a series review, a subsystem review, or "what has <subsystem> become". DO NOT trigger for a single PR (use pr-review).
npx claudepluginhub lexfrei/ccc --plugin review-toolkitOther plugins' skills for the same job