← Blog · · ai · github · automation · claude
Auto-resolving bugs by reading PRs with Claude: my GitHub Actions setup
How I built a workflow that reviews every PR, detects the bug it introduces and proposes the fix before I even open it. Real, in production, no hype.
One of the things that saves me the most time: Claude reviews PRs before I do. It doesn’t just comment on the obvious — it detects the pattern of the bug being introduced and, in many cases, proposes the commit that fixes it.
Here’s the real workflow, step by step.
Why this flow, not Copilot Review
GitHub Copilot Review is fine for syntax and patterns, but when you integrate a multi-file project with dependencies between features, Claude delivers qualitatively better reviews. It sees the PR like a senior human: “this breaks pattern X used in lib/foo.ts, and test Y doesn’t cover the new branch.”
The workflow
.github/workflows/claude-review.yml:
name: Claude PR Review
on:
pull_request:
types: [opened, synchronize]
jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 0 }
- name: Run Claude review
uses: anthropics/claude-code-action@v2
with:
api-key: ${{ secrets.ANTHROPIC_API_KEY }}
mode: review
target-branch: ${{ github.event.pull_request.base.ref }}
With this, every time you open or push to a PR, an action grabs the diff, sends it to Claude, and asks for a review. Comments appear as inline review comments on the PR.
The prompt that makes the difference
The default prompt is fine, but I add project context:
“You’re reviewing a PR from the enriccivit.com repo. The stack is Astro + React + Tailwind + Supabase. Conventions: server components by default, copy never hardcoded, everything i18n. If you see: (1) a pattern inconsistent with the rest of the repo, (2) a test that doesn’t cover the change, (3) a potential regression — comment it. Be concise. Don’t comment on unimportant nits.”
The bonus: auto-proposed fix
When Claude detects an obvious bug (typo, unchecked null, broken dependency), it doesn’t just comment — it opens a commit in a secondary branch with the proposed fix. If it makes sense, I cherry-pick and ship.
What I do NOT do
- Auto-merge based on Claude. I’m still the one who reviews and merges.
- Trust reviews on migration/infra critical changes. Those I review manually.
The real savings
Before I spent 10-15 minutes per PR on deep review. Now I spend 3 minutes: half is already done by Claude, I just confirm or discuss.
Want this flow on your team or personal repo? I’ll set it up for you in a call.