From ci-workflows
Use after pushing a PR branch to autonomously monitor CI, fetch remote review findings, generate fixes, and iterate until CI is clean or a hard decision is needed. Invoke as: /post-push-loop [pr-number]
How this skill is triggered — by the user, by Claude, or both
Slash command
/ci-workflows:post-push-loopThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Autonomously iterate through the CI/review cycle after a push. Loop exits only when
Autonomously iterate through the CI/review cycle after a push. Loop exits only when external signals clear (CI green + no unresolved bot findings), or when a finding requires a human decision.
/post-push-loop [pr-number]
If pr-number is omitted, auto-detect from gh pr view --json number -q .number.
This skill requires ~/.claude/scripts/post-push-status.sh (from the claude-config
repo). Before starting, verify it exists and is executable. If missing, escalate
immediately — do not attempt to create or substitute it.
Additional requirements: gh (authenticated), jq, python3, and a pre-push git
hook with POSTPUSH_LOOP bypass support.
~/.claude/scripts/post-push-status.sh exists and is executablegit branch --show-current — must NOT be maingh pr view --json number -q .numberPOSTPUSH_LOOP will be set for all git push calls in this sessionRepeat until Exit: Success or Exit: Escalate:
Poll every 30 seconds:
bash ~/.claude/scripts/post-push-status.sh <PR_NUMBER>
Continue polling while CI_STATE=PENDING, CI_STATE=EXPECTED, or CI_STATE=UNKNOWN.
CI_STATE=UNKNOWN indicates a transient error (network failure or no CI checks registered yet) — treat it as pending and continue polling. It counts against the 15-minute timeout.
Timeout: if CI_STATE has not resolved after 15 minutes, escalate with reason
"CI did not complete within timeout — check for stuck jobs."
Parse script output using this exact decision table — evaluate in order:
| CI_STATE | FINDING lines present? | Action |
|---|---|---|
SUCCESS | No | Exit: Success |
SUCCESS | Yes | Proceed to Phase 3 |
FAILURE | Either | Proceed to Phase 3 |
ERROR | Either | Proceed to Phase 3 |
UNKNOWN | Either | Return to Phase 1 (transient — treat as pending) |
CI_STATE=SUCCESS alone is NOT sufficient to exit — zero FINDING lines are also required.
FINDING lines have the format:
FINDING source=<bot> file="<path>" line=<line> comment=<text>
The file= value is always double-quoted (strip the outer quotes when reading it). This handles file paths that contain spaces.
Note on issues/comments staleness: Findings from the PR conversation thread
(issues/comments) cannot be filtered by commit — that API provides no
original_commit_id field. These findings may include bot comments from previous
commits. Treat an issues/comments finding with an empty file= and line= as a
potential staleness indicator; apply extra scrutiny before classifying as CONFIDENT_FIX.
For each FINDING line, classify as CONFIDENT_FIX or ESCALATE:
CONFIDENT_FIX (all of the following must be true):
file= and line= referenceESCALATE (any of the following):
**/auth/**, **/jwt/**, **/password/**, **/session/**,
**/payment/**, **/billing/**, **/db/**, **/migrations/**,
**/crypto/**, **/secrets/**CI_STATE=ERROR (infrastructure failure, not code failure)If ANY finding is ESCALATE: stop. Do NOT apply any fixes. Go to Exit: Escalate.
If ALL findings are CONFIDENT_FIX: proceed to Phase 4.
Apply edits for each confident finding. Keep changes minimal — fix exactly what the finding describes, nothing more.
After all edits:
git diff HEAD
Review the diff briefly. If the diff is larger than expected or touches files not referenced in findings, treat as ESCALATE.
git add <only the files you changed>
git commit -m "fix: address <summary of findings>
Post-push loop iteration N: <list of findings addressed>"
Note: the pre-commit hook will run automatically. If it blocks the commit, treat as Exit: Escalate — surface both the hook finding and the remote finding.
Environment for push: set POSTPUSH_LOOP=1 to bypass the Protocol 4 interactive prompt.
POSTPUSH_LOOP=1 git push
Return to Phase 1.
✅ POST-PUSH LOOP COMPLETE
PR #NNN | N iterations
CI state: SUCCESS
Unresolved bot findings: 0
Commits pushed:
<list of commit hashes + messages>
⚠️ LOOP PAUSED — Human decision required
PR #NNN | Iteration N | CI: <state>
FINDING(S) requiring your input:
[For each finding]
Source: <bot>
File: <path>:<line>
Comment: <text>
Reason escalated: <reason>
CONTEXT:
Fixes applied this session: <list or "none">
Local review at last commit: passed / blocked
Current CI state: <state>
OPTIONS:
1. Provide direction here → I resume with your guidance
2. Take over manually → type "take over" to exit loop
3. Abandon → type "abandon" to exit, leave branch as-is
Await human response. Do not proceed autonomously.
CI_STATE=SUCCESS AND no FINDING lines from the status script.--no-verify on any git command.main.POSTPUSH_LOOP=1 on every git push call within this skill.npx claudepluginhub smartwatermelon/smartwatermelon-marketplace --plugin ci-workflowsOrchestrates the post-implementation loop: push PR, wait for CI, fix failures, and repeat until CI passes or termination rules trigger a pause.
Iterates on a PR until CI passes. Automatically fixes CI failures, addresses categorized review feedback, and pushes fixes until all checks are green.
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.