ci-debug-loop
Skill8 starsChanged 4 months agoMITView on GitHub
Watch a GitHub Actions CI run, diagnose failures from logs, apply fixes, re-push, and repeat until green or escalate. Use when CI is failing and the user wants to debug and fix it iteratively, or says "fix CI", "debug the build", or similar.
In this repository37 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- active-readSkill
- active-reviewSkill
- analyze-knowledgeSkill
- audit-accomplishmentsSkill
- audit-historySkill
- bisectSkill
- create-decision-documentSkill
- create-jira-itemSkill
- create-prSkill
- create-ruleSkill
- create-skillSkill
- discover-patternsSkill
- evaluate-dependencySkill
- fix-pr-conflictSkill
- implement-planSkill
- match-voiceSkill
- push-and-watchSkill
- rebase-pr-chainSkill
- review-allSkill
- review-api-compatSkill
- review-ciSkill
- review-codeSkill
- review-coverageSkill
- review-databaseSkill
- review-documentationSkill
- review-infrastructureSkill
- review-observabilitySkill
- review-performanceSkill
- review-planSkill
- review-reliabilitySkill
- review-securitySkill
- set-session-contextSkill
- ship-itSkill
- simplify-proseSkill
- start-daySkill
- verify-when-completeSkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 10 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈10
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 18
If a specific run ID or workflow is provided by the user, use that instead.
- Distinctive: line 22
If the run is still in progress:
- Distinctive: line 28
If it already completed, proceed to diagnosis.
- Distinctive: line 38
Delegate log analysis to a two-stage subagent pipeline: when the failed-log output is more than ~200 lines.
- Very specific: line 42
Stage 2 — Interpret (Sonnet): After Stage 1 completes, spawn a generalPurpose subagent (model: sonnet) with the Stage 1 structured output …
- Distinctive: line 57
If the fix is mechanical (typo, missing flag, wrong version, import ordering, fmt issue):
- Distinctive: line 59
Commit using Conventional Commits format
- Distinctive: line 62
If the fix requires a design decision or is ambiguous:
- Distinctive: line 64
Wait for direction before applying
- Distinctive: line 68
After pushing the fix, wait for the new run to appear:
- Distinctive: line 78
Stop and escalate to the user: if:
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CI Debug Loop
Iteratively watch CI, diagnose failures, fix, and re-trigger until the run passes or escalation is needed.
1. Identify the Run
Find the latest run for the current branch:
gh run list --branch $(git branch --show-current) --limit 1 --json databaseId,status,conclusion,nameIf a specific run ID or workflow is provided by the user, use that instead.
2. Watch
If the run is still in progress:
gh run watch <run_id> --exit-statusIf it already completed, proceed to diagnosis.
3. Diagnose Failure
On failure, fetch logs for the failed job(s):
gh run view <run_id> --log-failedDelegate log analysis to a two-stage subagent pipeline when the failed-log output is more than ~200 lines. CI logs flood main context fast and the parent only needs the root cause, not the raw output. Per parallelize-subagents, delegate-investigation, and subagent-model-routing:
Stage 1 — Extract (Haiku): Spawn an Explore subagent (model: haiku) per failed job (parallel if multiple jobs failed). Prompt: paste the command to fetch the log (not the log itself); ask for "first failing assertion + ~10 lines of surrounding context, ≤50 lines, prefixed with Status: ...". Haiku handles the mechanical extraction; no interpretation needed at this stage.
Stage 2 — Interpret (Sonnet): After Stage 1 completes, spawn a generalPurpose subagent (model: sonnet) with the Stage 1 structured output pasted inline plus the failure categories below. Ask for "likely root cause + file:line if identifiable, ≤100 words, prefixed with Status: ...".
- Parent receives the Stage 2 summary, decides the fix.
For short logs (<200 lines), inspect inline.
Common failure categories:
- Build errors: compilation failures, missing dependencies
- Test failures: assertion errors, timeouts, flaky tests
- Auth/permissions: token scopes, registry auth, SSH keys
- Config/YAML: syntax errors, wrong flags, missing env vars, heredoc issues
- Infrastructure: runner issues, Docker rate limits, service unavailability
4. Fix
If the fix is mechanical (typo, missing flag, wrong version, import ordering, fmt issue):
- Apply the fix directly
- Commit using Conventional Commits format
- Push
If the fix requires a design decision or is ambiguous:
- Present the diagnosis and options to the user
- Wait for direction before applying
5. Re-watch
After pushing the fix, wait for the new run to appear:
gh run list --branch $(git branch --show-current) --limit 1Then watch it (back to step 2).
6. Escalation
Stop and escalate to the user if:
- The same job fails twice with the same error after a fix attempt
- The failure is in infrastructure outside the repo's control (runner issues, external service outages)
- The fix would require changes to a different repository or CI configuration not in this repo
Report what was tried, what failed, and what options remain.
Escalate to bisect when log analysis can't pinpoint which change broke the job. Typical signs: failure looks unrelated to the recent diff, error message points at code untouched in the branch, or a previously-green test on the same branch is now red. Hand the failing test/command to /bisect as the reproducer; it isolates the offending commit.
Cross-references
- Per
~/.claude/rules/probe-not-assume.md: confirm via tool/command before recommending; do not infer.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

