Skip to content
cccskills
FreePublished on GitHub

review-pr

Review a pull request for code quality, correctness, security, tests, and documentation. Receive structured findings ranked by severity, with file references, approval status, positive highlights, and questions that need clarification.

OriginalShow the original description

Perform a comprehensive code review of a pull request

See how to install

Good for

  • Reviewing a pull request before merging
  • Checking changes against the original plan
  • Auditing error handling and validation of AI output
  • Fixing straightforward issues and reviewing again

Files included (1)

  • SKILL.md9.0 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

Review pull request

Perform a comprehensive code review of a pull request.

Instructions

  1. Get PR information: gh pr view $ARGUMENTS --json title,body,files,additions,deletions
  2. Review each changed file
  3. Provide structured feedback

Review checklist

Code quality

  • Code is readable and well-organized
  • Functions are appropriately sized
  • No code duplication
  • Meaningful variable/function names

Functionality

  • Logic is correct
  • Edge cases handled
  • Error handling is comprehensive
  • No obvious bugs

Security

  • No hardcoded secrets
  • Input validation present
  • No injection vulnerabilities
  • Authorization checks in place

Testing

  • Tests added for new code
  • Existing tests still pass
  • Edge cases tested

Documentation

  • Code is self-documenting or commented
  • README updated if needed
  • API changes documented

Output format

## PR Review: #[number] - [title]

### Summary
[1-2 sentence overview]

### Approval Status
[ ] Approved
[ ] Approved with suggestions
[ ] Changes requested

### Findings

#### Critical (Must Fix)
- [ ] [Issue description] - `file:line`

#### Suggestions (Should Consider)
- [ ] [Improvement] - `file:line`

#### Nitpicks (Optional)
- [ ] [Minor suggestion] - `file:line`

### Positive Highlights
- [What's done well]

### Questions
- [Clarifications needed]

Usage

/review-pr 123
/review-pr https://github.com/owner/repo/pull/123

Advanced: Multi-Agent review

For production-grade reviews requiring specialized perspectives and anti-hallucination safeguards.

Pre-flight Check

Before reviewing, check if this is a follow-up pass to avoid repeating suggestions:

# Detect if Claude already reviewed this PR
git log --oneline -10 | grep "Co-Authored-By: Claude"

If detected, note: "This appears to be a follow-up pass. I'll focus on new issues and avoid repeating previous suggestions."

Scope drift detection

Cross-reference the PR diff against the original plan to catch unintended changes.

# Detect current branch
BRANCH=$(git branch --show-current)

# Search for a plan file associated with this branch
ls ~/.claude/plans/ 2>/dev/null | grep -i "$BRANCH" | head -3

# Files actually changed in this PR
git diff --stat origin/main...HEAD | head -30

If a plan file exists for this branch:

  1. Read the plan file: what was the stated scope?
  2. Compare stated scope vs actual git diff --stat
  3. Flag files changed that were NOT mentioned in the plan

Output format:

SCOPE DRIFT CHECK
─────────────────────────────────────────
Plan scope:    [what the plan said would change]
Actual diff:   [files actually changed]
Drift:         [files changed outside plan scope, if any]
Verdict:       IN SCOPE / DRIFT DETECTED

If no plan file exists: note "No plan file found for this branch, skipping scope drift check."

Multi-agent specialization

Launch 3 parallel specialized agents (see Split Role Sub-Agents):

Agent 1: Consistency Auditor

Focus: DRY violations, duplicate logic, pattern inconsistencies
Check for:
- Duplicated code blocks (>5 lines similar)
- Inconsistent naming conventions
- Pattern violations (if project uses X pattern, enforce it)

Agent 2: SOLID Principles Analyst

Focus: Single Responsibility Principle violations, complexity
Check for:
- Functions >50 lines (likely doing too much)
- Nested conditionals >3 levels deep
- Cyclomatic complexity >10
- Mixed concerns in single component

Agent 3: Defensive Code Auditor

Focus: Silent failures, masked bugs, hidden fallbacks, LLM output trust boundary
Check for:
- Empty catch blocks: try { } catch (e) { } // swallows error
- Silent fallbacks: return data || DEFAULT // hides missing data
- Unchecked null/undefined: user.name without validation
- Ignored promise rejections: async fn without .catch()

LLM Output Trust Boundary (especially relevant in AI-assisted codebases):
- LLM-generated values (emails, URLs, names, IDs) written to DB or passed to
  downstream functions without format validation; add lightweight guards
  (email regex, URL parsing, .trim()) before persisting
- Structured tool output (arrays, objects from AI tools) accepted without
  type/shape checks before database writes or rendering
- AI-generated SQL or code strings executed without sanitization

Anti-hallucination rules

Verify before asserting:

  • Use Grep or Glob to verify patterns before recommending them
  • If suggesting "use existing UserService pattern", confirm UserService exists first
  • Never claim "project uses X" without checking actual codebase

Occurrence rule:

  • Pattern with >10 occurrences = established (Suggestion level)
  • Pattern with <3 occurrences = not established (Can Skip or ask maintainer)
  • Read full file context, not just diff lines

Uncertainty markers:

  • Use "❓ To verify:" when unsure about project conventions
  • Use "💡 Consider:" for optional improvements
  • Use "🔴 Must fix:" only for critical bugs/security

Reconciliation

After agents report findings:

  1. Deduplicate: Remove overlapping suggestions across agents
  2. Prioritize existing patterns: If codebase uses pattern X, recommend X (not ideal pattern Y)
  3. Mark skipped suggestions: "Skipping [suggestion] because project uses [alternative pattern]"
  4. Track reasoning: Document why suggestion was kept or skipped

Severity classification

🔴 Must Fix (Blockers)
- Security vulnerabilities
- Data loss risks
- Breaking changes without migration
- Silent failures masking bugs

🟡 Should Fix (Improvements)
- SOLID violations causing maintenance issues
- DRY violations (>3 duplicates)
- Performance bottlenecks (N+1 queries)
- Missing error handling for critical paths

🟢 Can Skip (Nice-to-haves)
- Style inconsistencies (if no linter)
- Minor naming improvements
- Overly nested code (if <3 levels)
- Documentation gaps (if code self-documenting)

Fix-first heuristic

Determine whether to auto-fix each finding or surface it for user decision.

AUTO-FIX (apply without asking):          ASK (needs human judgment):
├─ Dead code / unused variables            ├─ Security changes (auth, XSS, injection)
├─ N+1 queries (missing eager loading)     ├─ Race conditions
├─ Stale comments contradicting code       ├─ Design decisions
├─ Magic numbers → named constants         ├─ Large fixes (>20 lines changed)
├─ Missing import / path mismatches        ├─ Enum completeness
├─ Variables assigned but never read       ├─ Anything removing functionality
└─ Obvious version/doc mismatches          └─ User-visible behavior changes

Rule: If a senior engineer would apply the fix in 30 seconds without discussion, it's AUTO-FIX. If reasonable engineers could disagree, it's ASK.

After agents report findings:

  1. Apply all AUTO-FIX items immediately with minimal targeted edits
  2. Batch all ASK items into a single user decision (not one question per item)

Auto-Fix loop (optional)

For automated convergence:

Review → Identify issues → Fix → Re-review → Repeat until minimal changes

Safeguards:
- Max 3 iterations to prevent infinite loops
- Run tsc/lint check before each iteration
- Skip auto-fix for protected files (package.json, migrations, etc.)

Example prompt:

Review this PR with auto-fix enabled:
1. Review using 3 agents above
2. Fix all 🔴 Must Fix issues
3. Re-review to verify fixes
4. Repeat for 🟡 Should Fix (max 2 more iterations)
5. Stop when only 🟢 Can Skip remain

Conditional context loading

Load additional context based on diff content (stack-agnostic):

If diff contains...Then check...
Database queriesIndexes, N+1 patterns, query optimization
API endpointsAuth middleware, input validation, rate limiting
Authentication logicPassword hashing, session management, CSRF tokens
File uploadsSize limits, MIME validation, storage security
Date/time operationsTimezone handling, DST edge cases
External API callsTimeout configs, retry logic, error handling
Environment variablesPresence in .env.example, validation at startup

Integration with existing tools

SE-CoVe Plugin: Use for general fact-checking of review claims (complementary to anti-hallucination rules above)

Worktrunk: For codebase-wide pattern analysis before suggesting changes

AST-grep: For structural pattern matching (e.g., find all similar try/catch blocks)


Sources

  • Base template: Claude Code Ultimate Guide
  • Multi-agent review: Pat Cullen (Jan 2026)
  • Anti-hallucination patterns: Méthode Aristote code review system

$ARGUMENTS

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Evaluate Claude Code agents, skills, and commands with weighted quality criteria. Get scores, readiness grades, template comparisons, and practical improvement suggestions in Markdown or JSON reports to guide reviews before release.

  • Review skills before release
  • Compare agent definitions with reference templates
  • Quickly check critical quality criteria
FlorianBruniaux/claude-code-ultimate-guide6.2KUpdated Oct 18, 2026

audit-codebase

FreeSummary

Assess a codebase across seven areas, including exposed credentials, security, dependencies, structure, and tests. Receive category scores, findings tied to file locations, and a prioritized improvement plan with smaller tasks that can be completed quickly.

  • Assessing the overall health of an inherited project
  • Reviewing exposed credentials and security risks
  • Identifying dependency and test coverage gaps
FlorianBruniaux/claude-code-ultimate-guide6.2KUpdated Oct 18, 2026

autoresearch

FreeSummary

Measure code patterns such as casts to any or disabled lint rules, then run repeated, targeted edits. Keep changes that improve the chosen metric, revert unsuccessful changes, and track results for each improvement loop.

  • Finding code patterns to prioritize for cleanup
  • Preparing measurement files for an improvement loop
  • Repeating targeted edits to reduce casts to any
FlorianBruniaux/claude-code-ultimate-guide6.2KUpdated Oct 18, 2026

best-of-n

FreeSummary

Generate several separate solutions, compare them against criteria fixed in advance, and verify the selected result through executable checks or an independent reviewer. Keep a proof log documenting candidates, evidence, failures, and remaining limits.

  • Comparing implementation options before choosing one
  • Verifying a solution when a wrong choice would be costly
  • Keeping evaluation evidence for delivery or audit
FlorianBruniaux/claude-code-ultimate-guide6.2KUpdated Oct 18, 2026

canary

FreeSummary

Monitor a live application after deployment and compare it with a saved baseline, a record of its earlier state. Check page responses, loading times, and new errors, flag persistent changes, and produce a per-page health report.

  • Recording a healthy baseline before deployment
  • Monitoring production immediately after deployment
  • Checking key pages for slower responses or failures
FlorianBruniaux/claude-code-ultimate-guide6.2KUpdated Oct 18, 2026

catchup

FreeSummary

Rebuild project context after clearing a conversation or returning to work. Review recent Git history, uncommitted changes, and TODO markers to get a structured summary of project status and suggested next steps.

  • Restoring project context after /clear
  • Reviewing recent changes after a long break
  • Checking unfinished work before choosing the next task
FlorianBruniaux/claude-code-ultimate-guide6.2KUpdated Oct 18, 2026

See all skills by FlorianBruniaux

Report a problem with this skill