mcpField
C
ci-debugging

ci-debugging

github.com/citypaulCloud & DevOps760182 installsUpdated 4w ago
Repository

About ci-debugging

ci-debugging is a skill for diagnosing CI failures through collected run evidence, controlled hypotheses, and comparisons with local and green runs. It guides developers from investigation through verification while distinguishing diagnosis from authorized changes.

Key features

  1. 01Collect provider-specific logs and artifacts
  2. 02Compare failing and last-green runs
  3. 03Test ranked, falsifiable hypotheses
  4. 04Analyze CI and local environment differences
  5. 05Verify fixes with the exact failing command

Use cases

  1. 01Investigating a failed GitHub Actions job
  2. 02Tracing differences between CI and local tests
  3. 03Assessing whether repeated outcomes prove flakiness

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/citypaul/.dotfiles --skill ci-debugging

After installing, type/ci-debuggingin Claude Code to confirm it loaded.

Details

From the project README

CI Debugging

Every CI failure is real until proven otherwise. Never assume flakiness.

This skill owns pipeline-specific evidence and environment deltas. For a local or runtime failure outside CI, use debugging.

Getting the Data

Identify the CI provider from the repository configuration, then pull the actual failure output with that provider's connected tool, CLI, or UI before forming hypotheses. Preserve the run, job, attempt, commit SHA, and timestamps so later comparisons refer to the same execution.

For GitHub Actions:

gh run list --branch <branch> --limit 5        # find the failing run
gh run view <run-id> --log-failed              # only the failed steps' logs
gh run view <run-id> --job <job-id> --log      # one job's full log
gh run download <run-id>                       # artifacts (coverage, reports, screenshots)

Rerunning a workflow or changing a CI variable mutates external state and may repeat deploys, migrations, notifications, or other effects. Do that only with explicit authority after inspecting the workflow and failed job for side effects. When authorized, rerun only the failed jobs with gh run rerun <run-id> --failed, or use gh run rerun <run-id> --debug for step-level logging; remove any temporary debug variable afterwards. For another provider, use its equivalent controls without translating commands by guesswork. Compare the failing run against the last green run on the same branch — the diff in commits, dependency lockfiles, and pipeline files between those two runs is the primary suspect list.

If the system under test emits structured telemetry (canonical events, traces, in-memory exporter output from test runs), pull it as evidence alongside the logs — see the observability skill.

Hypothesis-First Diagnosis

Before editing, list plausible causes, rank them by evidence, and test one falsifiable hypothesis at a time. Do not invent a fixed minimum merely to fill a list.

Example hypotheses for a test timeout:

  1. Test relies on network access unavailable in CI
  2. Parallel test execution causes resource contention
  3. CI runner has less memory/CPU than local machine

Local Reproduction

Reproduce locally when a faithful environment is available before pushing fixes.

  • Run the exact failing command, not a close equivalent
  • Match the CI environment as closely as possible (Node version, env vars)
  • If it passes locally, treat the environment delta as evidence to localize; the cause may still be timing, state, or an external dependency

Environment Delta Analysis

Compare CI vs local:

FactorCheck
Node/runtime versionCI config vs node -v locally
OSLinux CI vs macOS local
Dependency resolutionRepository's locked clean-install command and package cache (for npm, npm ci vs cached node_modules)
Env varsCI secrets/config vs local .env
ParallelismCI may run tests in parallel differently
Memory/CPUCI runners often have less resources
NetworkCI may block external network access
File systemCase sensitivity (Linux) vs insensitive (macOS)

Read the Full Error

  • Read the complete error output, not just the last line
  • Check preceding log lines and warnings — they often contain the real cause
  • Look at stack traces to identify the actual failure point
  • Check for earlier failures that may cascade into the visible error

Fix Verification

If the request is diagnosis-only, report the supported root cause, evidence, affected jobs, uncertainty, and recommended fix, then stop. Diagnosis does not authorize workflow, production, dependency, test, or configuration changes.

When the user requested a fix, after identifying it:

  1. Explain why it addresses the root cause (not just the symptom)
  2. Run the exact failing command locally
  3. Verify the fix doesn't mask the real issue (e.g., adding a retry hides a race condition)

Anti-Patterns

Anti-PatternWhy It's WrongInstead
"It's flaky, re-run it"Masks real issuesInvestigate the failure
Adding blind retries/sleepsCan hide timing bugsIdentify the cause; add bounded retry only when the external contract requires it
Pushing speculative fixesWastes CI cyclesReproduce and verify locally
Reading only the last error lineMisses root causeRead full output from the top
Fixing symptomsProblem will recurTrace to root cause

Proving Flakiness

Different outcomes across independent runs with the same controlled inputs are evidence that the outcome is nondeterministic. That proves flakiness even when the source is not yet diagnosed. Record which inputs and environment facts were actually controlled, then localize the cause: race, time, shared state, resource pressure, or an external dependency. A single unexplained failure remains a real failure, not permission to re-run until green.

Handoff

Once the root cause is identified, a diagnosis-only handoff ends with the evidence and recommended guard. For an authorized fix, leave the smallest durable regression guard that fits it. For production behavior, write the failing behavior test before the fix using tdd (or characterisation-tests when legacy behavior first needs capture). For provider configuration, permissions, or an external outage, use a config assertion, dry-run, contract check, or monitored recovery proof as appropriate. If no executable guard is feasible, record the evidence and remaining detection path instead of fabricating a test.

Comments

Markdown supported