Comprehensive PR review using 6 specialized agents for comments, tests, error handling, types, code quality, and simplification.
Run a thorough pull request review using multiple specialized agents, each focusing on a different aspect of code quality.
Optional arguments to filter which reviews to run:
comments - Analyze code comment accuracy and maintainabilitytests - Review test coverage quality and completenesserrors - Check error handling for silent failurestypes - Analyze type design and invariantscode - General code review for bugs and qualitysimplify - Simplify code for clarity and maintainabilitysecurity - Check for security vulnerabilitiesall - Run all applicable reviews (default)parallel - Launch all agents in parallel (faster)Examples:
/pr-review # Full review, sequential
/pr-review tests errors # Only test coverage and error handling
/pr-review all parallel # Full review, parallel execution
/pr-review simplify # Just code simplification
# Get changed files
git diff --name-only main...HEAD 2>/dev/null || git diff --name-only HEAD~5
# Get the actual diff (CRITICAL: agents must only review lines in this diff)
git diff main...HEAD 2>/dev/null || git diff HEAD~5
Find and read relevant CLAUDE.md files:
# Root CLAUDE.md
cat CLAUDE.md 2>/dev/null || true
# CLAUDE.md in directories with changed files
# For each changed directory, check for CLAUDE.md
Extract relevant guidelines that apply to code review (not all instructions apply - focus on code style, patterns, and conventions).
CRITICAL INSTRUCTION FOR ALL AGENTS:
Every agent MUST receive these instructions:
IMPORTANT: Only report issues on lines that were ADDED or MODIFIED in this diff.
Do NOT report:
- Pre-existing issues in unchanged code
- Issues on lines that were not modified
- Problems that existed before this change
The diff shows + for added lines and - for removed lines. Only flag issues on + lines.
Sequential (default): Run one at a time for easier action
Parallel (with parallel arg): Launch all at once for speed
Use Task (subagent_type: Explore) for all review agents — they are read-only.
If the diff is too large to pass in one prompt, split by changed file and send per-file diff chunks to separate agents, then merge results.
For each agent, use this template:
Task (subagent_type: Explore): "[AGENT_NAME] REVIEW
CRITICAL: Only report issues on lines ADDED or MODIFIED in this diff (+ lines).
Do NOT report pre-existing issues or problems in unchanged code.
Project guidelines from CLAUDE.md:
[relevant guidelines]
Diff to review:
[paste diff]
[Agent-specific instructions]
For each issue found, provide:
1. File and line number
2. Issue description
3. Confidence score (0-100):
- 0-25: Likely false positive, doesn't hold up to scrutiny
- 26-50: Might be real, but could be intentional or a nitpick
- 51-75: Likely real issue, but may not happen often in practice
- 76-90: Verified real issue that will impact functionality
- 91-100: Definitely a bug/problem, confirmed with evidence
Output format:
[CONFIDENCE: XX] file:line - description"
Execution discipline:
After collecting all agent responses:
Only report issues with confidence ≥ 75%.
Filter out:
Create summary with only high-confidence issues:
# PR Review Summary
**Files reviewed:** [count] **Issues found:** [count] (filtered from [total] raw findings)
## Critical Issues (confidence ≥ 91)
- [file:line] Issue description
## Important Issues (confidence 75-90)
- [file:line] Issue description
## Passed Checks
- [list of agents that found no issues]
## Strengths
- [what's done well in this change]
If no issues pass the confidence threshold: "No significant issues found."
Focus: General code review for project guidelines
Focus: Security vulnerabilities
Focus: Error handling
Focus: Test coverage
Focus: Type design (TypeScript/typed languages)
Focus: Documentation accuracy
Focus: Code simplification (run last)
Train agents to ignore these: