Code review a pull request
Comprehensive multi-agent code review for pull requests. Uses parallel specialized agents to audit for bugs, CLAUDE.md compliance, error handling, tests, types, and comments, then posts detailed findings to GitHub.
/plugin marketplace add jawhnycooke/claude-plugins/plugin install code-review@jawhny-cooke-claude-pluginsProvide a comprehensive code review for the given pull request.
To do this, follow these steps precisely:
Use a Haiku agent to check if the pull request (a) is closed, (b) is a draft, (c) does not need a code review (eg. because it is an automated pull request, or is very simple and obviously ok), or (d) already has a code review from you from earlier. If so, do not proceed.
Use another Haiku agent to give you a list of file paths to (but not the contents of) any relevant CLAUDE.md files from the codebase: the root CLAUDE.md file (if one exists), as well as any CLAUDE.md files in the directories whose files the pull request modified.
Use a Haiku agent to view the pull request and return:
hasErrorHandling: true if try/catch/except/finally/.catch blocks are modifiedhasTestFiles: true if files match test, spec, tests/, tests/hasNewTypes: true if new interface/type/class/struct/enum/@dataclass definitions are introducedhasCommentChanges: true if docstrings, JSDoc comments, or significant inline comments are added/modifiedLaunch parallel Sonnet agents to independently code review. Each agent returns issues with description, reason, and suggested_severity (CRITICAL/HIGH/MEDIUM/LOW).
Core Agents (always run): a. Agent #1: Audit changes for CLAUDE.md compliance. Not all instructions apply during code review. b. Agent #2: Shallow scan for obvious bugs in changes only. Focus on large bugs, avoid nitpicks. c. Agent #3: Read git blame and history to identify bugs in light of historical context. d. Agent #4: Check previous PRs that touched these files for relevant comments. e. Agent #5: Ensure changes comply with guidance in code comments.
Specialized Agents (conditional, run in parallel with core agents): f. Agent #6 (if hasErrorHandling): Use the silent-failure-hunter agent to identify silent failures, inadequate error handling, empty catch blocks, and inappropriate fallback behavior. g. Agent #7 (if hasTestFiles): Use the pr-test-analyzer agent to review test coverage quality, identify critical gaps, and evaluate test quality. h. Agent #8 (if hasNewTypes): Use the type-design-analyzer agent to analyze type encapsulation, invariant expression, and rate type design quality. i. Agent #9 (if hasCommentChanges): Use the comment-analyzer agent to verify comment accuracy, identify misleading documentation, and prevent comment rot.
For each issue found in Step 4, launch a parallel Haiku agent that returns:
Confidence Scale (give this rubric to the agent verbatim):
Severity Definitions:
Filter out any issues with a confidence score less than 80. If there are no issues that meet this criteria, skip to Step 7.
For any issues with confidence scores between 60-85 (borderline):
Use a Haiku agent to repeat the eligibility check from Step 1, to make sure that the pull request is still eligible for code review.
Use the gh bash command to comment back on the pull request. Follow this format precisely:
Found X issues (Y CRITICAL, Z HIGH, W MEDIUM):
CRITICAL [95% confidence]
https://github.com/owner/repo/blob/FULL_SHA/path/file.ext#L10-L15
HIGH [88% confidence] 2. Brief description (category)
https://github.com/owner/repo/blob/FULL_SHA/path/file.ext#L25-L30
MEDIUM [82% confidence, consensus 3/3] 3. Brief description (category)
https://github.com/owner/repo/blob/FULL_SHA/path/file.ext#L45-L50
Or, if no issues found:
No issues found. Checked for bugs, CLAUDE.md compliance, and specialized analysis:
After posting the review comment, if the review passed with no CRITICAL or HIGH issues:
Note: This step is optional and requires user confirmation before proceeding.
gh for all GitHub interactions, not web fetchhttps://github.com/owner/repo/blob/FULL_SHA/file.ext#L10-L15