Investigate and fix failing CI. Takes a PR reference, one or more CI run/job URLs, or freeform text describing where the failures are, then enumerates failing workflows/jobs/steps, determines the root cause (often one shared cause behind several red checks), proposes a fix plan, applies code changes, commits, pushes, watches the new runs, and repeats until checks pass. Use when the user says "fix CI", "CI is red", "checks are failing", "the build is broken on my PR", "fix the failing jobs", or pastes a failing CI run URL. Do NOT use for authoring new workflows, or for read-only diagnosis with no fix intent — use gha-log-reader for that.
Drive failing CI to green: resolve the target, enumerate failures, extract evidence, cluster into root causes, fix the narrowest way possible, push, and watch — repeating until checks pass or a stop condition trips.
Priority order:
https://github.com/{owner}/{repo}/actions/runs/{run_id}
optionally /job/{job_id}; parse owner, repo, run_id, job_id.#N, N, owner/repo#N, or PR URL:
gh pr view <ref> --json number,headRefName,headRefOid,baseRefName,url,isCrossRepositorygh run list --branch <branch> --limit 20.gh pr view --json ...
with no ref); if no PR, fall back to gh run list --branch "$(git branch --show-current)".Ambiguity rule: if the input resolves to more than one plausible PR or repo, stop and ask once, listing candidates. Never guess a repo.
Non-GitHub URL (GitLab, Buildkite, CircleCI, Jenkins, Azure): fetch the URL, read the visible log text, and continue with the same clustering logic. State plainly that reproduction and watch automation are GHA-only; non-GHA targets get analysis + a fix, with re-run verification left to the user.
gh pr checks <ref> --json name,state,bucket,link,workflow,description
gh run list --branch <branch> --limit 20 \
--json databaseId,name,conclusion,status,event,headSha,workflowName,createdAtgh pr checks --json vary by gh version; if it errors,
run gh pr checks --json 2>&1 — it prints the valid field list — and use
that.failure, cancelled, timed_out, action_required,
startup_failure. cancelled is usually collateral from a fail-fast
sibling and must not be counted as its own root cause.gh run view <run_id> --json jobs \
--jq '.jobs[] | select(.conclusion=="failure") | {name, databaseId, steps: [.steps[] | select(.conclusion=="failure") | {name, number}]}'gha-log-reader skill per failing job by name; do not dump
raw logs into context.gh run view <run_id> --log-failed --job <job_id>,
capped at the first error line plus the last ~100 lines of the failing
step. (Do not use gh job view — it is not a stable gh command.)file:line when present.gh run view <run_id> --json workflowName,path.github/workflows/<file> locally at the head SHA, noting
working-directory, env, and matrix values for the failing leg.Group by cause, not by job. Signals that two failures share one cause: identical error text, same failing file, same tool/step name across matrix legs, or a common upstream artifact/job.
Classify each cluster into exactly one:
~/scripts/agent-harnesses.py
generates ~/.agents/harness/** and the native adapter trees, and
just harness-check fails on stale artifacts. Fix by re-running the
generator (just harness-generate), never by hand-editing generated
output.gh run list --branch <baseRefName> --limit 5 --json conclusion,workflowName,headShaAttempt local reproduction before editing. Derive the local command from
the failing workflow step (honoring working-directory and required env),
run it, and confirm it fails the same way. A locally validated fix saves a
full CI round trip. If the step cannot run locally (needs secrets, a specific
runner, service containers), say so and proceed to a reasoned fix.
continue-on-error, weaken assertions, or edit fixtures/expected values to
make a check pass. Suppressing a check is not fixing CI. If the only
viable fix is suppression, stop and ask.gh run rerun <run_id> --failed.git-commit skill — one commit per root cause, so a
revert stays surgical.git-push skill.isCrossRepository: true)
without write access, or when the working tree carries unrelated staged
changes — report instead.gh pr checks <ref> --watch --fail-fast=falsegh run watch <run_id> --exit-status for a single run.phatblat/dotfiles
4d65cab
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.