skills/review-loop/SKILL.md
End-to-end PR workflow: prepares a branch, commits staged changes, creates or updates a GitHub PR, then runs 5 rounds of AI code review from Codex, Greptile, and Devin — fixing findings after each round. Codex is the primary signal for round completion; Greptile and Devin are best-effort. After 5 rounds, the PR is submitted. Use when the user wants to ship a PR through automated review.
npx skillsauth add ilamanov/skills review-loopInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Prepare a PR, then run 5 rounds of AI code review using Codex, Greptile, and Devin — fixing findings after each round. After all 5 rounds, submit the PR.
| Reviewer | Trigger comment | Reliability | Notes |
| ---------- | --------------------- | ----------- | ----- |
| Codex | @codex review | High — always posts findings | Primary signal for round completion |
| Greptile | @greptile review | Medium — sometimes doesn't post | Wait for it alongside Codex, but don't block on it |
| Devin | @devin review | Low — often skips if no findings | Never block a round waiting for Devin |
Codex is the anchor. A round is considered complete once Codex has posted its findings. Greptile and Devin findings are incorporated if available, but their absence does not block progress.
$ARGUMENTS.Gather this context before starting:
git branch --show-currentgit status --shortgh pr view --json number,title,url,state 2>/dev/null || echo "No PR exists"git log main..HEAD --oneline 2>/dev/null || git log -3 --onelineIf not on main and a PR already exists for the current branch, check if it has been merged:
gh pr view --json state --jq '.state'
If the state is OPEN: skip all of Phase 1 and go straight to Phase 2 (review loop). The PR is already set up.
If the state is MERGED:
git stash --include-untracked (skip if working tree is clean)git checkout maingit pullgit stash popgit diff --cached --stat):
git add anything else)If no PR exists: Create a new PR following the PR Standards below. The PR must be created in "ready for review" state (not draft). Do not use --draft. Reviewers (Codex, Greptile, Devin) will not trigger — neither automatically on creation nor via comment — on draft PRs.
If a PR already exists (and is OPEN):
Show the user the existing PR (number, title, URL) and ask for confirmation using AskUserQuestion:
If the user chose "Update existing PR":
a. Read the existing PR:
gh pr view --json title,body,labels,number
gh pr diff --stat
Read specific files directly rather than dumping the full diff.
b. Review whether the PR content accurately reflects the current diff:
c. Update if needed:
gh pr edit <number> --title "new title" --body "new body"
d. Push any new commits (regular push, not force push)
If the user chose "Create new branch & PR":
a. Create a new branch from the current HEAD with a descriptive name based on the user's notes or the staged changes b. Push the new branch to the remote c. Create a new PR following the PR Standards below
Search for related issues and link them using Closes #123 or Relates to #123.
Committing automatically runs the linter. Fix any lint/type errors unless they require meaningful code changes — in that case, notify the user:
I can't create/update this PR because [reason]. Would you like me to [suggestion]?
Never force commit or force push.
If any review finding or required fix would change schema or migration artifacts, stop and ask the user for approval before editing them. This includes files such as:
prisma/schema.prismaprisma/migrations/**Do not make schema or migration edits as part of the review loop until the user explicitly approves them.
Once the PR exists and is pushed, run exactly 5 rounds of AI review. The final score does not matter — the goal is 5 rounds of review and fixes.
Round 1 is special: all three reviewers are auto-triggered when the PR is created, so no trigger comments are needed. For rounds 2–5, manually trigger each reviewer.
Use .review-loop-state.md at the repo root to track progress across rounds.
At the start of the review loop (before round 1), initialize the file:
cat > .review-loop-state.md << 'EOF'
# Review Loop State
PR: #<PR_NUMBER>
Current round: 1/5
Status: waiting for findings
## Round 1
### Findings
(none yet)
### Fixed
(none yet)
### Skipped
(none yet)
EOF
At the start of each round, update the current round number and status. After collecting findings, write them into the file under the current round's ### Findings section — one line per finding with reviewer, file, line, and description. After fixing/skipping, update ### Fixed and ### Skipped for that round.
This gives the agent a persistent view of what has been seen and addressed, which feeds into deduplication — before fixing a finding in round N, check the state file to see if the same file+concern was already fixed in a prior round.
At the end of the review loop (after round 5), delete the state file:
rm -f .review-loop-state.md
Round 1 (auto-triggered): Skip this step — reviewers are triggered automatically on PR creation. Do NOT post manual trigger comments for round 1. The reviewers are already running; they just take 6–10 minutes to post findings. Be patient.
Rounds 2–5: Push the latest changes, then trigger all three reviewers:
git push
sleep 5
gh pr comment <PR_NUMBER> --body "@codex review"
gh pr comment <PR_NUMBER> --body "@greptile review"
gh pr comment <PR_NUMBER> --body "@devin review"
Poll for reviewer responses. Codex is the gate — once Codex has posted, collect whatever Greptile and Devin have posted so far and move on.
Important: Reviewers take 6–10 minutes to post findings. Do not assume they failed just because nothing appears in the first few minutes. You MUST wait at least 10 minutes before even considering that something might be wrong.
Strategy:
Fetching comments and reviews:
# PR review comments (inline)
gh api repos/{owner}/{repo}/pulls/<PR_NUMBER>/comments --paginate
# PR reviews (top-level review bodies)
gh api repos/{owner}/{repo}/pulls/<PR_NUMBER>/reviews --paginate
# PR issue comments (trigger comments and bot responses)
gh api repos/{owner}/{repo}/issues/<PR_NUMBER>/comments --paginate
Identifying reviewer comments:
openai-codex[bot] or similar — check user.login for codex (case-insensitive)greptile-apps[bot] or greptile-apps-staging[bot]devin-ai[bot] or similar — check user.login for devin (case-insensitive)Filter comments by created_at timestamp to only consider findings from the current round.
Timeout: If Codex hasn't posted after 20 minutes, something is wrong. Log a warning and proceed with whatever findings exist. Do not wait indefinitely.
Gather all unresolved findings from all three reviewers:
gh api repos/{owner}/{repo}/pulls/<PR_NUMBER>/commentsgh api repos/{owner}/{repo}/pulls/<PR_NUMBER>/reviewsAlso fetch unresolved review threads via GraphQL (see GraphQL reference):
gh api graphql -f query='
query($cursor: String) {
repository(owner: "OWNER", name: "REPO") {
pullRequest(number: PR_NUMBER) {
reviewThreads(first: 100, after: $cursor) {
pageInfo { hasNextPage endCursor }
nodes {
id
isResolved
comments(first: 1) {
nodes { body path author { login } }
}
}
}
}
}
}'
Filter out noise. Exclude comments that are clearly not review findings:
@codex review etc.)Deduplicate across reviewers and rounds. If multiple reviewers flag the same issue (same file + same concern), merge them into one finding. Preserve the strongest/clearest description. Track which reviewers raised each finding. Also check .review-loop-state.md for findings already fixed in prior rounds — skip any that were already addressed.
For each unique finding, note:
Classify every finding into one of:
When in doubt, lean toward skipping. The goal is to fix real bugs, not gold-plate the code.
For each "Fix" finding:
```suggestion), apply the suggested code directly.Resolve all addressed review threads:
gh api graphql -f query='
mutation {
t1: resolveReviewThread(input: {threadId: "ID1"}) { thread { isResolved } }
t2: resolveReviewThread(input: {threadId: "ID2"}) { thread { isResolved } }
}'
Batch multiple thread resolutions into a single mutation where possible.
git add -A
git commit -m "address review feedback (review-loop round N/5)"
git push
If there were no actionable findings in this round (all reviewers had nothing or only informational comments), skip the commit — just push to re-trigger for the next round.
Then go back to step A for the next round.
After all 5 rounds are complete, mark the PR as ready for human review:
gh pr ready <PR_NUMBER>
After exiting the loop, summarize:
Review loop complete — 5 rounds finished.
Round | Codex | Greptile | Devin | Fixed | Skipped
-------|-----------|-----------|-----------|-------|--------
1 | 4 comments| 2 comments| (no post) | 5 | 1
2 | 2 comments| 1 comment | 3 comments| 5 | 1
3 | 1 comment | (no post) | (no post) | 1 | 0
4 | 0 comments| 1 comment | (no post) | 1 | 0
5 | 0 comments| 0 comments| (no post) | 0 | 0
Total fixed: 12
Total skipped: 2
PR: https://github.com/owner/repo/pull/123
PR submitted for human review.
Skipped findings:
- src/auth.ts:45 — "Consider renaming this variable" (nit)
- src/db.ts:112 — "Add null check on framework-guaranteed value" (overly defensive)
Mark reviewers as (no post) if they did not post findings for that round.
Use semantic PR titles (Conventional Commits):
<type>(<scope>): <description>
feat - New featurefix - Bug fixdocs - Documentation onlyrefactor - Code change that neither fixes a bug nor adds a featureperf - Performance improvementtest - Adding or fixing testschore - Maintenance tasksA noun describing the affected area: fix(editor):, feat(sync):, docs(examples):
feat(editor): add snap threshold configuration optionfix(arrows): correct binding behavior with rotated shapesdocs: update sync documentation<description paragraph>
### Change type
- [x] `bugfix` | `improvement` | `feature` | `api` | `other`
### Test plan
1. Step to test...
- [ ] Unit tests
- [ ] End to end tests
### Release notes
- Brief description of changes for users
Start with: "In order to X, this PR does Y."
[x]Include when changes affect api-report.md:
### API changes
- Added `Editor.newMethod()` for X
- Breaking! Removed `Editor.oldMethod()`
development
Map every Codex and Claude Code session for a project to the git worktrees they ran in, in an interactive local UI. Use whenever someone wants to see, search, audit, or clean up past AI coding-agent conversations and the worktrees those ran in — e.g. "what Codex sessions ran on this repo", "list my Claude Code sessions", "which worktree was that session in", "find the chat where I refactored auth", "archive old Codex sessions", or "show every session across my worktrees". Reach for it to untangle which of many worktrees still has live agent history attached. This is about Codex and Claude Code transcript history plus git worktrees — not HTTP, login, or auth sessions, not terminal or tmux sessions, and not user-research sessions.
tools
Generally-applicable conventions for how code is written and arranged — tooling/package manager, import style, file & component naming, comments, and where files live (colocation vs. global folders). Use whenever creating, naming, moving, or importing a file, running project commands, or deciding where a new module belongs. Consult BEFORE writing the code so the conventions are baked in, not retrofitted. If a convention below matches the work, apply it — don't ask, just follow it (call out the choice in one line so the user can override).
development
Generally-applicable frontend/UI best practices. Use whenever building, modifying, or reviewing UI — adding a form/button/dialog/modal, wiring keyboard shortcuts, creating any interactive surface that submits a form, or any time TSX/JSX is being written or edited. Consult BEFORE writing the code so the patterns are baked in, not retrofitted. If a scenario described in the skill body matches the work, apply the pattern — don't ask, just follow it (call out the choice in one line so the user can override).
tools
Generally-applicable backend/data best practices. Use whenever writing or modifying backend/data code — API routes, server actions, DB writes, background jobs, agent tools, import flows, webhooks, paste handlers, or anywhere data enters the system. Consult BEFORE writing the code so the patterns are baked in, not retrofitted. If a scenario described in the skill body matches the work, apply the pattern — don't ask, just follow it (call out the choice in one line so the user can override).