Review Pull Request
Review the pull request specified by $ARGUMENTS (PR number or URL).
What this review is for
A reviewer approves the decision, not the lines. The comments that change outcomes here are design comments: the premise doesn't hold, the fix treats a symptom, a much smaller change would do, the change quietly alters a flow everyone uses, the rollout order loses data, the next call site will bring the bug back. Line-level bugs come second. Style nits come last, capped, and never block.
A review that lists ten nits and misses that the approach is wrong has failed. A review that says "the approach is right, here is what I checked" with zero findings has succeeded.
Step 0: Validate Arguments
If $ARGUMENTS is empty or not provided, you MUST stop and ask the user for a PR number. Do NOT proceed without an explicit PR number or URL. Do NOT fall back to the current branch's PR.
Example prompt: "Please provide a PR number or URL. Usage: /review-pr 123"
Step 1: Fetch PR Metadata and Create Worktree
Run these commands sequentially in a single bash call:
REPO_ROOT=$(git rev-parse --show-toplevel)
PR_NUMBER=<pr number from arguments>
WORKTREE_DIR="${REPO_ROOT}-pr-review-${PR_NUMBER}"
# Fetch PR metadata
gh pr view $PR_NUMBER --json number,title,body,baseRefName,headRefName,headRefOid,additions,deletions,changedFiles,author,closingIssuesReferences
# Fetch latest and create worktree
git fetch origin
HEAD_BRANCH=$(gh pr view $PR_NUMBER --json headRefName -q .headRefName)
# A leftover worktree from an aborted run would sit on an old head — always start from the current one
git worktree remove "$WORKTREE_DIR" --force 2>/dev/null
git worktree add --detach "$WORKTREE_DIR" "origin/${HEAD_BRANCH}"
echo "WORKTREE_DIR=${WORKTREE_DIR}"
Store the WORKTREE_DIR path. You will use it for ALL subsequent operations.
CRITICAL: Worktree Path Rule
From this point forward, you MUST:
- Use
$WORKTREE_DIRas the working directory for ALL bash commands (cd $WORKTREE_DIR && ...) - Use
$WORKTREE_DIR/path/to/filefor ALL Read tool calls - Use
$WORKTREE_DIRas thepathfor ALL Glob and Grep tool calls - NEVER use the original repo root for any file operation
ghcommands can run from anywhere (they query the GitHub API), but even those shouldcd $WORKTREE_DIRfirst for consistency
Step 2: Read the Intent Before the Code
You cannot judge a design without knowing what it is for. Before opening the diff, collect:
- The PR body. Note its Decision line, its claims ("X is excluded", "refused before LLM spend", "no change for other providers"), its Risks, and its "Not in this PR". Every claim is something to check in Step 5.
- The linked ticket (
Fixes #N/Part of #N, orclosingIssuesReferences) and its parent epic:gh issue view <N> --comments. Note the acceptance criteria and any requirement the ticket states. Also note what the next tickets in the epic need: a design that has to be migrated away from next sprint is a finding now. - Decision log. Read the entries in