Iterate on a PR until CI passes. Use when you need to fix CI failures, address review feedback, or continuously push fixes until all checks are green. Automates the feedback-fix-push-wait cycle.
Add this skill
npx mdskills install getsentry/iterate-prComprehensive PR iteration workflow with smart CI polling and feedback validation
1---2name: iterate-pr3description: Iterate on a PR until CI passes. Use when you need to fix CI failures, address review feedback, or continuously push fixes until all checks are green. Automates the feedback-fix-push-wait cycle.4---56# Iterate on PR Until CI Passes78Continuously iterate on the current branch until all CI checks pass and review feedback is addressed.910**Requires**: GitHub CLI (`gh`) authenticated.1112**Important**: All scripts must be run from the repository root directory (where `.git` is located), not from the skill directory. Use the full path to the script via `${CLAUDE_SKILL_ROOT}`.1314## Bundled Scripts1516### `scripts/fetch_pr_checks.py`1718Fetches CI check status and extracts failure snippets from logs.1920```bash21uv run ${CLAUDE_SKILL_ROOT}/scripts/fetch_pr_checks.py [--pr NUMBER]22```2324Returns JSON:25```json26{27 "pr": {"number": 123, "branch": "feat/foo"},28 "summary": {"total": 5, "passed": 3, "failed": 2, "pending": 0},29 "checks": [30 {"name": "tests", "status": "fail", "log_snippet": "...", "run_id": 123},31 {"name": "lint", "status": "pass"}32 ]33}34```3536### `scripts/fetch_pr_feedback.py`3738Fetches and categorizes PR review feedback using the [LOGAF scale](https://develop.sentry.dev/engineering-practices/code-review/#logaf-scale).3940```bash41uv run ${CLAUDE_SKILL_ROOT}/scripts/fetch_pr_feedback.py [--pr NUMBER]42```4344Returns JSON with feedback categorized as:45- `high` - Must address before merge (`h:`, blocker, changes requested)46- `medium` - Should address (`m:`, standard feedback)47- `low` - Optional (`l:`, nit, style, suggestion)48- `bot` - Informational automated comments (Codecov, Dependabot, etc.)49- `resolved` - Already resolved threads5051Review bot feedback (from Sentry, Warden, Cursor, Bugbot, CodeQL, etc.) appears in `high`/`medium`/`low` with `review_bot: true` — it is NOT placed in the `bot` bucket.5253## Workflow5455### 1. Identify PR5657```bash58gh pr view --json number,url,headRefName59```6061Stop if no PR exists for the current branch.6263### 2. Gather Review Feedback6465Run `${CLAUDE_SKILL_ROOT}/scripts/fetch_pr_feedback.py` to get categorized feedback already posted on the PR.6667### 3. Handle Feedback by LOGAF Priority6869**Auto-fix (no prompt):**70- `high` - must address (blockers, security, changes requested)71- `medium` - should address (standard feedback)7273This includes review bot feedback (items with `review_bot: true`). Treat it the same as human feedback:74- Real issue found → fix it75- False positive → skip, but explain why in a brief comment76- Never silently ignore review bot feedback — always verify the finding7778**Prompt user for selection:**79- `low` - present numbered list and ask which to address:8081```82Found 3 low-priority suggestions:831. [l] "Consider renaming this variable" - @reviewer in api.py:42842. [nit] "Could use a list comprehension" - @reviewer in utils.py:18853. [style] "Add a docstring" - @reviewer in models.py:558687Which would you like to address? (e.g., "1,3" or "all" or "none")88```8990**Skip silently:**91- `resolved` threads92- `bot` comments (informational only — Codecov, Dependabot, etc.)9394### 4. Check CI Status9596Run `${CLAUDE_SKILL_ROOT}/scripts/fetch_pr_checks.py` to get structured failure data.9798**Wait if pending:** If review bot checks (sentry, warden, cursor, bugbot, seer, codeql) are still running, wait before proceeding—they post actionable feedback that must be evaluated. Informational bots (codecov) are not worth waiting for.99100### 5. Fix CI Failures101102For each failure in the script output:1031. Read the `log_snippet` to understand the failure1042. Read the relevant code before making changes1053. Fix the issue with minimal, targeted changes106107Do NOT assume what failed based on check name alone—always read the logs.108109### 6. Commit and Push110111```bash112git add <files>113git commit -m "fix: <descriptive message>"114git push115```116117### 7. Wait for CI118119```bash120gh pr checks --watch --interval 30121```122123### 8. Re-check Feedback After CI124125Review bots often post feedback seconds after CI checks complete. Wait briefly, then check again:126127```bash128sleep 10129uv run ${CLAUDE_SKILL_ROOT}/scripts/fetch_pr_feedback.py130```131132Address any new high/medium feedback the same way as step 3. If new feedback requires code changes, return to step 6 to commit and push.133134### 9. Repeat135136Return to step 2 if CI failed or new feedback appeared in step 8.137138## Exit Conditions139140**Success:** All checks pass, post-CI feedback re-check is clean (no new unaddressed high/medium feedback including review bot findings), user has decided on low-priority items.141142**Ask for help:** Same failure after 3 attempts, feedback needs clarification, infrastructure issues.143144**Stop:** No PR exists, branch needs rebase.145146## Fallback147148If scripts fail, use `gh` CLI directly:149- `gh pr checks name,state,bucket,link`150- `gh run view <run-id> --log-failed`151- `gh api repos/{owner}/{repo}/pulls/{number}/comments`152
Full transparency — inspect the skill content before installing.