agentleFS
paultyngpaultyng/skill-issue/skills/ci-debug-loop/SKILL.md

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.

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
  1. Distinctive:

    If a specific run ID or workflow is provided by the user, use that instead.

    line 18
  2. Distinctive:

    If the run is still in progress:

    line 22
  3. Distinctive:

    If it already completed, proceed to diagnosis.

    line 28
  4. Distinctive:

    Delegate log analysis to a two-stage subagent pipeline: when the failed-log output is more than ~200 lines.

    line 38
  5. Very specific:

    Stage 2 — Interpret (Sonnet): After Stage 1 completes, spawn a generalPurpose subagent (model: sonnet) with the Stage 1 structured output …

    line 42
  6. Distinctive:

    If the fix is mechanical (typo, missing flag, wrong version, import ordering, fmt issue):

    line 57
  7. Distinctive:

    Commit using Conventional Commits format

    line 59
  8. Distinctive:

    If the fix requires a design decision or is ambiguous:

    line 62
  9. Distinctive:

    Wait for direction before applying

    line 64
  10. Distinctive:

    After pushing the fix, wait for the new run to appear:

    line 68
  11. Distinctive:

    Stop and escalate to the user: if:

    line 78

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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,name

If 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-status

If it already completed, proceed to diagnosis.

3. Diagnose Failure

On failure, fetch logs for the failed job(s):

gh run view <run_id> --log-failed

Delegate 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):

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 1

Then 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.