pr-review-loop
Skill851 starsChanged 21 months agoMITView on GitHub
This skill should be used when the user asks to "open a PR", "submit a PR", "get a review", "address review comments", "drive the PR through review", or says the code work is done and ready for review in the Dev Proxy repository. Opens a pull request to dotnet/dev-proxy main with the gh CLI, requests a GitHub Copilot code review, and repeats fix-and-re-review rounds until a stop condition is met. Never merges.
- Commits and pushes
20 other projects use a version of this.
Adopted by
Most recently taken up by
- cubeplexai/cubeplextheir own version, first seen Nov 29, 2026
- GavinGreenwood/agentic-workflow-templatetheir own version, first seen Nov 24, 2026
- xpepper/pr-review-agent-skilltheir own version, first seen Nov 21, 2026
- ksprashu/agent-skill-forgetheir own version, first seen Nov 8, 2026
- tloncorp/tlon-appstheir own version, first seen Nov 2, 2026
- gabonio/agent-operator-toolkittheir own version, first seen Nov 1, 2026
Other versions20 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 20
- basicmachines-co/basic-memory★ 4.8ksame name
- cubeplexai/cubeplex★ 595same name
- phase-rs/phase★ 340same name
- tloncorp/tlon-apps★ 111same name
- fagemx/gstack-game★ 68same name
- fagemx/edda★ 36same name
- xpepper/pr-review-agent-skill★ 6same name
- GavinGreenwood/agentic-workflow-template★ 5same name
- ksprashu/agent-skill-forge★ 3same name
- adevra/claude-pr-review-loop★ 2same name
10 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository5 other files it gives its agents.
- .github/copilot-instructions.mdCopilot instructions
- publish-to-wingetSkill
- test-prSkill
- upgrade-devproxy-versionSkill
- dev-proxySkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. 0 are common, 9 are distinctive, and 4 are very specific to this project.
0
Common
Most of the 18 edited versions we read keep these.
9
Distinctive
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 27
Stop the loop and report to the user when any of these is true:
- Distinctive: line 66
Check whether a pull request from the branch to main is already open:
- Distinctive: line 109
Run the same commands to re-request a review in later rounds.
- Very specific: line 139
If REVIEW is empty or checks are still pending, stop (stop condition 5).
- Very specific: line 141
If CI failed, read the logs (gh run view <run-id> --repo "$UPSTREAM" --log-failed) and fix the cause together with the review comments in …
- Distinctive: line 145
If the review has no new inline comments, its body reports no findings you haven't addressed, and CI is green, stop (stop condition 1).
- Distinctive: line 168
Verify each claim against the code before acting on it.
- Distinctive: line 175
If a fix needs a decision from a human, stop (stop condition 4) and ask.
- Very specific: line 177
After you push the fixes (Step 6), reply to every thread.
- Distinctive: line 191
When you decline a suggestion, reply with the reason and leave the thread unresolved, so that a maintainer can decide.
- Very specific: line 202
Commit with a message that describes the fixes, and push: git push origin "$BRANCH"
- Distinctive: line 204
If nothing changed in this round, stop (stop condition 6)
- Distinctive: line 209
When the loop stops, report to the user:
“Common” is measured: kept by at least 6 in 10 of the 18 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
PR Review Loop
Open a pull request, get a Copilot code review, address the feedback, and repeat until the review comes back clean or a stop condition is hit.
Guardrails
These stay with a human. Never:
- Merge, close, or approve the pull request, or enable auto-merge
- Change repository settings, rulesets, branch protection, secrets, or release and deployment workflows
- Force-push over someone else's commits or rewrite the history of the base branch
- Dismiss reviews, or resolve threads you didn't address
Stop Conditions
Stop the loop and report to the user when any of these is true:
- Clean review: the latest Copilot review of the current head commit has no new inline comments and its body reports no unaddressed findings, CI is green, and every earlier thread and review-body finding is resolved or has your reply
- Round limit: 20 review rounds have been completed
- Repeated CI failure: the same CI check fails 3 times in a row with the same error
- Stuck: a fix needs a decision from a human (design choice, behavior change, scope change). Ask; don't guess
- Timeout: Copilot hasn't submitted a review, or CI hasn't finished, 30 minutes after the review was requested
- Nothing left to review: a round produced only advisory comments that you declined, so no code changed
Prerequisites
ghCLI 2.87 or newer (addsgh pr edit --add-reviewer @copilot), signed in (gh auth status) with access to the fork and todotnet/dev-proxy- Remotes:
upstreampoints todotnet/dev-proxy,originpoints to your fork - Work is committed on a feature branch (not
main)
Set these once and reuse them in the commands below:
UPSTREAM=dotnet/dev-proxy
FORK_OWNER=$(gh api user --jq .login)
BRANCH=$(git branch --show-current)Process
Step 1: Verify Locally
Restore in locked mode (like CI, so stale lock files fail instead of being updated), then build and run the tests. Fix any failures before you continue.
dotnet restore DevProxy.sln --locked-mode
dotnet build DevProxy.sln --no-restore
dotnet test DevProxy.slnSkip this step for documentation-only changes.
Step 2: Open the Pull Request
Check whether a pull request from the branch to main is already open:
PR=$(gh pr list --repo "$UPSTREAM" --head "$BRANCH" --base main --state open \
--json number,headRepositoryOwner \
--jq ".[] | select(.headRepositoryOwner.login==\"$FORK_OWNER\") | .number")If PR is set, reuse it. Unresolved inline threads from earlier rounds come up again in Step 5, but findings that Copilot reported only in a review body don't. Before continuing, read the bodies of the earlier Copilot reviews and the PR comments, which hold your earlier replies to such findings:
gh pr view "$PR" --repo "$UPSTREAM" --json reviews,comments \
--jq '(.reviews[] | select(.author.login=="copilot-pull-request-reviewer") | {submittedAt, body}),
(.comments[] | {author: .author.login, body})'Address every body finding that has neither a fix nor a reply, as described at the end of Step 5. Then push any new commits (git push origin "$BRANCH") and continue with Step 3.
Otherwise, rebase on the latest upstream main and push the branch to the fork. Only rebase a branch that hasn't been pushed yet. Once it's published, don't rewrite its history; if it needs upstream changes, merge upstream/main instead.
git fetch upstream main
git rebase upstream/main
git push -u origin "$BRANCH"Open the pull request against upstream main. Describe what changed and why, and reference the issue it closes (Closes #123):
gh pr create --repo "$UPSTREAM" --base main --head "$FORK_OWNER:$BRANCH" \
--title "<title>" --body-file <path-to-description.md>
PR=$(gh pr view "$FORK_OWNER:$BRANCH" --repo "$UPSTREAM" --json number --jq .number)Step 3: Request a Copilot Review
Record the request time first, so that an earlier review of the same commit isn't mistaken for the new one:
REQUESTED_AT=$(date -u +%Y-%m-%dT%H:%M:%SZ)
gh pr edit "$PR" --repo "$UPSTREAM" --add-reviewer "@copilot"Run the same commands to re-request a review in later rounds. Each request counts as one round.
Step 4: Wait for CI and the Review
Poll CI and the review together every 60 seconds, for up to 30 minutes after the request (stop condition 5). The loop ends when CI has finished and Copilot submitted a review of the current head commit after REQUESTED_AT:
HEAD_SHA=$(git rev-parse HEAD)
REVIEW=""
for i in $(seq 1 30); do
REVIEW=$(gh api graphql -F owner=dotnet -F name=dev-proxy -F pr="$PR" -f query='
query($owner:String!,$name:String!,$pr:Int!){
repository(owner:$owner,name:$name){
pullRequest(number:$pr){
reviews(last:50){
nodes{ author{login} submittedAt commit{oid} comments{totalCount} body }
}
}
}
}' --jq "[.data.repository.pullRequest.reviews.nodes[]
| select(.author.login==\"copilot-pull-request-reviewer\" and .commit.oid==\"$HEAD_SHA\" and .submittedAt > \"$REQUESTED_AT\")]
| last // empty")
PENDING=$(gh pr checks "$PR" --repo "$UPSTREAM" --json bucket --jq '[.[] | select(.bucket=="pending")] | length')
[ -n "$REVIEW" ] && [ "$PENDING" = "0" ] && break
sleep 60
done
echo "$REVIEW"
gh pr checks "$PR" --repo "$UPSTREAM"If REVIEW is empty or checks are still pending, stop (stop condition 5).
If CI failed, read the logs (gh run view <run-id> --repo "$UPSTREAM" --log-failed) and fix the cause together with the review comments in Step 5. Track how many times in a row each check failed with the same error (stop condition 3).
comments.totalCount is the number of new inline comments in that round. Also read the review body: Copilot lists some findings, such as issues it missed in code that didn't change since the last review, only in the body and not as inline comments. Treat those like inline comments.
If the review has no new inline comments, its body reports no findings you haven't addressed, and CI is green, stop (stop condition 1).
Step 5: Address Each Comment
List unresolved review threads. --paginate fetches all pages, so threads from earlier rounds don't hide new ones:
gh api graphql --paginate -F owner=dotnet -F name=dev-proxy -F pr="$PR" -f query='
query($owner:String!,$name:String!,$pr:Int!,$endCursor:String){
repository(owner:$owner,name:$name){
pullRequest(number:$pr){
reviewThreads(first:100,after:$endCursor){
pageInfo{ hasNextPage endCursor }
nodes{
id isResolved path line
comments(first:20){ nodes{ databaseId author{login} body } }
}
}
}
}
}' --jq '.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved|not)'Verify each claim against the code before acting on it. Reviewers can be wrong. Then classify it:
| Type | Examples | Action |
| Blocking | Incorrect behavior, security issue, data loss, crash, missing test for new or fixed behavior | Fix it |
| Advisory | Naming, style, wording, optional refactoring, speculative concerns | Fix it if it's an improvement, otherwise reply explaining why not |
If a fix needs a decision from a human, stop (stop condition 4) and ask.
After you push the fixes (Step 6), reply to every thread. Use the databaseId of the first comment in the thread:
gh api -X POST "repos/$UPSTREAM/pulls/$PR/comments/<databaseId>/replies" \
-f body="Fixed in <sha>: <one line summary>"Resolve the threads you fixed:
gh api graphql -f id=<thread-id> -f query='
mutation($id:ID!){ resolveReviewThread(input:{threadId:$id}){ thread{ isResolved } } }'When you decline a suggestion, reply with the reason and leave the thread unresolved, so that a maintainer can decide.
Findings that appear only in the review body have no thread. Address them in one PR comment:
gh pr comment "$PR" --repo "$UPSTREAM" --body "<finding>: fixed in <sha> / not changed because <reason>"Step 6: Push and Repeat
- For code changes, run Step 1 again
- Commit with a message that describes the fixes, and push:
git push origin "$BRANCH" - Reply to and resolve the threads (Step 5)
- If nothing changed in this round, stop (stop condition 6)
- Otherwise go back to Step 3
Step 7: Report
When the loop stops, report to the user:
- Pull request URL
- Number of rounds and which stop condition ended the loop
- Comments fixed, comments declined with reasons, and anything that needs a human decision
- Final CI status
The pull request stays open for a maintainer to review and merge.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

