/rpi:review-pr [review|re-review|self-review|address-feedback] <pr> [additional instructions]from rpi
Orchestrates independent reviewer subagents to analyze a PR, then judges their findings. Supports review, re-review, self-review, and address-feedback modes.
Ships in rpi. 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.
/rpi:review-pr [mode] [PR] [additional instructions]
review (default), re-review, self-review, or address-feedbackExamples:
/rpi:review-pr #1234
/rpi:review-pr re-review #1234
/rpi:review-pr self-review #1234
/rpi:review-pr address-feedback #1234
/rpi:review-pr #1234 exclude config/locales and .yml files
/rpi:review-pr re-review #1234 skip rails guru because it is not a rails project
Your role is orchestrator and judge, not doer. You collect artifacts, delegate analysis to subagents, and apply judgment to their output. The subagents read the code and comments — you decide what to do about their findings.
Steps are sequential — later steps depend on earlier results. Complete each step and wait for its results before starting the next. Skipping ahead without subagent results means the judgment layer in "Step 6: Judge Findings" has nothing to work with. Only parallelize where explicitly marked (e.g., "spawn in parallel").
gh pr view <PR_NUMBER> --json number,title,body,url,headRefName,baseRefName
If re-review or address-feedback mode is activated, also save all existing review feedback to /tmp/:
Do not read these files — pass them to subagents by path only. The subagents will read and analyze the content.
# Review verdicts and bodies (APPROVED, CHANGES_REQUESTED, COMMENTED)
gh api repos/<OWNER>/<REPO>/pulls/<PR_NUMBER>/reviews \
--jq '[.[] | {id, state, body, html_url, commit_id, submitted_at, author_association, user: .user.login}]' \
| tee /tmp/pr_<NUMBER>_reviews.json | jq length
# Inline review comments on specific diff lines
gh api repos/<OWNER>/<REPO>/pulls/<PR_NUMBER>/comments \
--jq '[.[] | {id, pull_request_review_id, body, path, line, start_line, side, diff_hunk, commit_id, created_at, author_association, in_reply_to_id, user: .user.login}]' \
| tee /tmp/pr_<NUMBER>_inline_comments.json | jq length
# Conversation-level comments
gh api repos/<OWNER>/<REPO>/issues/<PR_NUMBER>/comments \
--jq '[.[] | {id, body, html_url, created_at, updated_at, author_association, user: .user.login}]' \
| tee /tmp/pr_<NUMBER>_conversation.json | jq length
If toon is available, pipe each extraction through it and save as .txt instead — token-efficient artifacts, and every subagent that reads them benefits. Note the sanity check changes with the format: toon output is not JSON, so end the pipeline with | tee /tmp/pr_<NUMBER>_reviews.txt | wc -l instead of | jq length.
Checkout the PR branch locally and generate the diff. Save it to /tmp/.
git fetch origin
git checkout <branch>
# Use merge-base for a clean diff (handles diverged base branch)
BASE=$(git merge-base origin/<baseRefName> HEAD)
git diff $BASE -- . > /tmp/pr_<NUMBER>_diff.txt
If the user provided file exclusion or inclusion patterns in additional instructions, apply them using git's pathspec syntax:
# Exclude specific paths
git diff $BASE -- . ':(exclude)path/to/noisy/dir' ':(exclude)*.ext' > /tmp/pr_<NUMBER>_diff.txt
# Include only specific directories
git diff $BASE -- path/to/dir1/ path/to/dir2/ > /tmp/pr_<NUMBER>_diff.txt
# Combine inclusion with exclusion
git diff $BASE -- path/to/dir/ ':(exclude)path/to/dir/subdir' > /tmp/pr_<NUMBER>_diff.txt
Verify the diff is non-empty: wc -l < /tmp/pr_<NUMBER>_diff.txt
The PR references the original ticket (e.g., ENG-123, PROJ-456). Fetch full ticket details — requirements and acceptance criteria define what "correct" looks like for this change. You can't review a feature without knowing what was in the task description before it was implemented.
Save the ticket verbatim to /tmp/pr_<NUMBER>_ticket.md — full title, description, every Task, every Acceptance Criterion, plus the ticket comments. Do not summarize, annotate, or reorder it: a paraphrase is where your conclusions leak into the reviewers' inputs, and a reviewer fed conclusions ratifies them instead of auditing the code.
Wait for ticket details before proceeding — "Step 4: Gather Historical Context" needs the ticket context to ask the right questions.
Spawn the thoughts-analyzer subagent to find historical knowledge about affected features.
subagent_type: rpi:thoughts-analyzer
Prompt: "What do we know about <ticket reference and title from "Step 3: Fetch Original Ticket">? What decisions, constraints, and trade-offs should reviewers be aware of?"
The harness saves the subagent's report to a task output file and shows the path when it completes — note that path. It is the historical-context artifact you pass to reviewers. If no path was surfaced (the report came back inline), save it verbatim to /tmp/pr_<NUMBER>_context.md yourself. Either way the artifact is a copy, never a rewrite: a re-summary is exactly where your conclusions leak in.
Wait for this subagent to complete, then proceed to "Step 5-a: Spawn Review Subagents".
If address-feedback mode is activated, skip to "Step 5-b: Spawn Codebase Research Subagents (address-feedback)" below.
Spawn the review subagents in parallel using the Task tool, each by its own subagent_type from the roster below. Their review instructions live in their agent definitions — you hand each one paths and parameters only:
/tmp/pr_<NUMBER>_diff.txt/tmp/pr_<NUMBER>_ticket.mdWhy subagents review at all: they are fresh eyes. Each reviewer arrives with zero knowledge of this PR beyond its own charter — that absence of bias is exactly what finds the gaps and blind spots you've already rationalized past. Never add interpretation, summaries, or framing — no "this looks consistent with…", no digest of what the metadata showed you. A reviewer fed your conclusions ratifies them instead of auditing the code; the bare prompt is what keeps the eyes fresh.
If re-review mode is activated, each subagent also receives the paths to /tmp/pr_<NUMBER>_reviews.json, /tmp/pr_<NUMBER>_inline_comments.json, and /tmp/pr_<NUMBER>_conversation.json (or .txt when | toon was applied at extraction — prefer token-efficient artifact formats) — receiving prior-feedback paths is what tells a reviewer it is a re-review; no mode flag is needed.
Spawn every reviewer whose domain exists in this repo — coverage is the point. The full roster is the default; an omission needs a reason: the test-framework twin that doesn't apply (rpi:review-tests-rspec for RSpec repos, rpi:review-tests-minitest for minitest repos — pick the one matching the stack, never both), a domain genuinely absent from the repo (no Rails reviewer in a non-Rails project), or an explicit user skip. Never trim the roster for brevity or token thrift — an unreviewed domain is a silent LGTM.
No expert for a domain in the diff? Spawn the generalist. When the stack includes a domain no expert reviewer covers (say, a Python service in the diff), spawn rpi:review-generic with the domain and a focus list — scope only: what to look for, never what you expect it to find. Better a generic reviewer than an unreviewed domain.
Critical: Send a single message with all the Task tool calls to ensure parallel execution.
subagent_type | Audits |
|---|---|
rpi:review-rails | Rails conventions and architecture |
rpi:review-ticket-delivery | whether the PR delivers the ticket (always runs; carries the security sweep) |
rpi:review-performance | performance and cross-tenant leakage |
rpi:review-tests-rspec | test quality and coverage (RSpec repos) |
rpi:review-tests-minitest | test quality and coverage (minitest repos) |
rpi:review-docs | documentation quality and clarity |
rpi:review-generic | any domain in the diff with no expert reviewer (focus list from you) |
Example spawn — same shape for all:
subagent_type: rpi:review-rails
Prompt: "PR #<number>.
Diff: /tmp/pr_<number>_diff.txt
Ticket: /tmp/pr_<number>_ticket.md
Historical context: <thoughts-analyzer task output file path>
<re-review only — Reviews: /tmp/pr_<number>_reviews.json, Inline comments: /tmp/pr_<number>_inline_comments.json, Conversation: /tmp/pr_<number>_conversation.json>
<additional instructions from user input, verbatim>"
Unless address-feedback mode is activated, skip to "Step 6: Judge Findings" below.
Spawn rpi:codebase-analyzer and rpi:codebase-pattern-finder in parallel. Each receives:
/tmp/After all subagents complete, compile findings into a unified review.
Read /tmp/pr_<NUMBER>_diff.txt now, plus the prior-feedback artifacts from "Step 1: Gather PR Metadata" if the mode saved any. An informed decision requires you to know the full context of the PR.
Critical: Subagents are pattern matchers. You are the judgment layer. Subagents are designed to be paranoid and thorough — they flag everything that matches their heuristics. Your job is to filter their output, not rubber-stamp it. A [major] from a subagent can become a [nit] or be dropped entirely after applying judgment.
For each concern, evaluate:
Then classify:
Then compile:
app/models/user.rb:42Determine verdict:
In re-review, REQUEST_CHANGES when a previously requested change is unaddressed or a new [major] is accepted. A couple of new [minor]/[nit] findings don't restart the cycle — carry them in the review body as non-blocking suggestions. (A pile-up of accepted minors is judgment territory, as always.)
If self-review or address-feedback mode is activated, skip to "Step 9: Apply Fixes".
Present the merged review to the user, including:
Ask in plain text whether to post the review to the PR: yes, edit, or cancel.
If the verdict is APPROVE and nothing in the gathered artifacts blocks delivery (no "don't merge until…" notes, dependent PRs, or coordinated-deploy requirements in the ticket, reviews, or findings), include a fourth option: Approve & merge.
gh pr checks <PR_NUMBER> --watch; when green, merge using the repository's convention (e.g. squash). If CI fails, stop and report — never merge red.Once confirmed, post the review:
gh pr review <PR_NUMBER> --approve --body "<review body>"
# or
gh pr review <PR_NUMBER> --request-changes --body "<review body>"
Your role changes from orchestrator to doer. You now have the judgment results — act on them.
rpi:document-code skill.Fixes are pushed. A self-review is done here; in address-feedback mode, proceed to "Address-Feedback Finalization" below.
Reply to each reviewer comment on GitHub with the resolution:
<commit sha>."<commit sha>."# Reply to an inline comment
gh api repos/<OWNER>/<REPO>/pulls/<PR_NUMBER>/comments/<COMMENT_ID>/replies -f body="<reply>"
# Reply to a conversation-level comment
gh api repos/<OWNER>/<REPO>/issues/<PR_NUMBER>/comments -f body="<reply>"
Then request re-review from the original reviewers:
gh pr edit <PR_NUMBER> --add-reviewer <original_reviewer>
Done when all comments are answered and re-review is requested.
[<model>] on behalf of <their username>
## PR Review Summary
**Verdict: REQUEST_CHANGES**
### Major Issues
- `app/models/user.rb:42` - SQL injection via string interpolation in where clause
```ruby
# Instead of:
User.where("name = '#{params[:name]}'")
# Use:
User.where(name: params[:name])
app/controllers/users_controller.rb:15 - Business logic belongs in model or serviceapp/services/user_service.rb:8 - Consider more descriptive method name
## Guidelines
- Focus only on changed lines, not surrounding unchanged code
- Provide concrete fix suggestions for [major] issues
- The main agent must not read the diff file before Step 6
- Pass additional instructions from user input through to all subagents
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub hoblin/claude-ruby-marketplace --plugin rpi17 skills in this plugin
/brainstormBrainstorm with the human and keep the brainstorm note, the record of how decisions were reached. Use the moment a conversation turns to ideas, design, architecture or a decision to make together, not only when something is written down, and when opening, continuing or writing to a brainstorm note./copilot-assisted-feature-deliveryFinish a pull request with Copilot as its reviewer, from marking it ready to the merge. Use when the repository's CLAUDE.md or the human says a pull request is finished with Copilot./create_handoffCreate handoff document for transferring work to another sessionOther plugins' skills for the same job