From core
Iteratively commits fixes, pushes to GitHub PR, waits for CI completion, and resolves review comments until checks pass and no unresolved issues remain. Use to automate PRs to mergeable state.
How this skill is triggered — by the user, by Claude, or both
Slash command
/core:iterate-prThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Autonomously iterate on a pull request until CI checks pass and all comments are resolved. Each iteration runs in a fresh subagent.
Autonomously iterate on a pull request until CI checks pass and all comments are resolved. Each iteration runs in a fresh subagent.
$ARGUMENTS - Maximum iterations (default: 3)Parse max iterations from $ARGUMENTS (default: 3). Set iteration counter to 0.
Get the PR for the current branch:
!gh pr view --json number,url,headRefName,statusCheckRollup 2>/dev/null || echo "NO_PR"
If no PR exists: Proceed to Step 3 (first iteration will create one).
If PR exists: Get unresolved comments data:
!bash "${CLAUDE_PLUGIN_ROOT:-.agents}/skills/unresolved-pr-comments/scripts/unresolvedPrComments.sh" 2>/dev/null
Parse the JSON output and evaluate exit conditions.
If any CI checks are still PENDING, QUEUED, or IN_PROGRESS: Proceed to Step 3 regardless of comment count. Automated reviewers (e.g. CodeRabbit) may not have posted comments yet, so comment data is unreliable until all checks complete.
If statusCheckRollup is empty or null: Treat CI as passing (some PRs have no required checks configured).
Exit with success when ALL conditions are met:
JSON Structure for Exit Evaluation:
{
"totalUnresolvedComments": number,
"totalNitpicks": number,
"unresolvedComments": [...],
"nitpickComments": [...]
}
Check totalUnresolvedComments == 0 and totalNitpicks == 0 for exit condition.
Report: "PR is clean! All CI checks pass and no unresolved comments."
Exit with status report when iteration counter >= max iterations:
/iterate-pr again to continueSpawn a Task subagent with subagent_type: "general-purpose" using this prompt:
Handle one iteration of the PR feedback loop:
- Record Starting Commit: !
git rev-parse HEAD(save asstartCommit)- Commit and Push: Invoke
core:commit-push-prvia the Skill tool- Get PR Number: !
gh pr view --json number --jq '.number'- Wait for CI: !
rc=0; if command -v gtimeout >/dev/null 2>&1; then gtimeout 600 gh pr checks --watch || rc=$?; elif command -v timeout >/dev/null 2>&1; then timeout 600 gh pr checks --watch || rc=$?; else gh pr checks --watch || rc=$?; fi; case $rc in 0|1|8|124) ;; *) exit $rc;; esac(10 minute timeout; exit codes: 0=pass, 1=fail, 8=pending, 124=timeout are expected and handled in next step; other codes like 4=auth error are re-raised; uses gtimeout on macOS, timeout on Linux, no timeout as fallback)- Check CI Status: Run
gh pr checks --json name,state,bucketand parse the output
- If any check has
bucket: "fail", invokecore:fix-civia the Skill tool. Since you are running autonomously, do NOT wait for user approval — apply the fixes directly. Report what was fixed and exit.- Check Comments: Run
bash "${CLAUDE_PLUGIN_ROOT:-.agents}/skills/unresolved-pr-comments/scripts/unresolvedPrComments.sh"and parse the JSON output
- If unresolved comments or nitpicks exist:
- Group comments by file path and read each file once (not per-comment)
- If a file no longer exists, note the comment may be outdated and skip it
- Assess each comment with an explicit verdict:
- Agree: Explain why, then fix it
- Disagree: Explain why the current code is acceptable; do NOT change the code
- Already fixed: Note that the code already addresses this concern
- After assessing all comments, fix only those you agreed with and exit (next iteration will commit fixes)
- Report: Run
git rev-parse HEADand compare tostartCommitto determine if commits were made. Include PR status, CI status, and comments addressed
After the subagent completes:
bash "${CLAUDE_PLUGIN_ROOT:-.agents}/skills/unresolved-pr-comments/scripts/unresolvedPrComments.sh"/iterate-pr after reviewer responds."Successful completion:
Iteration 1/3: No PR exists
> commit-push-pr -> PR #347 created
> CI failed (lint errors) -> fix-ci -> fixed missing semicolons
Iteration 2/3: CI failures remain
> commit-push-pr -> pushed fixes
> CI passed, 2 review comments
> unresolved-pr-comments -> addressed null check, const usage
Iteration 3/3: Comments pending
> commit-push-pr -> pushed fixes
> CI passed, no unresolved comments
PR is clean! All CI checks pass and no unresolved comments.
Awaiting reviewer resolution:
Iteration 1/3: PR exists with comments
> commit-push-pr -> pushed comment fixes
> CI passed, 1 comment remains (disagreed with suggestion)
Iteration 2/3: No commits made, comments remain
Comments addressed, awaiting reviewer resolution. Run `/iterate-pr` after reviewer responds.
Maximum iterations: $ARGUMENTS
npx claudepluginhub clipboardhealth/core-utils --plugin coreIterates on a PR until CI passes. Automatically fixes CI failures, addresses categorized review feedback, and pushes fixes until all checks are green.
Iterates on a pull request by addressing CI failures and high/medium review feedback until actionable checks pass. Use for PR CI failures, review feedback loops, and green-check loops.
Orchestrates the post-implementation loop: push PR, wait for CI, fix failures, and repeat until CI passes or termination rules trigger a pause.