From git-pr-autofix
Automates GitHub PR review-fix loops: requests bot reviews via @mentions, polls comments with GitHub CLI, analyzes issues, fixes code, runs internal review, pushes changes, repeats until no critical issues.
npx claudepluginhub xavierchoi/xavierchoi_skills --plugin git-pr-autofixThis skill uses the workspace's default tool permissions.
Automated PR review-fix loop. Requests bot reviews, polls for responses, analyzes comments, fixes code, runs internal review, pushes, and repeats until no critical issues remain.
Automates addressing GitHub PR review comments: fetches feedback from reviewers/bots, applies code fixes, verifies changes, pushes updates, resolves threads, requests re-review. Use on PR branches with pending feedback.
Automates GitHub PR iteration: fetches CI failures/logs, categorizes LOGAF review feedback, replies to threads, fixes/pushes until checks pass.
Runs automated PR review loop until clean: internal subagents, fixes, external reviewers (Codex CLI/bot, Gemini). Also handles uncommitted changes on main via Codex CLI.
Share bugs, ideas, or general feedback.
Automated PR review-fix loop. Requests bot reviews, polls for responses, analyzes comments, fixes code, runs internal review, pushes, and repeats until no critical issues remain.
/git-pr-autofix <PR#>
/git-pr-autofix 1 --max-rounds 5
/git-pr-autofix 1 --reviewers codex,gemini-code-assist
When the user invokes this skill:
PR# (required): Pull request number--max-rounds N: Maximum review-fix iterations (default: 5)--reviewers: Comma-separated bot reviewer names (default: codex,gemini-code-assist)gh repo view --json nameWithOwnerRun these checks before entering the loop:
# Verify we're on the PR branch
gh pr view <PR#> --json headRefName,state
# Verify clean working tree
git status --porcelain
# Verify tests pass
npm test (or equivalent)
If any check fails, report and ask user how to proceed.
iteration = 0
while iteration < max_rounds:
iteration += 1
## Step A: Request Reviews
Record the current timestamp and latest commit SHA:
REVIEW_REQUEST_TS=$(date -u +%Y-%m-%dT%H:%M:%SZ)
LATEST_SHA=$(git rev-parse --short HEAD)
Post a PR comment mentioning all reviewers with commit context:
gh pr comment <PR#> --body "@reviewer1 @reviewer2 please review (round N, commit ${LATEST_SHA})"
## Step B: Poll for Reviews (background agent)
Launch the `review-collector` agent in the BACKGROUND with:
- repo, pr_number, reviewers list
- after_timestamp: REVIEW_REQUEST_TS from Step A
- stabilization_wait: 60 (seconds to wait after first detection)
- timeout: 600 (10 minutes)
The agent will:
- Poll `gh api` every 30s using jq fromdateiso8601 for exact timestamp filtering
- Wait for ALL reviewers to respond
- After first detection, wait 60s for reviewers to finish posting inline comments
- On timeout: collect whatever exists and return with timeout=true
While waiting, report: "Waiting for reviewers... (polling every 30s)"
If the agent times out or returns incomplete results:
- Ask user: "N명 중 M명만 응답. 계속 대기 / 수동 수집 / 건너뛰기?"
- If user chooses manual collection, run gh api directly and proceed
## Step C: Analyze Comments (agent)
Automatically pipe the review-collector output to the `comment-analyzer` agent:
Input: review-collector's full output (reviews + inline comments)
Also provide: PR scope context (what this PR implements, relevant AC)
Output: categorized list:
- CRITICAL: Must fix now (bugs, security, data corruption)
- WARN: Should fix (performance, reliability, consistency)
- INFO: Nice to have (style, optimization suggestions)
- DEFERRED: Out of scope (different Seed, Phase 2, design change)
For each item: { severity, file, line, summary, fix_description, deferred_reason? }
## Step D: Present to User
Show analysis as a table:
| # | Severity | File | Summary | Action |
|---|----------|------|---------|--------|
| 1 | CRITICAL | cache.ts:82 | Tag escape vulnerability | Fix |
| 2 | WARN | route.ts:150 | Missing inArray filter | Fix |
| 3 | DEFERRED | echoes.ts:311 | Tree pagination redesign | Seed 6 |
Then ask: "N개 수정, M개 보류 예정입니다. 진행할까요?"
- If user says no or wants to adjust: let them modify the plan
- If user approves: proceed to Step E
## Step E: Fix Code
For each approved fix (CRITICAL + WARN):
1. Read the file at the specified location
2. Apply the fix based on the analyzer's fix_description
3. Verify the fix doesn't break anything nearby
After all fixes:
- Run tests: `npm test` (or project test command)
- Run lint: `npx eslint src/` (or project lint command)
- If tests/lint fail, fix before proceeding
## Step F: Internal Review (before push)
Run TWO internal reviews in parallel:
1. **Codex review** (optional, requires codex plugin):
Use `/codex:rescue` skill to review the changes
Focus: bugs, edge cases, security gaps
If not available, skip this step and rely on self-review only
2. **Self-review checklist** (Opus 4.6 max effort):
Check all modified files against:
- [ ] Query performance (indexes, full scans)
- [ ] Serverless safety (no fire-and-forget)
- [ ] Cursor/orderBy consistency
- [ ] Atomicity (transactions where needed)
- [ ] Key design (composite keys, deduplication)
- [ ] Edge cases (empty string, null, empty array)
- [ ] UI↔API state consistency
If internal review finds issues:
- Fix them immediately
- Do NOT push code with known issues
- Re-run tests after fixing
## Step G: Commit + Push
```bash
git add <modified files>
git commit -m "fix: address round N review — X issues (summary)"
git push
```
## Step H: Check Loop Condition
If this round had 0 CRITICAL items → BREAK (done!)
If iteration >= max_rounds → BREAK (warn user)
Otherwise → continue loop (back to Step A)
After loop exits:
Post a final PR comment summarizing ALL deferred items:
## Deferred Items (out of scope for this PR)
| Item | Rationale | When |
|------|-----------|------|
| ... | ... | ... |
Report to user:
PR Review Loop Complete
=======================
Rounds: N
Fixed: X issues
Deferred: Y items
Tests: all passing
Create .claude/git-pr-autofix.local.md to customize:
reviewers:
- codex
- gemini-code-assist
max_rounds: 5
poll_interval_seconds: 30
poll_timeout_seconds: 600
test_command: "npm test"
lint_command: "npx eslint src/"