skills/reviewing-prs/SKILL.md
System skill loaded before dispatching any PR review subagent. Ensures correct file version selection based on branch and worktree state. Not invoked directly by users. Required by: code-review, advanced-code-review, distilling-prs when reviewing PRs.
npx skillsauth add axiomantic/spellbook reviewing-prsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
review_source. No exceptions.DIFF_ONLY mode, local files for changed paths are on the wrong branch. Reading them produces wrong verdicts.REFUTED verdict based on a local file read in DIFF_ONLY mode is a wrong verdict. Mark it INCONCLUSIVE or [NEEDS VERIFICATION].When reviewing a PR via diff, local files are on a different branch. Reading them produces silently wrong results:
This is a structural failure: the agent reads the wrong version of the file.
Before dispatching any code review subagent, determine review_source:
PR_HEAD_SHA=$(gh pr view <PR_NUMBER> --json headRefOid --jq '.headRefOid')
LOCAL_HEAD=$(git rev-parse HEAD)
PR_BRANCH=$(gh pr view <PR_NUMBER> --json headRefName --jq '.headRefName')
WORKTREE_PATH=$(git worktree list --porcelain | grep -B1 "branch refs/heads/$PR_BRANCH" | grep "^worktree" | awk '{print $2}')
| Condition | review_source | Working Directory |
|-----------|-----------------|-------------------|
| $WORKTREE_PATH is set | LOCAL_FILES | $WORKTREE_PATH |
| $LOCAL_HEAD == $PR_HEAD_SHA | LOCAL_FILES | Current repo root |
| Neither | DIFF_ONLY | N/A |
LOCAL_FILES modeThe agent works in a directory that is the PR branch. File reads are authoritative.
DIFF_ONLY modeNo local checkout matches the PR. The diff is the only source of truth.
INCONCLUSIVE (not REFUTED)[NEEDS VERIFICATION]REFUTED based on a local file read is a wrong verdictEvery subagent dispatched to review a PR must receive this context block:
## PR Review Context
- PR: #<NUMBER>
- PR HEAD SHA: <SHA>
- Review mode: <LOCAL_FILES | DIFF_ONLY>
- Working directory: <path if LOCAL_FILES, "N/A — use diff only" if DIFF_ONLY>
- Changed files: <list>
If review mode is DIFF_ONLY:
- Do NOT read any files listed under "Changed files" from the local filesystem
- The diff is the only authoritative source for those files
- Mark any finding you cannot verify from the diff as [NEEDS VERIFICATION]
- Do NOT mark a finding REFUTED based on local file content
Checking out a PR branch in a worktree converts a DIFF_ONLY review into a LOCAL_FILES review. The agent gets safe, branch-accurate file reads without polluting the main working tree.
# Check out PR branch in a worktree
git worktree add ~/.local/worktrees/pr-<NUMBER> <PR_BRANCH>
Once the worktree exists, dispatch the review agent with working_directory: ~/.local/worktrees/pr-<NUMBER>.
Before dispatching any PR review subagent:
PR_HEAD_SHA fetched from GitHub (not guessed)review_source determined: LOCAL_FILES or DIFF_ONLYLOCAL_FILES: exact working directory specified in promptDIFF_ONLY: prompt explicitly forbids local file reads on changed files<FINAL_EMPHASIS> The wrong-branch problem produces confident wrong answers, not obvious errors. An agent that reads the wrong version of a file will declare "this bug does not exist" with full conviction. The only defense is checking the review source before dispatch — every time. </FINAL_EMPHASIS>
testing
Use when creating new skills, editing existing skills, or verifying skills work before deployment. Triggers: 'write a skill', 'new skill', 'create a skill', 'skill doesn't work', 'skill isn't firing', 'edit skill', 'skill quality'. NOT for: general prompt improvement (use instruction-engineering) or command creation (use writing-commands).
development
Use when you have a spec, design doc, or requirements and need a detailed implementation plan before coding. Triggers: 'write a plan', 'create implementation plan', 'plan this out', 'break this down into steps', 'convert design to tasks', 'implementation order'. Also invoked by develop during planning. NOT for: reviewing existing plans (use reviewing-impl-plans).
testing
Use when creating new commands, editing existing commands, or reviewing command quality. Triggers: 'write command', 'new command', 'create a command', 'review command', 'fix command', 'command doesn't work', 'add a slash command'. NOT for: skill creation (use writing-skills).
development
Use when about to claim discovery during debugging. Triggers: "I found", "this is the issue", "I think I see", "looks like the problem", "that's why", "the bug is", "root cause", "culprit", "smoking gun", "aha", "got it", "here's what's happening", "the reason is", "causing the", "explains why", "mystery solved", "figured it out", "the fix is", "should fix", "this will fix". Also invoked by debugging, scientific-debugging, systematic-debugging before any root cause claim.