iterate-pr by davila7/claude-code-templates
npx skills add https://github.com/davila7/claude-code-templates --skill iterate-pr持续迭代当前分支,直到所有 CI 检查通过且评审反馈得到处理。
要求:已认证且可用的 GitHub CLI (gh)。
gh pr view --json number,url,headRefName,baseRefName
如果当前分支不存在 PR,则停止并通知用户。
在查看评审反馈之前,始终先检查 CI/GitHub Actions 状态:
gh pr checks --json name,state,bucket,link,workflow
bucket 字段将状态分类为:pass、fail、pending、skipping 或 。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
cancel重要提示: 如果以下任何检查仍处于 pending 状态,请等待后再继续:
sentry / sentry-iocodecovcursor / bugbot / seer这些机器人一旦完成检查,可能会发布额外的反馈评论。等待可以避免重复工作。
一旦 CI 检查完成(或至少与机器人相关的检查完成),收集人工和机器人的反馈:
评审评论和状态:
gh pr view --json reviews,comments,reviewDecision
行内代码评审评论:
gh api repos/{owner}/{repo}/pulls/{pr_number}/comments
PR 对话评论(包括机器人评论):
gh api repos/{owner}/{repo}/issues/{pr_number}/comments
查找来自以下机器人的评论:Sentry、Codecov、Cursor、Bugbot、Seer 和其他自动化工具。
对于每个 CI 失败,获取实际的日志:
# 列出此分支的最近运行
gh run list --branch $(git branch --show-current) --limit 5 --json databaseId,name,status,conclusion
# 查看特定运行的失败日志
gh run view <run-id> --log-failed
不要仅根据检查名称假设失败原因。务必阅读实际日志。
对于每条反馈(CI 失败或评审评论):
进行最小化、有针对性的代码更改。只修复实际损坏的部分。
git add -A
git commit -m "fix: <描述性信息,说明修复了什么>"
git push
使用内置的监视功能:
gh pr checks --watch --interval 30
这将等待直到所有检查完成。退出代码 0 表示全部通过,退出代码 1 表示有失败。
如果需要更多控制,可以手动轮询:
gh pr checks --json name,state,bucket | jq '.[] | select(.bucket != "pass")'
如果出现以下情况,请返回步骤 2:
持续进行,直到所有检查通过且没有未处理的反馈。
成功:
bucket: pass)请求帮助:
立即停止:
gh pr checks --required 仅关注必需的检查gh run view <run-id> --verbose 查看所有作业步骤,而不仅仅是失败的部分link 字段提供了用于调查的 URL每周安装量
130
仓库
GitHub 星标数
22.6K
首次出现
2026年1月21日
安全审计
安装于
claude-code111
opencode101
gemini-cli98
cursor97
antigravity92
codex86
Continuously iterate on the current branch until all CI checks pass and review feedback is addressed.
Requires : GitHub CLI (gh) authenticated and available.
gh pr view --json number,url,headRefName,baseRefName
If no PR exists for the current branch, stop and inform the user.
Always check CI/GitHub Actions status before looking at review feedback:
gh pr checks --json name,state,bucket,link,workflow
The bucket field categorizes state into: pass, fail, pending, skipping, or cancel.
Important: If any of these checks are still pending, wait before proceeding:
sentry / sentry-iocodecovcursor / bugbot / seerThese bots may post additional feedback comments once their checks complete. Waiting avoids duplicate work.
Once CI checks have completed (or at least the bot-related checks), gather human and bot feedback:
Review Comments and Status:
gh pr view --json reviews,comments,reviewDecision
Inline Code Review Comments:
gh api repos/{owner}/{repo}/pulls/{pr_number}/comments
PR Conversation Comments (includes bot comments):
gh api repos/{owner}/{repo}/issues/{pr_number}/comments
Look for bot comments from: Sentry, Codecov, Cursor, Bugbot, Seer, and other automated tools.
For each CI failure, get the actual logs:
# List recent runs for this branch
gh run list --branch $(git branch --show-current) --limit 5 --json databaseId,name,status,conclusion
# View failed logs for a specific run
gh run view <run-id> --log-failed
Do NOT assume what failed based on the check name alone. Always read the actual logs.
For each piece of feedback (CI failure or review comment):
Make minimal, targeted code changes. Only fix what is actually broken.
git add -A
git commit -m "fix: <descriptive message of what was fixed>"
git push
Use the built-in watch functionality:
gh pr checks --watch --interval 30
This waits until all checks complete. Exit code 0 means all passed, exit code 1 means failures.
Alternatively, poll manually if you need more control:
gh pr checks --json name,state,bucket | jq '.[] | select(.bucket != "pass")'
Return to Step 2 if:
Continue until all checks pass and no unaddressed feedback remains.
Success:
bucket: pass)Ask for Help:
Stop Immediately:
gh pr checks --required to focus only on required checksgh run view <run-id> --verbose to see all job steps, not just failureslink field in checks JSON provides the URL to investigateWeekly Installs
130
Repository
GitHub Stars
22.6K
First Seen
Jan 21, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
claude-code111
opencode101
gemini-cli98
cursor97
antigravity92
codex86