| name |
pr-review-toolkit |
| description |
Delegated pull request review workflow for Codex that mirrors Anthropic's pr-review-toolkit by launching specialized subagents for general code quality, comment accuracy, test coverage, silent failures and error handling, type design, and post-review simplification. Use when reviewing the current branch, an open GitHub PR, staged or unstaged changes, or an explicit diff. Trigger on requests like "review this PR", "check test gaps", "look for silent failures", "review the docs/comments", "analyze new types", or "suggest simplifications before merge". |
Run a structured pull request review as several focused passes over the same change set. Default to delegated review: one coordinator spawns specialized subagents, each reviews a single aspect, then the coordinator merges their findings. Do not edit code unless the user explicitly asks to apply fixes or simplifications after the review.
- Determine the review scope.
- Select the requested review aspects.
- Launch one specialist subagent per requested aspect.
- Merge findings into one severity-ordered report.
Prefer explicit user scope first. Otherwise inspect local changes:
git status --short
git diff --name-only --cached
git diff --name-only
If the branch has an open GitHub PR and gh is available, prefer the PR diff:
gh pr view --json number,title,baseRefName,headRefName
gh pr diff --name-only
If gh is unavailable, unauthenticated, or no PR exists, fall back to local git diff immediately and state the assumption. Review the actual changed hunks, not just filenames. Keep the scope as narrow as correctness allows.
Map the user request onto these aspect keys:
code: general code review against project rules and likely bugs
comments: accuracy and usefulness of comments and docs
tests: behavioral coverage, regression resistance, and missing cases
errors: silent failures, swallowed errors, fallback behavior, and logging
types: type design, invariants, model boundaries, and illegal states
simplify: refactoring or simplification opportunities that preserve behavior
all: all applicable aspects
Run code on every review unless the user explicitly narrows scope. Run the other aspects when relevant files changed, matching patterns appear in the diff, or the user requested them directly.
Treat simplify as opt-in for edits. In a normal review, report simplification opportunities in the suggestions section. Only modify code when the user explicitly asks to apply them.
Default to spawning specialist subagents when the host exposes the spawn_agent tool. This is the primary execution path, not a nice-to-have. The coordinator owns:
- defining the exact review scope
- selecting aspects
- launching specialists in parallel when independent
- deduplicating overlapping findings
- producing the final merged review
Use one subagent per aspect. Keep each subagent read-only unless the user explicitly asked for fixes.
If spawn_agent is available, do not silently choose local review. Launch the specialists. Fall back to local review only when spawn_agent is unavailable or the user explicitly forbids delegation.
Prefer these launch settings:
agent_type: "explorer" for read-only aspect reviews
fork_context: false when you can restate scope explicitly
fork_context: true only if the current thread contains essential scope details that are hard to restate
reasoning_effort: "medium" by default
Read references/delegation-workflow.md before launching the first specialist.
Read only the reference files needed for the current review:
references/delegation-workflow.md
references/code-reviewer.md
references/comment-analyzer.md
references/pr-test-analyzer.md
references/silent-failure-hunter.md
references/type-design-analyzer.md
references/code-simplifier.md
Each pass should inspect the same diff through a different lens. Avoid duplicate findings unless a second pass adds materially different reasoning.
If delegation is available, spawn all independent aspect reviews before waiting on results. Only wait when aggregation is the next critical step. If delegation is unavailable, run the same aspect passes locally and say that you fell back to single-agent review.
Follow review mode strictly:
- Lead with findings, ordered by severity.
- Include file and line references for every actionable issue.
- Explain why the issue matters and what change would fix it.
- Call out assumptions or scope gaps.
- Include positive observations only after findings.
- If no findings exist, say so explicitly and mention residual risk or unreviewed areas.
Use this severity structure:
- Critical Issues
- Important Issues
- Suggestions
- Positive Observations
- Recommended Next Steps
When the host supports inline review comments, emit one inline comment per finding in addition to the summary.
For every specialist subagent:
- pass the exact repo or directory under review
- pass the exact aspect name
- pass whether to inspect PR diff, staged diff, unstaged diff, or explicit files
- point the subagent at the matching reference file
- require file and line references for every actionable finding
- require review-only mode unless the user asked for code changes
Use these aspect-to-reference mappings:
code -> references/code-reviewer.md
comments -> references/comment-analyzer.md
tests -> references/pr-test-analyzer.md
errors -> references/silent-failure-hunter.md
types -> references/type-design-analyzer.md
simplify -> references/code-simplifier.md
If an aspect is clearly not applicable, skip it and note why in the final summary rather than forcing a low-value review.
Use $pr-review-toolkit to review this branch before I open a PR.
Use $pr-review-toolkit to check tests and error handling for my current diff.
Use $pr-review-toolkit to review new types in this PR.
Use $pr-review-toolkit to suggest simplifications after the review.