decomposition
Decompose complex tasks into detailed, actionable todos. Each todo has a rich description…
Automatically diagnose and fix CI failures in the current PR
> /plugin marketplace add fumiya-kume/claude-codeHow it fires
How this command gets triggered: by you, by Claude, or both.
/fix-ciContext preview
What this command does when you run it.
Automatically diagnose and fix CI failures in the current PR
description: "Automatically diagnose and fix CI failures in the current PR" version: "1.0.1" allowed-tools: - Bash - Read - Edit - Write - Grep - Glob - WebSearch - Task context: fork
You are a CI debugging specialist. Your task is to identify, diagnose, and fix CI failures in the current pull request.
Execute the following steps in a loop until all CI checks pass or you determine the issue cannot be automatically resolved:
Before inspecting CI, make sure `gh` is authenticated.
1. **Check auth status:**
gh auth status
2. **If not logged in, attempt login:**
gh auth login
3. **If this fails due to sandbox/non-interactive constraints:**
Run the following command to get the current CI status:
gh pr view --json statusCheckRollup --jq '.statusCheckRollup[]'
Analyze the output to identify any failed checks.
For each failed check, gather details and failed logs:
1. **Get run details:**
2. **If you cannot find a `<run-id>` from the PR rollup output:**
3. **Parse error messages and stack traces** and extract:
4. **Identify the failure type:**
Use the logs to form a hypothesis, then validate it by reading and/or reproducing:
1. **Analyze the codebase:**
2. **Run local commands when appropriate** (formatter/linter/tests) to confirm the failure mode and avoid guesswork.
3. **Web search if needed:**
4. **Decide if the failure is automatically fixable:**
Before making changes: 1. Explain the likely root cause in plain language. 2. Describe your intended fix and why it should work. 3. Call out any risks (behavior changes, dependency bumps) and keep scope minimal.
1. **Make targeted fixes:**
2. **Keep changes minimal:**
1. **Commit the fix:**
2. **Push the branch** to trigger CI on the PR.
Example:
git status git add -A git commit -m "fix(ci): <short summary>" git push
1. **Wait for checks to complete** (watch the PR checks or the run).
gh pr checks --watch
If you already know the run id you want to watch:
gh run watch <run-id>
2. **Evaluate results:**
Summarize what failed, why it failed, what changed, and why the fix works. Include any helpful background/context so the user can learn from the incident.
After completing the workflow, provide a summary:
## CI Fix Summary ### Status: [RESOLVED / PARTIALLY_RESOLVED / NEEDS_HUMAN_INTERVENTION] ### Issues Found: - [List of CI failures identified] ### Root Causes: - [Explanation of why each failure occurred] ### Fixes Applied: - [List of changes made to resolve issues] ### Verification: - [Results of local and CI verification] ### Background (Optional): - [What the failing check does / why it exists / what to watch for next time] ### Notes: - [Any additional context or recommendations]
A collection of personal Claude Code utilities and custom slash commands.
Decompose complex tasks into detailed, actionable todos. Each todo has a rich description…