Fix errors · Skill
Fix a PR until its checks pass
fix-ci-until-green
Runs a loop on an open pull request until it is green - fetch check results and review comments with gh, fix high and medium feedback, fix CI failures at the root cause, verify locally, push, wait for checks and review bots, and repeat; stops at human approval or merge gates. Use when the user says keep going until CI passes, address the review comments and get my PR green, or babysit this PR.
Works with: Any AI Not yet model-tested; testing Jan 2027
Paste it into ChatGPT, Claude, Gemini or any AI chat, then tell it about your project. How it works
Install in Claude Code, Cursor or Codex (optional)
Only for AI coding tools that read skill folders. Run one line in a terminal, in your project folder. It downloads this skill's text files from TheSkillVault and nothing else; you can read them first with “View raw SKILL.md”.
Claude Code (all your projects)
curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/fix-ci-until-green/raw' -o ~/'.claude/skills/fix-ci-until-green/SKILL.md' && curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/fix-ci-until-green/files/LICENSE.txt' -o ~/'.claude/skills/fix-ci-until-green/LICENSE.txt' && curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/fix-ci-until-green/files/NOTICE.txt' -o ~/'.claude/skills/fix-ci-until-green/NOTICE.txt'Cursor (this project)
curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/fix-ci-until-green/raw' -o '.cursor/skills/fix-ci-until-green/SKILL.md' && curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/fix-ci-until-green/files/LICENSE.txt' -o '.cursor/skills/fix-ci-until-green/LICENSE.txt' && curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/fix-ci-until-green/files/NOTICE.txt' -o '.cursor/skills/fix-ci-until-green/NOTICE.txt'Codex and other Agent Skills tools (this project)
curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/fix-ci-until-green/raw' -o '.agents/skills/fix-ci-until-green/SKILL.md' && curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/fix-ci-until-green/files/LICENSE.txt' -o '.agents/skills/fix-ci-until-green/LICENSE.txt' && curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/fix-ci-until-green/files/NOTICE.txt' -o '.agents/skills/fix-ci-until-green/NOTICE.txt'
Or connect the whole library over MCP
Add TheSkillVault to Cursor or add this to your app's MCP settings (read-only; help):
{
"mcpServers": {
"theskillvault": {
"url": "https://theskillvault.ai/mcp"
}
}
}Getting a pull request merged is often a loop: CI fails, a reviewer comments, you fix, push and wait. This skill runs that loop for you and stops where a human has to decide.
When to use
- You opened a PR and want the agent to keep fixing until CI is green.
- Reviewers or review bots left comments and you want the real ones fixed.
- You are about to step away and want the PR moving while you are gone.
When not to use
- You want one red check explained before anything changes. Use fix-failing-ci-checks.
- You want help judging whether review comments are right. Use respond-to-code-review-prompt.
Steps
- Check access with
gh auth status, then find the PR:gh pr view --json number,url,headRefName,isDraft,reviewDecision. Stop if there is no PR. - Agree the rules with the user once: may the agent commit and push to this branch on its own? If not, it shows each fix and waits.
- Read review feedback:
gh pr view <pr> --commentsandgh api repos/{owner}/{repo}/pulls/<pr>/comments. Sort comments into must-fix (bugs, broken behaviour, security), should-fix, and nits. Skip resolved threads and informational bot notes. - Fix must-fix and should-fix items. Check each against the real code first, and fix every place the same problem appears. List the nits and ask which to do.
- Read CI:
gh pr checks <pr>. For each failed GitHub Actions job, rungh run view <run-id> --log-failedand find the first real error. - Say the cause in one line before editing ("fails because X in Y"), then fix the root cause. Add a focused test when the bug had none.
- Verify locally: re-run the failing test, linter or type checker. Do not push a failure you can reproduce.
- Commit with a clear message and push (
git push, never a force-push unless asked). - Wait for checks with
gh pr checks <pr> --watch. Wait for review bots too, but not for human approval or the draft flag. - When checks pass, read comments once more. If new must-fix feedback arrived, go back to step 4. Otherwise report.
When to stop and ask
- The same failure survives two fix attempts.
- A comment is unclear, or two reviewers disagree.
- The failure is infrastructure: a runner outage, a missing secret or a quota.
- Only human gates remain: required approvals, the draft flag or merge rules.
- The branch needs a rebase or has conflicts.
Gotchas
- Never print or echo secrets while debugging a failed job. Check that a secret name exists, not its value.
- Never make CI green by deleting tests, skipping checks, or adding
--no-verify, unless the user explicitly asks. - Each push restarts the checks. Batch related fixes into one commit to save CI minutes.
- Do not mark a draft PR ready or merge it unless the user asks.
Portability
Works with any language and test runner. If you use GitLab, Bitbucket or another host, the loop is the same with that host's CLI or API instead of gh. Checks from other CI providers show up in gh pr checks with a link; open that link instead of guessing.
Done when
- All required checks the agent can affect are green.
- Every must-fix and should-fix comment is fixed or answered with a reason.
- The user has a short report: what changed, what was skipped and which human gates remain.
Example prompt
"Keep iterating on my PR until CI passes. Fix the real review comments, ask me about the nits, and stop when only approval is left."
---
Modified from "iterate-pr" in getsentry/skills (Apache-2.0, Copyright 2025 Functional Software, Inc. dba Sentry). Original: https://github.com/getsentry/skills/blob/0c464f411bdfb8d4c12314b36264d06cb2f60270/skills/iterate-pr/SKILL.md. Changes by TheSkillVault are listed in the metadata above and in NOTICE.txt. See LICENSE.txt.
Bundled files
Licence
Adapted from David Cramer (Sentry, getsentry/skills iterate-pr) (Copyright 2025 Functional Software, Inc. dba Sentry. Apache License 2.0 text in LICENSE.txt, attributions in NOTICE.txt), Apache License 2.0. Modified by TheSkillVault on 2026-11-03: rewritten around plain gh CLI commands; the bundled uv/Python scripts, their output markers and the tool-specific monitor note were removed; added an ask-before-push rule, attempt limits, gotchas and done-when. Not the original file.
Licence: Apache License 2.0. Attribution when you reuse it: Based on work by David Cramer (Sentry, getsentry/skills iterate-pr) (Copyright 2025 Functional Software, Inc. dba Sentry. Apache License 2.0 text in LICENSE.txt, attributions in NOTICE.txt, Apache License 2.0), https://github.com/getsentry/skills/blob/0c464f411bdfb8d4c12314b36264d06cb2f60270/skills/iterate-pr/SKILL.md; adapted by TheSkillVault, https://theskillvault.ai