Claude auto PR review
Copied from the official Solutions Guide basic example (prompt shortened).
pull_request: opened, synchronize
Est. cost per run~$0.18Checked Oct 16, 2026
Not executedJust shippedOur pick for the best security, implementation, and planning skills.Best skills for each job.See the picks →
Claude reviews each pull request and leaves inline comments on specific lines, with a progress-tracking comment that updates while the review runs.
pull_request: opened, synchronize, ready_for_review, reopened
How it works
Setup
.github/workflows/claude-code-action-pr-review-comprehensive.ymlANTHROPIC_API_KEY. The file reads it as secrets.NAME. Do not paste the key into the YAML.Let your agent do it
Paste it into your coding agent in this repo. It does the setup and asks before anything leaves your machine.
Runs in GitHub Actions on your Claude Pro or Max plan through an OAuth token from claude setup-token. No API credits.
Set up the "Comprehensive PR review with inline comments" GitHub workflow from AgentFlows (https://agentflows.sh/flows/claude-code-action-pr-review-comprehensive) so it runs on my Claude Pro or Max subscription instead of API credits.
Install these agent skills first. Download each SKILL.md from its source (respect its license) into .claude/skills/<name>/SKILL.md, or wherever this agent loads skills from:
- Code review: https://github.com/anthropics/knowledge-work-plugins/blob/main/engineering/skills/code-review/SKILL.md (Apache-2.0), notes at https://agentflows.sh/skills/code-review
- Multi-axis code review before merge: https://github.com/addyosmani/agent-skills/tree/main/skills/code-review-and-quality (MIT), notes at https://agentflows.sh/skills/addyosmani-code-review-and-quality
Save this file as .github/workflows/claude-code-action-pr-review-comprehensive.yml:
```yaml
name: PR Review with Progress Tracking
# This example demonstrates how to use the track_progress feature to get
# visual progress tracking for PR reviews, similar to v0.x agent mode.
on:
pull_request:
types: [opened, synchronize, ready_for_review, reopened]
jobs:
review-with-tracking:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 1
- name: PR Review with Progress Tracking
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
# Enable progress tracking
track_progress: true
# Your custom review instructions
prompt: |
REPO: ${{ github.repository }}
PR NUMBER: ${{ github.event.pull_request.number }}
Perform a comprehensive code review with the following focus areas:
1. **Code Quality**
- Clean code principles and best practices
- Proper error handling and edge cases
- Code readability and maintainability
2. **Security**
- Check for potential security vulnerabilities
- Validate input sanitization
- Review authentication/authorization logic
3. **Performance**
- Identify potential performance bottlenecks
- Review database queries for efficiency
- Check for memory leaks or resource issues
4. **Testing**
- Verify adequate test coverage
- Review test quality and edge cases
- Check for missing test scenarios
5. **Documentation**
- Ensure code is properly documented
- Verify README updates for new features
- Check API documentation accuracy
Provide detailed feedback using inline comments for specific issues.
Use top-level comments for general observations or praise.
# Tools for comprehensive PR review
claude_args: |
--allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)"
# When track_progress is enabled:
# - Creates a tracking comment with progress checkboxes
# - Includes all PR context (comments, attachments, images)
# - Updates progress as the review proceeds
# - Marks as completed when done
```
It authenticates with CLAUDE_CODE_OAUTH_TOKEN. Tell me to run `claude setup-token` in my own terminal to create it, then run `gh secret set CLAUDE_CODE_OAUTH_TOKEN` and let me paste it. Never write the token into a file.
It runs on: pull_request: opened, synchronize, ready_for_review, reopened. Runs count against my subscription's usage limits, and GitHub Actions minutes still apply.
Show me the diff, then commit on a new branch and open a pull request.The file
Copy the file as-is. The notes beside each block explain it.
.github/workflows/claude-code-action-pr-review-comprehensive.yml
Name
The name GitHub shows in the Actions tab. The file path is under Where to paste this.
name: PR Review with Progress Tracking# This example demonstrates how to use the track_progress feature to get# visual progress tracking for PR reviews, similar to v0.x agent mode.Trigger
GitHub starts a run when a pull request is opened, updated with new commits, marked ready for review, or reopened.
on: pull_request: types: [opened, synchronize, ready_for_review, reopened]Jobs
Each job is one runner. The steps inside it run top to bottom.
jobs: review-with-tracking: runs-on: ubuntu-latestPermissions
This token may read the repo, comment on pull requests and open them, and request a GitHub OIDC token. Anything not listed is not granted.
permissions: contents: read pull-requests: write id-token: writeSteps
These steps run in order on that job.
steps: - name: Checkout repository uses: actions/checkout@v6 with: fetch-depth: 1 - name: PR Review with Progress TrackingAgent
Runs Claude Code with anthropics/claude-code-action@v1. Inputs: anthropic_api_key (the Claude API key secret); track_progress (post and update a checklist comment); prompt (the task); claude_args (Claude Code flags, including allowed tools).
uses: anthropics/claude-code-action@v1 with: anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} # Enable progress tracking track_progress: true # Your custom review instructions prompt: | REPO: ${{ github.repository }} PR NUMBER: ${{ github.event.pull_request.number }} Perform a comprehensive code review with the following focus areas: 1. **Code Quality** - Clean code principles and best practices - Proper error handling and edge cases - Code readability and maintainability 2. **Security** - Check for potential security vulnerabilities - Validate input sanitization - Review authentication/authorization logic 3. **Performance** - Identify potential performance bottlenecks - Review database queries for efficiency - Check for memory leaks or resource issues 4. **Testing** - Verify adequate test coverage - Review test quality and edge cases - Check for missing test scenarios 5. **Documentation** - Ensure code is properly documented - Verify README updates for new features - Check API documentation accuracy Provide detailed feedback using inline comments for specific issues. Use top-level comments for general observations or praise. # Tools for comprehensive PR review claude_args: | --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)"# When track_progress is enabled:# - Creates a tracking comment with progress checkboxes# - Includes all PR context (comments, attachments, images)# - Updates progress as the review proceeds# - Marks as completed when doneKeep going
Copied from the official Solutions Guide basic example (prompt shortened).
pull_request: opened, synchronize
Est. cost per run~$0.18Checked Oct 16, 2026
Not executed`track_progress: true` posts a checkbox tracking comment (per Solutions Guide).
pull_request: opened, synchronize, ready_for_review, reopened
Est. cost per run~$0.22Checked Oct 16, 2026
Not executedNo `prompt` → the action runs in tag/interactive mode and responds to the comment. `trigger_phrase` default is `@claude` (usage.md).
issue_comment / pull_request_review_comment containing @claude
Est. cost per run~$0.27Checked Oct 16, 2026
Not executed· 1 caveatWeekly
Workflow changes, skill picks, and measured run costs. One email.