Agent Skillsgetsentry/skills › iterate-pr

iterate-pr

GitHub

自动迭代PR直至CI通过并处理高/中优先级Review反馈。通过脚本获取检查状态与评论,修复失败项,监控流程,并在达到人工审批或草稿就绪等门禁时停止报告。

skills/iterate-pr/SKILL.md getsentry/skills

Trigger Scenarios

PR CI测试失败需要修复 收到代码Review反馈需处理 需要持续监控PR合并状态

Install

npx skills add getsentry/skills --skill iterate-pr -g -y
More Options

Use without installing

npx skills use getsentry/skills@iterate-pr

指定 Agent (Claude Code)

npx skills add getsentry/skills --skill iterate-pr -a claude-code -g -y

安装 repo 全部 skill

npx skills add getsentry/skills --all -g -y

预览 repo 内 skill

npx skills add getsentry/skills --list

SKILL.md

Frontmatter
{
    "name": "iterate-pr",
    "description": "Iterate on a PR until actionable CI passes and high\/medium review feedback is addressed. Use for PR CI failures, review feedback, or green-check loops; do not wait for human approval, draft status, or merge gates.",
    "disable-model-invocation": false
}

Iterate on PR Until CI Passes

Goal: fix actionable CI failures and high/medium review feedback. Stop and report human approval, draft-readiness, and merge-readiness gates.

Requires:

  • authenticated gh
  • uv
  • target repository root as cwd
  • skill-root-relative script paths, for example scripts/fetch_pr_checks.py

Bundled Scripts

Script Run Output
scripts/fetch_pr_checks.py uv run scripts/fetch_pr_checks.py [--pr NUMBER] JSON: pr, summary, checks, failure snippets
scripts/fetch_pr_feedback.py uv run scripts/fetch_pr_feedback.py [--pr NUMBER] JSON buckets: high, medium, low, bot, resolved
scripts/monitor_pr_checks.py uv run scripts/monitor_pr_checks.py [--pr NUMBER] terminal marker plus tab-separated checks
scripts/reply_to_thread.py uv run scripts/reply_to_thread.py THREAD_ID BODY [...] JSON reply results

Check summary fields include failed, pending, actionable_pending, and human_gate_pending.

Monitor markers:

  • ALL_CHECKS_PASSED
  • CHECKS_DONE_WITH_FAILURES
  • NO_CHECKS_REGISTERED
  • DRAFT_PR_WITH_NO_CHECKS
  • CHECKS_BLOCKED_BY_REVIEW_GATE

Workflow

1. Identify PR

Run:

gh pr view --json number,url,headRefName,isDraft,reviewDecision

Stop when:

  • no PR exists
  • draft PR has no checks after monitor grace period: report DRAFT_PR_WITH_NO_CHECKS

Draft rule: inspect existing checks/feedback only. Do not mark ready for review unless asked.

2. Handle Feedback

Run uv run scripts/fetch_pr_feedback.py [--pr NUMBER].

Bucket Action
high fix
medium fix
low ask user which to address
bot skip informational comments
resolved skip

Feedback fix checklist:

  • verify root cause
  • search related code
  • fix all instances
  • for review_bot: true: fix real issues, explain false positives

Low-priority prompt format:

Found 3 low-priority suggestions:
1. [l] "Consider renaming this variable" - @reviewer in api.py:42
2. [nit] "Could use a list comprehension" - @reviewer in utils.py:18
3. [style] "Add a docstring" - @reviewer in models.py:55

Which should I address? ("1,3", "all", or "none")

3. Check CI Status

Run uv run scripts/fetch_pr_checks.py [--pr NUMBER].

State Action
failed > 0 and actionable_pending == 0 fix failures
actionable_pending > 0 wait; poll feedback while waiting
pending > 0 and actionable_pending == 0 report CHECKS_BLOCKED_BY_REVIEW_GATE
no checks after grace period report NO_CHECKS_REGISTERED or DRAFT_PR_WITH_NO_CHECKS
all actionable checks passed run post-CI feedback check

Wait for actionable review bots: sentry, warden, cursor, bugbot, seer, codeql. Do not wait for approval, isDraft, REVIEW_REQUIRED, Codecov, or informational bots.

4. Fix CI Failures

For each failure:

  1. read full log: gh run view <run-id> --log-failed
  2. trace from assertion/exception/lint rule to source
  3. state the cause before editing: "fails because X, affected by Y"
  4. search related call sites/patterns
  5. fix root cause, not symptom
  6. add focused test coverage when needed

5. Verify Locally, Then Commit and Push

Before commit:

  • test fix: rerun specific test
  • lint/type fix: rerun affected checker
  • code fix: rerun covering tests
  • local failure: fix before pushing
git add <files>
git commit -m "fix: <descriptive message>"
git push

6. Monitor CI and Address Feedback

Loop:

  1. run uv run scripts/fetch_pr_checks.py
  2. handle table in step 3
  3. while actionable_pending > 0, run uv run scripts/fetch_pr_feedback.py
  4. fix new high/medium feedback immediately
  5. if changed, verify, commit, push, restart loop
  6. otherwise sleep 30 seconds and repeat
  7. after checks pass, wait 10 seconds, fetch feedback once more
  8. if new high/medium feedback exists, return to step 4

Claude Code optional: run uv run scripts/monitor_pr_checks.py through MonitorTool with persistent: false; set timeout to normal repo CI duration. Restart the monitor after every push.

Exit Conditions

Exit Conditions
Success actionable CI passed; post-CI feedback clean; low-priority choice handled
Ask user same failure after 2 attempts; feedback unclear; infrastructure issue
Stop no PR; branch needs rebase; no checks; draft no-checks; only human gates remain

Fallback

If scripts fail, use gh CLI directly:

  • gh pr view --json number,url,headRefName,isDraft,reviewDecision
  • gh pr checks --json name,state,bucket,description,link
  • gh run view <run-id> --log-failed
  • gh api repos/{owner}/{repo}/pulls/{number}/comments

Version History

  • 24fdb83 Current 2026-08-19 21:44

    新增模型调用能力以支持Claude Code和Codex环境,对齐两者调用策略并更新技能规范。

  • 9a85b59 2026-07-24 21:13

Same Skill Collection

skills/agents-md/SKILL.md
skills/brand-guidelines/SKILL.md
skills/claude-settings-audit/SKILL.md
skills/code-review/SKILL.md
skills/code-simplifier/SKILL.md
skills/commit/SKILL.md
skills/create-branch/SKILL.md
skills/django-access-review/SKILL.md
skills/django-perf-review/SKILL.md
skills/doc-coauthoring/SKILL.md
skills/find-bugs/SKILL.md
skills/gh-review-requests/SKILL.md
skills/gha-security-review/SKILL.md
skills/pr-link-issue/SKILL.md
skills/pr-writer/SKILL.md
skills/presentation-creator/SKILL.md
skills/prompt-optimizer/SKILL.md
skills/replay-ux-research/SKILL.md
skills/security-review/SKILL.md
skills/skill-scanner/SKILL.md
skills/skill-writer/SKILL.md
skills/sred-project-organizer/SKILL.md
skills/sred-work-summary/SKILL.md
skills/triage-frontend-issues/SKILL.md
skills/typing-exclusion-worker/SKILL.md
skills/blog-writing-guide/SKILL.md
skills/document-api-endpoint/SKILL.md

Metadata

Files
0
Version
24fdb83
Hash
d57ecb10
Indexed
2026-07-24 21:13

Главная - Вики-сайт
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-20 10:18
浙ICP备14020137号-1 $Гость$