/devops-skills:pipeline-failure-triage-and-recoveryfrom devops-skills
Diagnoses failed or flaky CI runs, distinguishing real regressions from environmental failures. Guides re-run strategy selection (single job vs full pipeline), cache corruption recovery, and test quarantining without hiding real bugs.
Ships in devops-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
A failed CI run is a decision point, not just a red X: is this a real regression that must be fixed before merging, a flaky test that fails intermittently regardless of the code change, or an environmental problem (a corrupted cache, a transient network blip to a package registry, a rate-limited external dependency) that has nothing to do with the code at all? Treating every failure as "just re-run it" trains engineers to ignore CI, while treating every failure as a real regression wastes hours chasing a bug that doesn't exist. This skill covers triaging a failed run methodically, choosing the narrowest safe recovery action, and fixing the underlying cause of recurring flakiness or corruption instead of only re-running around it.
actions/cache
hit/miss output, GitLab CI job traces and cache job artifacts, Jenkins
console output and workspace state).@flaky/quarantine tag, a separate flaky-test job that
doesn't block merge, or a test-management tool that tracks flake rate
per test) — see
ci-cd-pipeline-design for where
quality gates sit in the overall pipeline.Read the actual failure, not just the red status. Open the failed step's log and find the first error, not the last one — a cascade of downstream errors (e.g., "server not reachable" repeated 40 times) is usually caused by one earlier failure (e.g., "port already in use" or "npm ERR! 403 Forbidden"). Scrolling to the bottom of a long log and reacting to the last line is a common way to misdiagnose the real cause.
Classify the failure before deciding on a recovery action:
ECONNRESET, 429 Too Many Requests, no space left on device) rather than an assertion
failure.node_modules/.venv/Maven local repo cache saved mid-
install, or a lockfile/cache-key mismatch after a dependency bump)
causes a build to fail in CI with an error that doesn't reproduce
locally with a clean install. Symptom: errors like "Cannot find
module X" for a package that is definitely declared, or version
mismatches between what's declared and what's actually resolved.Re-run at the narrowest scope that actually re-tests the failure. Re-running the entire pipeline from Source when only one downstream test job failed wastes time and CI minutes, and — worse — can mask a real intermittent failure by giving it more chances to pass by luck.
gh run rerun <run-id> --failed re-runs only failed
jobs.POST /projects/:id/jobs/:job_id/retry), not "Run pipeline" again.Restart from Stage for a specific stage
when the plugin supports it, rather than re-triggering the whole
build.For suspected cache/dependency corruption, invalidate the cache deliberately rather than guessing. Bump the cache key (most CI caches are keyed off a lockfile hash) so the next run rebuilds from a clean state:
# GitHub Actions actions/cache — bump the key suffix to force a miss
- uses: actions/cache@v4
with:
path: ~/.npm
key: npm-${{ hashFiles('package-lock.json') }}-v2 # was -v1
If the corruption recurs across multiple unrelated commits, the root
cause is usually a cache key that doesn't fully capture what changes
the cache's validity (e.g., keyed on package.json but not
package-lock.json, so a lockfile-only change doesn't bust a stale
cache) — fix the key, don't just clear the cache once and move on.
Confirm flakiness quantitatively before quarantining a test, not after a single failed run. Re-run the specific test/job in isolation 3-5 times; a test that fails 1-2 times out of 5 with no code change is flaky, a test that fails once and then passes 10/10 afterward was more likely a genuine environmental blip that day.
# pytest example: re-run only the failed test, several times, in isolation
pytest tests/test_checkout.py::test_concurrent_orders --count=5
Quarantine confirmed-flaky tests visibly, with an owner and a deadline — move them to a non-blocking "flaky" job/tag rather than silently skipping or deleting them, and file a ticket to actually fix the race condition:
# pytest.ini / marker-based quarantine, run separately and non-blocking
markers =
flaky: known-flaky test, tracked in JIRA-1234, does not block merge
pytest -m "not flaky" # blocking CI job
pytest -m "flaky" || true # separate, non-blocking, still visible
If the same job flakes repeatedly across many PRs/commits, treat it as a pipeline reliability problem worth root-causing — a shared test-order dependency, an unpinned external service being hit directly instead of mocked, or a resource limit on the runner (memory, file descriptors) — rather than accepting "CI is just flaky" as a permanent state. This is the CI-specific instance of the toil this causes: engineers re-running CI reflexively instead of trusting it.
Symptom: A build fails in CI with a dependency error that doesn't reproduce when run locally with a fresh checkout. Fix: Suspect a stale/corrupted cache before suspecting the code — bump the cache key and re-run (step 4); if it passes clean, the cache key doesn't capture something that changed (usually a lockfile not included in the key).
Symptom: Engineers reflexively click "re-run" on every red pipeline without reading the log, and a real regression eventually merges because it happened to pass on the second or third try. Fix: Require reading the actual failed step's log and classifying the failure (step 2) before re-running; if a test needs 2-3 re-runs to pass "normally," that is itself evidence of flakiness that should be quarantined and fixed, not treated as routine.
Symptom: A test is marked @skip or deleted after a few flaky
failures, and months later a real bug it would have caught reaches
production.
Fix: Quarantine, don't delete — move it to a non-blocking job with a
tracked ticket and an owner (step 6), so the coverage isn't silently
lost and someone is accountable for fixing the underlying race
condition.
Symptom: The same job has flaked on unrelated PRs for months, and each time someone just re-runs it and moves on. Fix: Treat repeated flakiness on the same job as a reliability problem to root-cause (step 7) — check for shared/leaked state between tests, unmocked calls to a real external service, or runner resource exhaustion, instead of accepting indefinite manual re-runs as normal.
Symptom: A cache-clearing fix works once, but the same corruption comes back a few weeks later after an unrelated dependency bump. Fix: The cache key almost certainly doesn't hash the right input (e.g. it's keyed on a directory listing or a manifest file instead of the lockfile) — fix the key to reflect everything that actually invalidates the cache, not just clear it reactively each time.
Scenario: A GitHub Actions job test-integration fails on a PR with
Error: connect ECONNRESET from a call to an external payments sandbox
API, while the test-unit job in the same run passes.
ECONNRESET from an HTTP call in
tests/integration/test_payment_capture.py, not an assertion failure —
this looks environmental, not a regression in the diff (the diff only
touches an unrelated checkout module).gh run rerun <run-id> --failed re-runs only
test-integration. It passes clean on retry with no code change,
confirming flakiness rather than a real failure.@pytest.mark.flaky(reruns=2, reruns_delay=5) so isolated sandbox
blips don't block unrelated PRs while the real fix is pending —
visible in CI output, tracked, not silently hidden.test-unit run and the flaky integration test is
now quarantined with a tracked fix, so the team isn't stuck re-running
CI on every unrelated PR that happens to touch this suite.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
ci-triage, flaky-tests, pipeline-recovery, ci-cache, test-quarantine
16 skills in this plugin
/artifact-and-dependency-managementManages build artifacts and third-party dependencies through a private registry/proxy with lockfiles, version pinning, retention policies, and automated update workflows. Use when the user asks to "set up an artifact repository," "configure a package registry proxy/mirror," "pin/lock dependency versions," "clean up old artifacts," "handle a dependency update / Dependabot-Renovate PR," or "avoid a left-pad-style supply-chain incident."
/blue-green-canary-deploymentsDesigns and executes progressive delivery strategies — blue-green cutover, canary rollout, and traffic-shifted releases — with automated health checks and rollback triggers, typically on Kubernetes. Use when the user asks to "reduce deployment risk," "set up canary/blue-green deployments," "do a zero-downtime release," "gradually shift traffic to a new version," or "automatically roll back a bad deploy."
/ci-access-and-credential-lifecycle-managementManages the lifecycle of one-off/temporary repo and environment access grants and CI service-account credentials — granting time-boxed access for a specific task, revoking it reliably when the task ends, and rotating CI service-account tokens/keys before they expire or become stale. Use when the user asks to "give a contractor temporary repo access," "grant one-off access to the production environment," "rotate our CI service account token/API key," "find and revoke stale CI credentials," or "our CI token is about to expire, what do we do."
npx claudepluginhub selvarajmurugesan90/ops-engineering-skills --plugin devops-skillsOther plugins' skills for the same job