---
name: fix-failing-ci-checks
description: "Finds why CI checks are failing, explains the root cause, proposes a fix plan, and only implements it once you approve. Use when a pull request has red CI checks and the developer wants the cause diagnosed and a fix proposed before any code is changed. Do not use for writing new tests or speeding up a slow pipeline. Related topics: devops, coding."
---

# Fix Failing CI Checks

Finds why CI checks are failing, explains the root cause, proposes a fix plan, and only implements it once you approve.

## When to use

Use this skill when a pull request has red CI checks and the developer wants the cause diagnosed and a fix proposed before any code is changed. Do not use it for writing new tests or speeding up a slow pipeline.

## Workflow

1. Ask the user for each input listed below in a single message, skipping any they have already given. Where options are listed, offer them, but accept other answers too.
2. Read the logs from the first error and classify each failure as regression, flaky, environment, or pipeline.
3. Reproduce the failure locally with the same command CI uses when possible.
4. Summarise the root cause in plain language, naming the file or step responsible.
5. Present a fix plan with the change, reason, risk, and verification, then wait for approval.
6. After approval, implement within the allowed scope and rerun the failing command to confirm.

## Inputs

- **Pull request or branch** (free text, e.g. "Link or name")
- **CI system** (choose one: GitHub Actions, GitLab CI, CircleCI, Jenkins, Other)
- **Failing check names** (longer free text)
- **Log excerpt** (longer free text)
- **Recent changes** (longer free text)
- **Allowed fix scope** (choose one: Code only, Code and tests, Code and CI config)

## Output

A root cause summary, a fix plan awaiting approval, and after approval the change made with the rerun result.

## Prompt template

Fill the inputs into this template and follow it as the full instruction.

### Fix Failing CI Checks

Investigate my failing CI run and fix it with my approval.

- Pull request or branch: {{Pull request or branch}}
- CI system: {{CI system}}
- Failing check names: {{Failing check names}}
- Log excerpt: {{Log excerpt}}
- Recent changes: {{Recent changes}}
- Allowed fix scope: {{Allowed fix scope}}

Read the logs from the first error, not the last, since later failures are often side effects. Classify each failure: real regression, flaky test, environment or dependency change, or misconfigured pipeline. Reproduce locally when possible with the same command CI uses. Write a root cause summary in plain language, with the exact file or step responsible. Then propose a fix plan: the change, why it solves the cause, the risk, and how to verify. Stop and wait for my approval. After approval, implement only what the plan says within the allowed scope, rerun the failing command, and report the result. Never disable or skip a check to turn it green.

## Pitfalls

- Fixing the last error in the log, which is often a symptom of an earlier one.
- Skipping or disabling a failing check to get a green build.
- Implementing before approval and making changes the owner did not want.
