mcpField

PR Self-Review

FeaturedOn demand
Code QualityUp to 3 rounds

About 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

  1. 01Manual trigger, suited to the step before opening a PR
  2. 02Reviews the output of git diff main...HEAD
  3. 03Capped at 3 rounds, so the length is predictable
  4. 04Supports Claude Code and Cursor

Use cases

  1. 01Going over your own changes before submitting a PR
  2. 02Reducing reviewer time spent on obvious problems
  3. 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.

prompt.md
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.

01
Read the current diff

Look at git diff main...HEAD so the round covers everything the branch changes relative to main.

02
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.

03
Fix critical findings

Edit the code to resolve the critical issues. Non-critical notes can be recorded without blocking the round.

04
Record the round

Note whether any critical findings remain. Stop once three passes are done with none; otherwise start the next round.

Not met → next roundExits when met

Supported agents

Coding agents that can run this loop directly.

Claude Code
Cursor

Comments

Markdown supported