rpr
Review a PR, or a whole PR stack when asked, for design and correctness of approach (does it solve the stated problem, simply, in a way that scales and extends, without regressions). Takes a PR number or URL; a PR inside a stack is reviewed alone unless --stack or the request asks for the stack.
Safety scan
A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.
Badge for your README
Markdown
[](/listings/tylerho5--rpr)HTML
<a href="/listings/tylerho5--rpr"><img src="/api/listings/tylerho5--rpr/badge.svg" alt="findsafeskills safety rating" /></a>Install
Install instructions from the README
As written by the repo's author. findsafeskills has not verified these steps.
Requires `python3`, `git`, and an authenticated `gh`.
Ask Claude Code to install it:
Install the rpr skill from https://github.com/tylerho5/rpr. Copy SKILL.md, design_root.py, and designer-guard.py into ~/.claude/skills/rpr/, copy rpr-designer.md into ~/.claude/agents/, and merge the hook from the README into ~/.claude/settings.json.
The scripts must sit in `~/.claude/skills/rpr/`, since the hooks call them there. The hook below goes in `~/.claude/settings.json` so the design root is set up on every `rpr-designer` spawn, including from subagents:
{
"hooks": {
"PreToolUse": [
{
"matcher": "Agent",
"hooks": [
{
"type": "command",
"command": "python3 \"$HOME/.claude/skills/rpr/design_root.py\" hook-spawn",
"timeout": 180
}
]
}
]
}
}Without the hook, create the root by hand: `python3 ~/.claude/skills/rpr/design_root.py create --repo <owner/name> --pr <n> [--stack]`.
What was scanned
The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.
SKILL.md · Manifest · 160 lines
- ---
- name: rpr
- description: Review a PR, or a whole PR stack when asked, for design and correctness of approach (does it solve the stated problem, simply, in a way that scales and extends, without regressions). Takes a PR number or URL; a PR inside a stack is reviewed alone unless --stack or the request asks for the stack.
- argument-hint: "<PR number or URL> [--stack] [--design]"
- ---
- Review the approach, not only the code. The question is whether this change is the right way to solve the problem it claims to solve. Line-level bugs matter here when they show the approach is wrong or would cause a regression; leave nit-level review to `/code-review`.
- Keep the review proportionate. Disregard tiny nits and extremely rare edge cases, and don't ask for complete edge-case coverage. Code that handles the cases that happen in practice is done. A review that asks for every guard pushes the team to write and ship overengineered code, which is the opposite of what this review is for. Raise an edge case only when it is likely to occur or its failure would be costly (data loss, wrong answers shown to users, a security hole).
- ## 1. Resolve the input
- `$ARGUMENTS` is a PR number (repo is the current directory's) or a PR URL (repo comes from the URL), optionally followed by `--stack` (see step 2) and `--design` (see step 4). Pass `--repo owner/name` to every `gh` call. Run `git fetch origin` in a local clone of that repo if one exists, and read surrounding code from `origin/<default>` (or the PR's base branch, see step 2), not the local checkout.
- ## 2. Set the scope
- Review what the user asked for. A PR number or URL on its own means that one PR, even when it sits in a stack: the user picked that layer. Review the whole stack only when `--stack` is passed or the request says so ("review the stack", "the whole chain"). If the request is ambiguous, review the single PR and mention in the report that a stack review is available.
- Single PR. Its diff (`gh pr diff`) is relative to its base branch, which may be a parent PR's head rather than the default branch. Read surrounding code at that base, since that is the code the PR builds on. If the PR has a parent, treat the parent's changes as given context and don't review them. Glance at child PRs (`gh pr list --base <headRefName>`) only so you don't flag something a later layer already handles; note it as "handled in #n" instead.
- Whole stack. Walk both directions by branch name until each end:
- - Down: the PR whose head branch is this PR's base. Stop when the base is the default branch.
- - Up: open PRs whose base is this PR's head branch.
- ```bash
- gh pr view <n> --repo <r> --json number,title,url,state,baseRefName,headRefName
- gh pr list --repo <r> --state all --head <baseRefName> --json number,title,state,baseRefName,headRefName
- gh pr list --repo <r> --state open --base <headRefName> --json number,title,state,baseRefName,headRefName
- ```
- Merged layers below are already on the default branch; read them for context only. If a branch has more than one child PR, the stack forks: list the branches and ask which line to review. A PR with no parent or child is a stack of one, so review it as a single PR.
- ## 3. Understand the problem before judging the code
- Read the PR bodies, linked issues, and commit messages. Before reading the diff, write down in one or two sentences the problem being solved and its constraints. If no PR states the problem, infer it from the diff and report that the PR doesn't say.
- If the review will use an independent design (`--design`, or the PR looks Large from `gh pr view --json additions,deletions,changedFiles,title`), launch it now, before `gh pr diff`; see "Independent design" below. A brief written after reading the diff carries the PR's answer.
- Then read each layer's diff (`gh pr diff`) and the code around it on `origin/<default>`: callers of changed functions, sibling implementations of the same shape, utilities that already do part of the job, and the repo's CLAUDE.md or architecture docs. The diff alone hides duplicated mechanisms and broken invariants. For a stack review, also read the cumulative diff from the bottom PR's base to the top PR's head, since the final state is what ships.
- ## 4. Size the review and fan out
- Judge size by intent and scope first. Ask what the change does to the system: does it add a mechanism, abstraction, public interface, or config surface; change a signature, default, or return shape other code depends on; or touch a shared path many callers go through? A 50-line change to a shared default can have wide impact, while a 1000-line PR that adds a test fixture is small. Fall back to counts (changed lines excluding tests, lockfiles, and generated files; source files touched) only when intent and scope don't settle it.
- - Inline, no subagents: a single PR whose scope is a contained fix or extension inside existing code, with no new mechanism and no change to anything other code depends on. Fallback: about 200 changed lines or fewer.
- - Fan out: anything larger, and every stack review, since the cumulative diff is what gets judged. A single PR from a stack is sized on its own diff.
- - Large: adds a new mechanism or abstraction, reshapes a shared path, or is a stack of 3 or more layers. Fallback: about 600 changed lines or more.
- When fanning out, launch the agents in one message so they run in parallel. Each prompt names the repo, the PR numbers, the base ref, and the specific question, and includes the proportionality paragraph above. Subagents report facts with `path:line` citations, not review findings; you decide what becomes a finding.
- | Agent | When | Model | Returns |
- |---|---|---|---|
- | Regression trace, one per changed function, default, signature, or return shape (group them if there are many) | Fan out | Haiku | Each caller on `origin/<default>` and what changes for it |
- | Existing-code scan | Fan out | Haiku | Mechanisms, helpers, or sibling implementations that already do part of what the PR builds |
- | Test run, in its own worktree with `origin/<default>` trial-merged | Fan out | Haiku | Pass/fail for tests covering touched areas, with failure output |
- | Independent design, `rpr-designer` agent, launched in step 3 (see below) | Large, or `--design` | Opus (set by the agent) | How it would solve the problem and what trade-offs it would accept |
- | Cross-repo contract check | The change produces or consumes a payload in another repo | Sonnet | Mismatches between what one side emits and the other parses |
- | Per-layer check, one per layer | Stack review of 3 or more layers | Sonnet | Whether the layer is coherent and safe to merge alone |
- Compare the independent design with the PR's approach. List every difference in the core mechanism or a main choice, and for each decide which is better for this problem. A difference becomes a finding only when the design's choice is clearly simpler or more correct; otherwise reject it with a concrete reason. Every difference goes in the report's Independent design section either way.
- ### Independent design
- The designer must not see the PR. The `rpr-designer` agent type enforces this with its guard hook (`designer-guard.py`): file reads stay under a design root and installed package sources; Bash allows only `git -C <root>` reads within the base's history and read-only `gh`; and no command or URL may name the reviewed PR, the PRs stacked above it, their branches, or their commits. Other PRs, issues, and history stay open. Always use `subagent_type: "rpr-designer"`, never a general agent.
- The designer needs a design root: a detached worktree at the PR's base (the parent's head for a stacked PR; the fork point for a merged PR), plus a block entry for the PR and the stack above it. The designer's Stop hook removes both.
- Setup is automatic in the main session and in subagents. A user-level `PreToolUse` hook on `Agent` in `~/.claude/settings.json` runs `design_root.py hook-spawn` on every spawn; it does nothing unless the spawn is `rpr-designer`. It reads the PR from this skill's invocation (in a subagent, from that subagent's own transcript), creates the root, and prepends `Design root: <path>` to your brief. If it can't tell which PR is under review, it denies the spawn; resend with a first line `Review: <PR URL> [--stack]`, which it strips. Skill-level hooks would not do this: Claude Code doesn't fire a skill's hooks for tool calls made by a subagent that invoked the skill.
- If the designer's brief comes back without a `Design root:` line (the settings hook is missing), create the root by hand with `python3 "$HOME/.claude/skills/rpr/design_root.py" create --repo <owner/name> --pr <n> [--stack]` and start the brief with `Design root: <printed path>`. Don't add a `Review:` line then, since nothing would strip it and the designer would read the PR URL.
- Where the hook runs, it denies a brief that names the PR's number, URL, branch, or commits, and it accepts a brief that already starts with a root from `create`. When you create the root by hand, check the brief for those yourself.
- Brief: put it inline in the prompt, since the designer can't read your scratchpad. It contains:
- - absolute `site-packages` or `node_modules` paths if library source matters (the hook adds the design root);
- - the problem as a user or operator sees it: the symptom or goal, with real numbers;
- - hard constraints that come from the issue, ticket, or user (platform limits, compatibility, cost), not from the PR;
- - a word limit and the proportionality paragraph.
- Source the problem from the linked issue or ticket first, and from the PR body's problem or motivation part only when nothing else states it. Leave out anything that encodes the PR's answer: PR body text, PR numbers or branch names, option lists ("consider X vs Y"), the mechanisms, functions, or hooks the PR uses, pitfalls the PR handles, and the PR's own decisions restated as constraints. Test: could the brief have been written before the PR existed?
- When the PR implements a plan or spec doc on the base branch, say so in the brief and ask the designer to state where it agrees or disagrees with the plan's solution. In the report, note that the design was compared against the plan as well as the PR, since agreement there is expected.
- ## 5. Questions to answer
- Answer these yourself, using what the subagents returned.
- Fit to the problem
- - Does it solve the whole stated problem, at the cause rather than the symptom?
- - Is this the right layer for the fix (the producer rather than each consumer, the shared path rather than one caller)?
- - Does it do things the problem didn't call for?
- Simplicity
- - Is there a simpler approach that meets the same constraints? Describe it concretely and say what it gives up. An alternative you can't describe concretely is not a finding.
- - Does it reuse what the codebase already has, or build a parallel mechanism?
- - Does each new abstraction, flag, config, or layer pay for itself now?
- Scalability and extensibility
- - When the next variant arrives (another tool, entity type, model, endpoint), is it a new data entry or new control flow? Would a declarative shape help, or be premature?
- - How does it behave as volume, payload size, concurrency, latency, or cost grow?
- - Which hardcoded assumptions will break first?
- Correctness of approach
- - Does it keep the system's documented invariants and contracts?
- - Does the design handle the failure modes that are likely in this system (a flaky upstream, empty results, concurrent requests)? Skip ones that are only theoretically possible.
- - If another repo produces or consumes the changed payload, does the other side still match?
- Regressions
- - Trace the callers of every changed function, default, signature, return shape, or removed behavior on `origin/<default>`. What changes for paths outside the PR's target?
- - Do the tests cover the new behavior and pin the old behavior that must not change? For an inline review, run the tests for touched areas when it's cheap.
- Stack structure (stack reviews only)
- - Is each layer coherent and safe to merge alone, bottom first?
- - Does a later layer rework or undo an earlier one?
- ## 6. Skeptic pass
- When the draft has at least one finding, give the findings (with their citations) to one fresh agent whose job is to refute each one: show the cited code doesn't do what the finding claims, show the case is rare or cheap, or show it is a nit. Use Sonnet; use Opus when the draft has more than about 10 findings. Drop refuted findings and downgrade weakened ones. Skip this step for an inline review with one or two findings you traced yourself.
- ## 7. Report
- Report in the terminal. Do not post to GitHub; if the user asks to post, draft the review and wait for approval.
- ```
- ## <PR or stack title>: sound | sound with changes | rethink
- Problem: <1-2 sentences>
- Approach: <1-2 sentences>
- ### Design
- 1. <issue>. <concrete effect>. <suggested direction>. (PR #n, path:line)
- ### Regressions
- 1. ...
- ### Independent design
- Agrees on: <core mechanism, one line>
- 1. <difference>. Adopted as Design #n | Rejected: <concrete reason>.
- ### Stack structure
- ...
- ### TL;DR
- Merge: ready | ready after fixes | not yet. <one clause on why>
- <2-3 sentences: whether it solves the stated problem, whether the approach is the right one, and the single thing that matters most.>
- Before merge:
- - <blocking item> (PR #n)
- Follow-up, not blocking:
- - <item> (PR #n)
- Stack: <which layers can merge now, in order; which wait and on what>
- ```
- Rank findings by impact. Cite the PR and `path:line` for each. Say which findings are inferred rather than traced. Before reporting, cut every finding that is a nit, a style preference, or a rare edge case; a short list of findings that matter beats a long list. If nothing survives, say the approach is sound and give only the TL;DR. Drop empty sections and empty TL;DR lines; the Stack line appears only for stack reviews. For a single PR that sits on an unmerged parent, the Merge line says it waits on that parent (#n).
- The heading verdict judges the design; the TL;DR's Merge line judges readiness to merge. End every response with the TL;DR. It summarizes the report above it and adds no new findings. "Before merge" holds only findings that survived the skeptic pass and would cause a regression or a wrong result; everything else goes under follow-up.
README.md · README · 47 lines
- # rpr
- A Claude Code skill that reviews a PR, or a stack of PRs, for design and correctness of approach: does it solve the stated problem, simply, in a way that extends, without regressions. Line-level nits are left to `/code-review`.
- Usage: `/rpr <PR number or URL> [--stack] [--design]`
- For large PRs (or with `--design`) it spawns an `rpr-designer` subagent that proposes its own solution from a worktree at the PR's base, without access to the PR. A guard hook blocks the designer from reading the PR, its branch, or its commits.
- ## Files
- - `SKILL.md`: the review procedure.
- - `rpr-designer.md`: the independent designer agent definition.
- - `designer-guard.py`: `PreToolUse` guard that keeps the reviewed PR out of the designer's reach.
- - `design_root.py`: creates and removes the designer's worktree and block entry.
- ## Install
- Requires `python3`, `git`, and an authenticated `gh`.
- Ask Claude Code to install it:
- ```
- Install the rpr skill from https://github.com/tylerho5/rpr. Copy SKILL.md, design_root.py, and designer-guard.py into ~/.claude/skills/rpr/, copy rpr-designer.md into ~/.claude/agents/, and merge the hook from the README into ~/.claude/settings.json.
- ```
- The scripts must sit in `~/.claude/skills/rpr/`, since the hooks call them there. The hook below goes in `~/.claude/settings.json` so the design root is set up on every `rpr-designer` spawn, including from subagents:
- ```json
- {
- "hooks": {
- "PreToolUse": [
- {
- "matcher": "Agent",
- "hooks": [
- {
- "type": "command",
- "command": "python3 \"$HOME/.claude/skills/rpr/design_root.py\" hook-spawn",
- "timeout": 180
- }
- ]
- }
- ]
- }
- }
- ```
- Without the hook, create the root by hand: `python3 ~/.claude/skills/rpr/design_root.py create --repo <owner/name> --pr <n> [--stack]`.
Ratings and comments
Sign in to rate this skill.
Sign inFree to use. If it’s helped, pass it on.