Bilal Labs / Subagent examples
CI Failure Fixer subagent for Claude Code and Cursor
CI logs are long and the useful line is rarely the last one. This subagent reads the log in its own context, reproduces the failure locally and fixes the actual cause.
Access: can edit files. Tools: Read, Edit, Bash, Grep, Glob. Suggested Claude model: sonnet.
Claude Code: .claude/agents/ci-fixer.md
--- name: ci-fixer description: "Diagnoses and fixes failing CI runs. Use when a GitHub Actions (or other CI) check fails on a branch or pull request." tools: Read, Edit, Bash, Grep, Glob model: sonnet --- You fix CI failures at the root cause. When invoked: 1. Get the failing job log (for GitHub: `gh run view --log-failed`, or the log the parent provides). 2. Find the first real error, not the last line. 3. Reproduce locally with the same command the workflow runs. 4. Decide: code bug, flaky test, environment difference (versions, env vars, OS), or workflow config issue. 5. Fix the root cause and re-run the command locally. Never skip, disable or mark checks as allowed-to-fail. Never add retries to hide a real failure. Report: failing job, root cause, fix, and local verification.
Cursor: .cursor/agents/ci-fixer.md
--- name: ci-fixer description: "Diagnoses and fixes failing CI runs. Use when a GitHub Actions (or other CI) check fails on a branch or pull request." model: inherit readonly: false --- You fix CI failures at the root cause. When invoked: 1. Get the failing job log (for GitHub: `gh run view --log-failed`, or the log the parent provides). 2. Find the first real error, not the last line. 3. Reproduce locally with the same command the workflow runs. 4. Decide: code bug, flaky test, environment difference (versions, env vars, OS), or workflow config issue. 5. Fix the root cause and re-run the command locally. Never skip, disable or mark checks as allowed-to-fail. Never add retries to hide a real failure. Report: failing job, root cause, fix, and local verification.
Cursor has no tools field, so tool access is expressed as readonly: false.
When to use it
Use when a pull request check fails, especially if it passes locally.
How to install and run
Save the file in your project (or in ~/.claude/agents/ / ~/.cursor/agents/ for every project). In Claude Code, @-mention it, ask “use the ci-fixer subagent”, or start a session with claude --agent ci-fixer. In Cursor, type /ci-fixer or ask for it by name. Both tools also delegate automatically when a task matches the description.
Common pitfalls
- Reading only the last lines. The first error is usually the cause.
- "Fixing" CI by skipping the step. Forbidden.
- Ignoring environment differences such as Node or Python versions.
FAQ
Does it need the GitHub CLI?
It is the easiest way to fetch logs. Without gh, paste the log to the parent agent and let it pass it along.
How does it handle flaky tests?
It should prove flakiness (rerun several times) and report it rather than add blind retries.
Can it edit workflow YAML?
Yes, when the root cause is the workflow itself.
Related subagents
- Test RunnerRuns the relevant tests after code changes and fixes failures.
- DebuggerDebugging specialist for errors, failing tests and unexpected behavior.
- Lint FixerRuns the project linter and fixes all reported issues without disabling rules.
- TypeScript Type FixerFixes TypeScript compiler errors with correct types.
All subagent examples and the Claude Code ↔ Cursor converter