pr-review
Executes a risk-tiered, multi-perspective PR review — triages the change, runs specialist subagents in parallel (code-first, testing, skeptical, big-picture) plus an external model pass scaled to risk, then posts a consolidated review to the PR.
freenet · Static checks on file
Installation
Read the source and dependencies before running a command. Copying does not install or execute anything.
npx skills add freenet/freenet-agent-skills --skill pr-reviewAbout this skill
name: pr-review description: Executes a risk-tiered, multi-perspective PR review — triages the change, runs specialist subagents in parallel (code-first, testing, skeptical, big-picture) plus an external model pass scaled to risk, then posts a consolidated review to the PR. license: LGPL-3.0
PR Reviewer
Run a comprehensive PR review covering all four Freenet review perspectives, plus an external (non-Claude) model, and post a consolidated review to the PR.
When to Use
Invoke /freenet:pr-review <PR-NUMBER> after a PR is ready for review, before merging.
The PR number is passed as the skill argument ($1); if none is given, detect the PR
for the current branch with gh pr view --json number -q .number.
How This Skill Works
This skill orchestrates a review — it does not do all the perspectives by hand. It checks out the PR, triages the change to a risk tier, spawns specialist subagents in parallel (scaled to that tier) plus an external model pass, reconciles their findings into one report, and posts that report to the PR.
The four subagents ship with this plugin as first-class agent types — invoke them
directly with the Agent tool's subagent_type parameter. Do not paste agent
definitions into a general-purpose prompt; that is obsolete.
Step 1: Check Out the PR, Gather Context, and Triage Risk
Critical: reviewers must read the PR's actual code, and the review must not
disturb the user's working tree. Check the PR out into a dedicated worktree — do
NOT use gh pr checkout, which switches the user's working branch and drags any
uncommitted changes onto the PR branch, contaminating the review.
PR=<PR-NUMBER> # the $1 skill argument
BASE="$(gh pr view "$PR" --json baseRefName -q .baseRefName)" # the PR's base branch
git fetch origin "$BASE" # fresh base branch for the diff
git fetch origin "pull/$PR/head" # PR head — FETCH_HEAD now points here
REVIEW_DIR="${TMPDIR:-/tmp}/pr-review-$PR"
git worktree remove --force "$REVIEW_DIR" 2>/dev/null || true # prune a stale prior worktree
git worktree add --detach "$REVIEW_DIR" FETCH_HEAD # PR code, isolated
cd "$REVIEW_DIR" # run the review from here
Gather context (from the worktree):
gh pr view "$PR"
gh pr diff "$PR" --name-only
gh pr checks "$PR" # CI status
gh issue view <ISSUE_NUMBER> # linked issue (from "Fixes #" / "Closes #")
# Existing review feedback — read it so the review ADDRESSES it, not duplicates it:
gh pr view "$PR" --json comments,reviews
gh api repos/{owner}/{repo}/pulls/"$PR"/comments # inline review comments
The gh api .../comments call above is the reliable way to get inline comments —
they are easy to miss. (If your environment provides a gh-pr-interactions skill, it
documents the comment API in more depth.)
Large diffs: if the diff exceeds ~2000 changed lines or ~40 files, instruct each subagent to review by file batches rather than loading the whole diff into context.
Cleanup (mandatory — do this even if the review aborts partway): remove the
worktree with git worktree remove --force "$REVIEW_DIR".
Do NOT run a code-simplifier or any other mutating step here — this skill reviews the PR as submitted; editing the checked-out code would make reviewers judge something other than the PR.
Pick the Risk Tier
Choose the tier by checking these in order — first match wins — or honor an explicit tier the user named (e.g. "full review of PR 42"):
- Skip — the entire diff is mechanical: typo / comment-only / formatting / version bump / CHANGELOG-only. Judge this against the whole diff, not the PR title — a PR labelled "version bump" that also edits logic is not Skip. Report "trivial — CI is the only gate" and stop; do not spawn reviewers.
- Full — the change touches a high-risk surface (below), OR the diff is large or cross-cutting, OR you are genuinely uncertain. Run the complete process.
- Light — everything else: a low-to-moderate-risk change with no high-risk surface. Spawn a reduced reviewer set (Step 2) plus the external model pass (Step 3).
These tiers are exhaustive — Light is the catch-all. When torn between two, pick the heavier one.
High-risk surfaces — always Full: concurrency / async, cryptography / security / auth, state authorization, data or schema migration, wire format / protocol / serialization (freenet-stdlib enums), consensus / routing, transport / NAT traversal, contract or delegate WASM, deploy / release / CI config.
State the chosen tier and the one-line reason before proceeding.
Step 2: Spawn the Review Subagents in Parallel
Spawn the reviewers with the Agent tool in a single message so they run
concurrently, each with run_in_background: true. Which reviewers run depends on the
tier picked in Step 1:
- Full — spawn all four.
- Light — spawn
freenet:skeptical-reviewer; also spawnfreenet:big-picture-reviewerif the diff removes code or spans multiple components.
subagent_type | Perspective |
|---|---|
freenet:code-first-reviewer | Reads the code before the description; flags gaps between stated intent and implementation |
freenet:testing-reviewer | Test-coverage gaps at unit / integration / simulation / E2E levels |
freenet:skeptical-reviewer | Adversarial — bugs, race conditions, edge cases, failure modes |
freenet:big-picture-reviewer | Goal alignment, removed tests/fixes, scope creep, stale skills/docs |
These subagent_type values are plugin-namespaced: freenet: is the plugin name and
the files in agents/ carry the bare name (skeptical-reviewer, etc.). Use the
freenet:-prefixed form exactly as shown.
In each subagent's prompt, include: the PR number, the repo (owner/repo), and the
path to the review worktree from Step 1 ($REVIEW_DIR), so the agent