Ci Fix
Diagnose and fix all CI failures autonomously — format, lint, docstrings, types, tests, and coverage. Use when the user asks to "…
Claude CodeGeneric
---
description: Diagnose and fix all CI failures autonomously — format, lint, docstrings, types, tests, and coverage. Use when the user asks to "fix CI", "make CI green", or resolve pipeline failures.
allowed-tools: Read Write Edit Grep Glob Bash(just *) Bash(uv *) Bash(git diff:*) Bash(git status:*)
disable-model-invocation: true
context: fork
---
Diagnose and fix all CI failures in this project. You are an autonomous CI-fixing agent.
## Step 1 — Run CI and capture output
```bash
just ci 2>&1
If CI passes (exit 0), report success and stop.
Step 2 — Classify failures
Parse the output and classify each failure into one of these categories:
| Category | Tool | Typical pattern | Fix strategy |
|---|---|---|---|
| Format | ruff format | "would reformat" | Run just fmt — fully automatic |
| Lint | ruff check | E, F, I, UP, B, SIM, C4, RUF, PERF, T20 |
Run just fix for auto-fixable; manual fix for others |
| Docstring | ruff D rules |
D1xx, D2xx, D3xx, D4xx |
Add or fix Google-style docstrings |
| Type | basedpyright | "error: Type X cannot be assigned to Y" | Fix type annotations, add casts, narrow types |
| Test | pytest | "FAILED tests/..." | Fix test or implementation logic |
| Coverage | pytest-cov | "FAIL Required test coverage" | Add missing tests |
| Import | ruff I rules |
I001 |
Run just fix — auto-fixable |
Step 3 — Fix in priority order
Fix failures in this order (cheapest and most impactful first):
- Format + Import —
just fix && just fmt(fully automatic) - Lint —
just fixfor auto-fixable, then manual fixes - Docstrings — add missing Google-style docstrings. Read the
python-docstringsskill (skills/python-docstrings/SKILL.md) for guidance if available. - Type errors — fix annotations. Read the
python-code-qualityskill (skills/python-code-quality/SKILL.md) for basedpyright guidance if available. - Test failures — read the failing test, understand what it asserts, fix the
implementation or the test. Read the
pytestskill (skills/pytest/SKILL.md) for patterns if available. - Coverage — identify uncovered lines with
just coverage, write tests.
Step 4 — Iterate
After fixing each category:
- Re-run
just ci 2>&1 - If new failures appear, classify and fix them
- Repeat until CI passes (exit 0)
Hard limit: Do not attempt more than 5 full CI iterations. If still failing after 5 rounds, report the remaining failures and ask the user for guidance.
Step 5 — Report
When CI passes (or after hitting the iteration limit), produce a summary:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
CI Fix Report
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Status: ✅ ALL GREEN (or ❌ FAILURES REMAIN)
Iterations: N
Duration: ~Xm
Fixes applied:
- [Format] Reformatted 3 files
- [Lint] Fixed 5 ruff violations (2 auto, 3 manual)
- [Docstring] Added docstrings to 2 functions
- [Type] Fixed 1 type annotation in core.py
- [Test] Fixed assertion in test_core.py
Files changed:
- src/mypackage/core.py
- tests/test_core.py
Remaining issues: (if any)
- <description>
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Rules
- Fix the root cause, not the symptom. A
# type: ignoreis not a fix. - Do not weaken linter or type checker configuration.
- Do not delete or skip tests to make CI pass.
- Do not use
--no-verifyon any git command. - Every fix must preserve existing test behaviour — run tests after each change.
- If a fix requires architectural changes beyond the scope of the failing code, stop and ask the user instead of making sweeping changes.
Maintain Ci Fix?
Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.
[Ci Fix on getagentictools](https://getagentictools.com/loops/buddingengineers12345-ci-fix?ref=badge)