From agent-loop
Autonomously reviews PRs, applies fixes from AI review bots (CodeRabbit/Sourcery/Gemini), validates changes, and lands them when clean.
How this skill is triggered — by the user, by Claude, or both
Slash command
/agent-loop:agent-loop-autoreviewThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Autonomously review and fix pull requests. This skill:
Autonomously review and fix pull requests. This skill:
Find PRs that need attention:
# PRs with review comments from bots
gh pr list --state open --json number,title,author,updatedAt --limit 20
# Check for unresolved review threads (bot-originated)
gh api repos/{owner}/{repo}/pulls/{pr}/reviews \
--jq '.[] | select(.state == "CHANGES_REQUESTED") | {user: .user.login, body: .body}'
# All review threads
gh api repos/{owner}/{repo}/pulls/{pr}/reviews \
--jq '.[] | select(.user.login | test("coderabbit")) | {id, body, state}'
gh api repos/{owner}/{repo}/pulls/{pr}/comments \
--jq '.[] | select(.user.login | test("coderabbit|sourcery|gemini-code-assist")) | {path, line, body, id}'
From each review comment, extract:
🤖 Prompt for AI Agents section)1. Read file at specified path+line
2. Understand the issue context
3. Apply fix (minimal change, no refactoring)
4. Validate:
- Edit tool → file changed
- LSP diagnostics clean
- Run project linter: npm run lint / ruff / etc
- Run relevant tests
5. If validation fails → log error, skip, report
# TypeScript/JS
npx tsc --noEmit 2>&1 | head -50
npm run lint 2>&1 | head -50
npm run test -- --run 2>&1 | tail -50
# Python
ruff check . 2>&1 | head -30
pytest -x --timeout=60 2>&1 | tail -50
# General
git diff --stat
After applying all fixes for a PR:
git add -A
git commit -m "fix(pr): apply review bot suggestions
- Applied N fixes from CodeRabbit/Sourcery/Gemini
Co-Authored-By: duyetbot <[email protected]>"
git push
Check merge readiness:
gh pr view <n> --json mergeStateStatus,reviewDecision,statusCheckRollup
Conditions for auto-merge:
# Merge
gh pr merge <n> --squash --delete-branch
Never auto-merge when:
WIP, do-not-merge, blocked, or hold labelDockerfile, .env, secrets, auth)Log every decision:
Autoreview: PR #123
Bot comments: 3 (CodeRabbit: 2, Sourcery: 1)
Fixes applied: 2
Skipped: 1 (suggestion only, not actionable)
Validation: lint ✅, test ✅, build ✅
Result: merged as abc1234
| Scenario | Action |
|---|---|
| Fix fails validation | Revert, log error, skip |
| CI flake | Retry once after 60s |
| Merge conflict | Report as blocked |
| Unknown file changed by fix | Skip, flag for review |
| Critical security issue | Skip, escalate in report |
Guides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.
npx claudepluginhub duyet/codex-claude-plugins --plugin agent-loop