PR Self-Review
FeaturedOn demandAbout PR Self-Review
This loop has a coding agent review its own branch before a PR is opened, using the diff of the current branch against main. Each round reads git diff main...HEAD, looks for problems and deals with the critical ones. It is started manually, runs at most 3 rounds, and aims for three review passes with no critical findings.
Key features
- 01Manual trigger, suited to the step before opening a PR
- 02Reviews the output of git diff main...HEAD
- 03Capped at 3 rounds, so the length is predictable
- 04Supports Claude Code and Cursor
Use cases
- 01Going over your own changes before submitting a PR
- 02Reducing reviewer time spent on obvious problems
- 03Larger branches where several passes help catch missed issues
- Goal
- Three self-review passes of the current diff are completed, none with critical findings.
- Exit when
- Stop when three passes are complete with no critical findings.
- Between iterations run
- git diff main...HEAD
Launch prompt
Paste into Claude Code / Cursor. The agent repeats the steps below until the exit condition is met.
Start the "PR Self-Review" loop. Goal: Three self-review passes of the current diff are completed, none with critical findings. Max iterations: 3. Step 1: Read the current diff — Look at git diff main...HEAD so the round covers everything the branch changes relative to main. Step 2: Review each change — Go through the diff for logic errors, omissions and anything else that could block a merge, and mark which findings are critical. Step 3: Fix critical findings — Edit the code to resolve the critical issues. Non-critical notes can be recorded without blocking the round. Step 4: Record the round — Note whether any critical findings remain. Stop once three passes are done with none; otherwise start the next round. Between iterations run: `git diff main...HEAD` Exit when: Stop when three passes are complete with no critical findings.
Steps
Each round runs in order; if the exit condition isn’t met, another round starts, up to 3.
Look at git diff main...HEAD so the round covers everything the branch changes relative to main.
Go through the diff for logic errors, omissions and anything else that could block a merge, and mark which findings are critical.
Edit the code to resolve the critical issues. Non-critical notes can be recorded without blocking the round.
Note whether any critical findings remain. Stop once three passes are done with none; otherwise start the next round.
Supported agents
Coding agents that can run this loop directly.