Code Review
PR review mode adapted from PRPs-agentic-eng by Wirasm. Part of the PRP workflow series.
Input: $ARGUMENTS
Mode Selection
If $ARGUMENTS contains a PR number, PR URL, or --pr: → Jump to PR Review Mode below.
Otherwise: → Use Local Review Mode.
Local Review Mode
Comprehensive security and quality review of uncommitted changes.
Phase 1 — GATHER
git diff --name-only HEADIf no changed files, stop: "Nothing to review."
Phase 2 — REVIEW
Read each changed file in full. Check for:
Security Issues (CRITICAL):
- Hardcoded credentials, API keys, tokens
- SQL injection vulnerabilities
- XSS vulnerabilities
- Missing input validation
- Insecure dependencies
- Path traversal risks
Code Quality (HIGH):
- Functions > 50 lines
- Files > 800 lines
- Nesting depth > 4 levels
- Missing error handling
- console.log statements
- TODO/FIXME comments
- Missing JSDoc for public APIs
Best Practices (MEDIUM):
- Mutation patterns (use immutable instead)
- Emoji usage in code/comments
- Missing tests for new code
- Accessibility issues (a11y)
Phase 3 — REPORT
Generate report with:
- Severity: CRITICAL, HIGH, MEDIUM, LOW
- File location and line numbers
- Issue description
- Suggested fix
Block commit if CRITICAL or HIGH issues found. Never approve code with security vulnerabilities.
PR Review Mode
Comprehensive GitHub PR review — fetches diff, reads full files, runs validation, posts review.
Phase 1 — FETCH
Parse input to determine PR:
| Input | Action |
|---|---|
Number (e.g. 42) | Use as PR number |
URL (github.com/.../pull/42) | Extract PR number |
| Branch name | Find PR via gh pr list --head <branch> |
gh pr view <NUMBER> --json number,title,body,author,baseRefName,headRefName,changedFiles,additions,deletions
gh pr diff <NUMBER>If PR not found, stop with error. Store PR metadata for later phases.
Phase 2 — CONTEXT
Build review context:
- Project rules — Read
CLAUDE.md,.claude/docs/, and any contributing guidelines - Planning artifacts — Check
.claude/prds/,.claude/plans/,.claude/reviews/, and legacy.claude/PRPs/\{prds,plans,reports,reviews\}/for context related to this PR - PR intent — Parse PR description for goals, linked issues, test plans
- Changed files — List all modified files and categorize by type (source, test, config, docs)
Phase 3 — REVIEW
Read each changed file in full (not just the diff hunks — you need surrounding context).
For PR reviews, fetch the full file contents at the PR head revision:
gh pr diff <NUMBER> --name-only | while IFS= read -r file; do