Integration: Automated PR Reviews
Relevant source files
The following files were used as context for generating this wiki page:The automated Pull Request (PR) review system is a quality gate that leverages a GitHub Action to run a specialized Claude agent. This system automatically analyzes changes in a PR, checks them against a predefined set of standards, and posts feedback directly in the PR. The goal is to catch issues related to code quality, conventions, and potential bugs before human review, ensuring consistency and adherence to project standards.
This system is composed of a GitHub Actions workflow that triggers on PR events and a dedicated code-reviewer agent that contains the logic and checklist for the review. It can be triggered automatically when a PR is opened or updated, or manually by mentioning @claude in a PR comment.
Sources: README.md:17-19, .github/workflows/pr-claude-code-review.yml
System Architecture
The automated PR review process is orchestrated by a GitHub Action. The workflow is triggered by events within a pull request, which then executes a job on an ubuntu-latest runner. This job checks out the code, invokes the anthropics/claude-code-action, and passes a prompt instructing it to use the code-reviewer agent. The agent then performs the review and the action posts the results back to the PR.
The following diagram illustrates the high-level data flow of the automated review system.
This diagram shows the process from the initial GitHub event to the final comment posted by the Claude agent.
Sources: .github/workflows/pr-claude-code-review.yml:1-29, README.md:17-19
Core Components
The system is primarily built from two components: the GitHub Actions workflow file and the agent definition file.
GitHub Action Workflow
The workflow is defined in .github/workflows/pr-claude-code-review.yml. It is responsible for listening to the correct GitHub events and running the review job.
Sources: .github/workflows/pr-claude-code-review.yml
Triggers
The workflow is configured to run on two distinct events:
| Event | Types | Condition | Purpose |
|---|---|---|---|
pull_request | opened, synchronize, reopened | N/A | Automatically reviews a PR when it's created, updated, or reopened. |
issue_comment | created | Comment is on a PR and contains @claude. | Allows for manual re-triggering of the review on demand. |
This dual-trigger mechanism provides both fully automated reviews and a manual override for re-analysis.
The logic for these triggers is defined in the on block and the if condition of the job.
on:
pull_request:
types: [opened, synchronize, reopened]
issue_comment:
types: [created]
jobs:
review:
if: |
github.event_name == 'pull_request' ||
(github.event_name == 'issue_comment' &&
github.event.issue.pull_request &&
contains(github.event.comment.body, '@claude'))
Sources: .github/workflows/pr-claude-code-review.yml:2-12
Job Configuration
The review job runs the analysis using the official claude-code-action.
Key steps in the job are:
- Checkout Code: It uses
actions/checkout@v4withfetch-depth: 0to get the full git history, which is necessary for comparing branches. - Run Claude Action: It executes
anthropics/claude-code-action@beta, configuring it with an API key, a specific model, and a prompt.
The prompt explicitly instructs the model to use the local code-reviewer.md agent definition and to run git diff to identify the changes to be reviewed.
- uses: anthropics/claude-code-action@beta
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
model: claude-opus-4-5-20251101
prompt: |
Review this PR using .claude/agents/code-reviewer.md standards.
Run `git diff origin/main...HEAD` to see changes.
Sources: .github/workflows/pr-claude-code-review.yml:17-29
Code Reviewer Agent
The intelligence of the review process is encapsulated in the code-reviewer agent, defined in .claude/agents/code-reviewer.md. This file contains the system prompt that guides the AI model.
Sources: .claude/agents/code-reviewer.md
Agent Configuration
The agent's behavior is configured via frontmatter at the top of the markdown file.
| Field | Value | Description |
|---|---|---|
name | code-reviewer | The unique identifier for the agent. |
description | Reviews code for quality, security, and conventions... | Explains the agent's purpose and when it should be used. |
model | opus | Specifies the Claude model to use for the review, indicating a preference for the most powerful model. |
Sources: .claude/agents/code-reviewer.md:2-5
Agent Process
The agent follows a defined process outlined in its system prompt:
- See Changes: The agent is instructed to run
git diffto get the context of the changes in the PR. - Apply Checklist: It reviews the code against a specific checklist.
- Provide Feedback: It formulates and delivers feedback based on its findings.
This sequence is illustrated in the diagram below.
This diagram shows the internal steps the agent takes upon invocation.
Sources: .claude/agents/code-reviewer.md:9-12
Review Checklist
The core of the review is a checklist defined within the agent's prompt. This ensures that reviews are consistent and cover critical aspects of the codebase.
The checklist includes:
- No TypeScript
any - Error handling is present
- Tests are included
In addition to this explicit checklist, the agent is expected to enforce "Critical Rules" defined in the project's CLAUDE.md file, such as:
- Never swallowing errors silently.
- Handling all UI states (loading, error, empty, success).
- Disabling buttons during async mutation operations.
Sources: .claude/agents/code-reviewer.md:14-17, CLAUDE.md:29-41
Related Commands
While the primary mechanism is automated, the repository also includes a manual slash command for PR reviews. The /pr-review command can be used to invoke a similar review process. This command is defined in .claude/commands/pr-review.md.
Sources: README.md:373-374, .claude/commands/pr-review.md
Summary
The automated PR review system is a powerful integration that acts as a proactive quality assurance mechanism. By combining the event-driven nature of GitHub Actions with the analytical capabilities of a specialized Claude agent, the project ensures that all code contributions are automatically vetted against a consistent and comprehensive set of standards. This reduces the burden on human reviewers, improves code quality, and accelerates the development cycle.
Sources: README.md:17-19