# How to Automate PR Review with Specialized Agents in Claude Code

> Automate PR reviews with Claude Code's specialized agents. Discover how the pr-review-toolkit plugin analyzes Git changes and generates markdown reports for efficient code review.

- Repository: [Anthropic/claude-code](https://github.com/anthropics/claude-code)
- Tags: how-to-guide
- Published: 2026-04-02

---

**Claude Code ships with a `pr-review-toolkit` plugin that runs six specialized agents via the `review-pr` command to automatically analyze Git changes and generate structured markdown reports.**

The `anthropics/claude-code` repository includes a powerful automation framework for pull request validation. By leveraging the `pr-review-toolkit` plugin, you can orchestrate multiple specialized LLM agents to analyze code quality, test coverage, documentation accuracy, and type safety in a single command.

## What Is the PR Review Toolkit?

The **pr-review-toolkit** is a Claude Code plugin defined in [`plugins/pr-review-toolkit/.claude-plugin/plugin.json`](https://github.com/anthropics/claude-code/blob/main/plugins/pr-review-toolkit/.claude-plugin/plugin.json). It registers a suite of purpose-built agents and the `review-pr` command that drives the entire workflow. The toolkit inspects your current Git changes, intelligently selects which agents to invoke based on file modifications, and aggregates their findings into a concise review summary.

The orchestration logic resides in [`plugins/pr-review-toolkit/commands/review-pr.md`](https://github.com/anthropics/claude-code/blob/main/plugins/pr-review-toolkit/commands/review-pr.md), which handles scope detection, agent dispatch, and result formatting.

## The Six Specialized Review Agents

Each agent is a specialist LLM defined in its own markdown file with YAML front-matter that specifies the model configuration and detailed analysis prompts.

### Code Reviewer

The **code-reviewer** agent ([`plugins/pr-review-toolkit/agents/code-reviewer.md`](https://github.com/anthropics/claude-code/blob/main/plugins/pr-review-toolkit/agents/code-reviewer.md)) performs general code quality analysis. It runs by default on every PR review to catch logic errors, security issues, and maintainability concerns.

### PR Test Analyzer

The **pr-test-analyzer** agent ([`plugins/pr-review-toolkit/agents/pr-test-analyzer.md`](https://github.com/anthropics/claude-code/blob/main/plugins/pr-review-toolkit/agents/pr-test-analyzer.md)) validates test coverage and quality. It activates automatically when the toolkit detects changes to test files, ensuring new code includes adequate verification.

### Comment Analyzer

The **comment-analyzer** agent ([`plugins/pr-review-toolkit/agents/comment-analyzer.md`](https://github.com/anthropics/claude-code/blob/main/plugins/pr-review-toolkit/agents/comment-analyzer.md)) checks documentation accuracy. It triggers when you add or modify comments, verifying that inline documentation correctly describes the implementation.

### Silent Failure Hunter

The **silent-failure-hunter** agent ([`plugins/pr-review-toolkit/agents/silent-failure-hunter.md`](https://github.com/anthropics/claude-code/blob/main/plugins/pr-review-toolkit/agents/silent-failure-hunter.md)) searches for suppressed errors and swallowed exceptions. It activates when error handling code changes, catching potential debugging nightmares before they reach production.

### Type Design Analyzer

The **type-design-analyzer** agent ([`plugins/pr-review-toolkit/agents/type-design-analyzer.md`](https://github.com/anthropics/claude-code/blob/main/plugins/pr-review-toolkit/agents/type-design-analyzer.md)) reviews TypeScript or Python type definitions. It launches when you modify type annotations to ensure your type system remains sound and expressive.

### Code Simplifier

The **code-simplifier** agent ([`plugins/pr-review-toolkit/agents/code-simplifier.md`](https://github.com/anthropics/claude-code/blob/main/plugins/pr-review-toolkit/agents/code-simplifier.md)) suggests refactoring opportunities. It runs after other agents complete successfully to identify redundant logic and complexity reductions.

## How the Review Workflow Orchestrates Agents

The `review-pr` command implements a three-stage pipeline for automated PR analysis.

### Scope Detection and Aspect Mapping

First, the command executes `git diff --name-only` to identify changed files. It then maps file extensions and change types to specific agents:

- **Always**: `code-reviewer` runs on every review
- **Test files changed**: Activates `pr-test-analyzer`
- **New/modified comments**: Triggers `comment-analyzer`
- **Updated error handling**: Invokes `silent-failure-hunter`
- **New/changed type definitions**: Launches `type-design-analyzer`
- **Clean pass**: Suggests `code-simplifier` for polish

You can override this automatic mapping by explicitly requesting aspects: `comments`, `tests`, `errors`, `types`, `code`, `simplify`, or `all`.

### Execution Modes: Sequential vs Parallel

The toolkit supports two execution strategies defined in [`commands/review-pr.md`](https://github.com/anthropics/claude-code/blob/main/commands/review-pr.md).

**Sequential mode** (default) runs agents one after another. This produces easier-to-read output where each report builds on the previous analysis.

**Parallel mode** runs all selected agents simultaneously. Enable this with the `parallel` flag for faster feedback when running the full agent suite.

### Result Aggregation and Reporting

After agent execution completes, `review-pr` aggregates findings into a structured markdown summary. The output organizes discoveries into four categories:

- **Critical**: Issues requiring immediate fixes
- **Important**: Significant concerns that should be addressed
- **Suggestions**: Optional improvements for code quality
- **Strengths**: Positive patterns to maintain

The final report includes an actionable plan for addressing identified issues.

## Command Reference and Usage Examples

### Run a Full Automated Review

Execute all applicable agents sequentially:

```text
/pr-review-toolkit:review-pr

```

Claude Code detects your changed files, runs the quality checks, and returns a complete markdown summary.

### Focus on Specific Aspects

Target only test coverage and error handling:

```text
/pr-review-toolkit:review-pr tests errors

```

This launches only the `pr-test-analyzer` and `silent-failure-hunter` agents.

### Parallel Execution for Speed

Run every applicable agent simultaneously:

```text
/pr-review-toolkit:review-pr all parallel

```

All agents execute concurrently, and the final summary emits when the last agent finishes.

### Invoke a Single Agent Manually

Run one specialist without the full suite:

```text
/agents comment-analyzer

```

Use this when you only need to validate documentation changes without general code review.

## CI/CD Integration

Embed the toolkit into your continuous integration pipeline to automate PR feedback:

```bash

# Fetch the PR branch

git fetch origin pull/${PR_NUMBER}/head:pr-${PR_NUMBER}
git checkout pr-${PR_NUMBER}

# Generate the review

claude run /pr-review-toolkit:review-pr all > pr-review-summary.md

# Post to GitHub

gh pr comment "$PR_NUMBER" --body-file pr-review-summary.md

```

This workflow captures the structured markdown output and posts it directly as a PR comment using the GitHub CLI.

## Summary

- The `pr-review-toolkit` plugin in `anthropics/claude-code` provides automated PR review through the `review-pr` command.
- Six specialized agents handle specific quality dimensions: code review, testing, comments, error handling, types, and simplification.
- The toolkit automatically maps Git changes to relevant agents via `git diff --name-only` analysis.
- Execute agents sequentially for readability or in parallel for speed using the `parallel` flag.
- Results aggregate into categorized markdown reports: Critical, Important, Suggestions, and Strengths.

## Frequently Asked Questions

### How does Claude Code decide which agents to run during a PR review?

The `review-pr` command executes `git diff --name-only` to list changed files, then maps file extensions and modification types to specific agents. Test files trigger the test analyzer, comment changes activate the comment analyzer, and error handling updates invoke the silent failure hunter. You can override automatic selection by passing specific aspect keywords like `tests`, `errors`, or `all` to the command.

### Can I run the PR review toolkit in parallel for faster results?

Yes. Append the `parallel` flag to your command: `/pr-review-toolkit:review-pr all parallel`. This launches all selected agents simultaneously rather than sequentially, significantly reducing total execution time while maintaining the same quality of analysis in the final aggregated report.

### What file paths define the specialized agents in the Claude Code repository?

Each agent definition lives in `plugins/pr-review-toolkit/agents/`. The specific files are [`code-reviewer.md`](https://github.com/anthropics/claude-code/blob/main/code-reviewer.md) for general quality, [`pr-test-analyzer.md`](https://github.com/anthropics/claude-code/blob/main/pr-test-analyzer.md) for test coverage, [`comment-analyzer.md`](https://github.com/anthropics/claude-code/blob/main/comment-analyzer.md) for documentation, [`silent-failure-hunter.md`](https://github.com/anthropics/claude-code/blob/main/silent-failure-hunter.md) for error handling, [`type-design-analyzer.md`](https://github.com/anthropics/claude-code/blob/main/type-design-analyzer.md) for type systems, and [`code-simplifier.md`](https://github.com/anthropics/claude-code/blob/main/code-simplifier.md) for refactoring suggestions. The orchestration command resides in [`plugins/pr-review-toolkit/commands/review-pr.md`](https://github.com/anthropics/claude-code/blob/main/plugins/pr-review-toolkit/commands/review-pr.md).

### How can I integrate automated PR review into my CI pipeline?

Use the `claude run` CLI to execute the toolkit after checking out a PR branch. Capture the markdown output to a file, then post it as a PR comment using your platform's CLI tool (such as `gh pr comment` for GitHub). This embeds structured, AI-generated quality checks directly into your existing continuous integration workflow without manual intervention.