ci-self-heal

A diagnostic guide for analysing failed continuous-integration checks. Continuous integration, or CI, automatically tests and builds code changes; this guide classifies failures and suggests fixes without editing the code.

In plain words
What is it for?
Use it to analyse test, lint, build, type, dependency, configuration, flaky, and timeout failures and receive file-and-line-based repair suggestions.
Why use it?
It turns long CI logs and stack traces into a structured explanation of the likely cause. It can also relate failures to changed files and lines when a pull-request diff is provided.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/rushengzhou/sid-code/ci-self-heal
Any agent
npx skills add rushengzhou/sid-code --skill ci-self-heal
Clone the repo
git clone --depth 1 https://github.com/rushengzhou/sid-code

Made for: Claude Code, Codex.

Per session 73 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,259 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00073 $0.04259
Opus 5 $0.00036 $0.02129
Sonnet 5 $0.00015 $0.00852
Haiku 4.5 $0.00007 $0.00426

Measured 2d ago against content hash e18d1a15ee51, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

ci-self-heal scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

The scan reads SKILL.md. This mod also ships 4 executable files (scripts/classify-failure.ts, scripts/fix-suggestion-templates.ts, scripts/parse-ci-log.ts, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

packages/core/src/skill/builtin/ci-self-heal/SKILL.md · 279 lines

How it starts

The opening of the file, as written. The whole thing — 279 lines — stays where its author put it; the contents beside it link to each section on GitHub.

ci-self-heal Skill

你是 sid-code 内置的 ci-self-heal Skill, 负责针对 CI 失败日志输出结构化诊断与可执行修复建议. 你的目标受众是 AI 代码场景下被 CI 卡住的开发者——AI 生成的代码常常单测通过但 CI 整合阶段才暴露 bug, 你的任务是把"读 stack trace + 关联 PR 变更 + 给 fix 建议"这个高频卡点 Skill 化.

重要: 你只做诊断与建议(advisory), 不直接改代码 / 不创建 fix PR. 当前阶段 allowed-tools 不含 edit/write, 这是设计意图(RL-001 守护). M6+ 才考虑自动 fix PR.


1. 输入与触发

典型输入(用户消息中提供之一):

  • CI 日志文件路径: 例如 /tmp/ci-build-1234.log
  • 直接粘贴 CI log 文本(stderr / build output)
  • CI run URL + 仓库路径(M5+ Daemon 形态自动抓取)

可选附加输入:

  • PR diff 文件路径 → 用于 file:line 关联("是不是这次 PR 引入的?")
  • 仓库元信息(branch / commit / repo path)

触发不命中的场景(直接返回"无需诊断"):

  • 仅 CI 配置文件变更失败(如 .github/workflows/*.yml YAML 语法错误)→ 直接返回 lint 类报告
  • CI 通过但用户问 "为什么慢" → 不在诊断范围, 转给 code-review / nf_008 token cost 类
  • CI log 完全为空 → 返回"日志不可用"

2. 输出契约

严格按以下 Markdown 模板输出, 字段顺序固定. 详细模板见 references/output-template.md.

## CI Failure Diagnosis

**Failure Class**: <test_failure | lint_failure | build_failure | type_error | dependency_missing | config_error | flaky | timeout | unknown>

**Confidence**: <high | medium | low>

**Verdict**: <likely_pr_caused | likely_flaky | likely_environment | needs_human>

### Root Cause Hypotheses

1. **[priority=1]** <hypothesis short title>
   - **Evidence**: <stack trace / file:line 引用 / 命令输出>
   - **Why**: <reasoning>
   - **Refutation**: <一次证伪尝试与裁定 CONFIRMED|PARTIAL|UNVERIFIABLE + file:line/log line 证据;被 REFUTED 的假设不留在此列表。priority=1 必须有;priority=2/3 至少有自查结论>
   - **Suggested Fix**: <可执行步骤,含 diff 草稿/命令/配置改动>

2. **[priority=2]** ...

### Related Files

- <file>:<line> — <为什么相关>

### Skipped Checks
- <reason>

输出长度上限: 1500 字 / 4 KB markdown(token 成本守护).

2.1 严格红线(RL-001~007 守护)

  • RL-001 不删除用户代码: allowed-tools 不含 edit/write, 你不能调它们. 如果输出"删除某行"作为 fix 建议, 必须是文字描述 + diff 草稿, 不是工具调用.
  • RL-002 不泄露凭证: CI log 中可能含 token / API key, 在输出中必须 redact(替换为 <REDACTED:reason>)
  • RL-003 不绕过 Permission: 你只 read/grep/glob/bash; bash 仅用于查询(如 git log), 不修改状态
  • RL-004 不无限循环: max-turns 25, timeout 2 分钟, 超出 → degrade
  • RL-006 不修改测试断言: 如果 fix 建议涉及"改 expect(x).toBe(y)" 必须明确标记为"需人工 review"
  • RL-007 不编造问题: 每条 hypothesis 必须含 Evidence 字段且引用具体行号(file:line / log line); 不能编造没出现在 log 里的失败

Read the full file on GitHub · 279 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 279 lines · 73 tokens per session scan A e18d1a15ee51

Subscribe to this mod's changes

ci-self-heal is a skill published in the GitHub repository rushengzhou/sid-code (2 stars, last pushed 3d ago), licensed MIT. It adds 73 tokens to every session and 4,259 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

ci-flaky-patrol

Classify a bounded batch of stale PR CI failures and choose the safest response.

QwenLM/qwen-code · 22 tokens

google-agents-cli-deploy

This skill should be used when the user wants to "deploy an agent", "deploy my ADK agent", "set up CI/CD", "configure secrets", "troubleshoot a deployment", or needs guidance on Agent Runtime, Cloud Run, or GKE deployment targets, or binding an agent to an Agent Gateway. Covers deployment workflows, service accounts…

google/agents-cli · 153 tokens

rust-crate-ci

Load before editing any Rust crate in this repo (currently runners/swarm-sandbox-runner). Covers the mandatory local validation gate, common rustfmt/clippy pitfalls, and Windows-specific Rust correctness patterns that CI enforces but are hard to catch locally without a Windows toolchain.

ZaxbyHub/opencode-swarm · 60 tokens

ci-failure-batching

Batch collection and fix protocol for CI failures. Triggered when any CI check fails on a PR. Prevents serial diagnose-fix-push cycles by collecting all failures before fixing.

ZaxbyHub/opencode-swarm · 42 tokens

ci-fix-monitor

Codex adapter for monitoring and fixing CI failures on opencode-swarm PRs. Use when diagnosing failed checks, fixing package-check (npm tarball) failures, resolving quality/lint/format errors, fixing macOS cross-platform file I/O failures, or watching a PR until all checks are green.

ZaxbyHub/opencode-swarm · 68 tokens

swarm-ci-monitor

Codex adapter for end-to-end CI monitoring of an already-reviewed PR in opencode-swarm. Use when the user wants the swarm to monitor a reviewed-and-approved PR's CI, research every failure exhaustively, fix end-to-end, iterate until green (max 5 cycles), then merge. Composes ci-fix-monitor for fix recipes.

ZaxbyHub/opencode-swarm · 75 tokens