AGENT SKILL

CI 不稳定失败排查

ci-investigate

调查多次工作流运行中的 CI 不稳定失败,以识别规律、归类根本原因并提出修复建议。当被要求调查 CI 失败、查找不稳定测试、诊断测试抖动或理解 CI 为何反复失败时使用。

适用职业测试工程师
License 许可
MIT
所属仓库
drn/dots
最近更新
2026-11-12
Stars
★ 23
Forks
4

01 前言 Front Matter

name
ci-investigate
description
Investigate flaky CI failures across multiple workflow runs to identify patterns, categorize root causes, and propose fixes. Use when asked to investigate CI failures, find flaky tests, diagnose test flakiness, or understand why CI is failing repeatedly.

03 SKILL.md 正文

CI Failure Investigator

Investigate flaky CI failures across multiple workflow runs to identify patterns, categorize root causes, and propose targeted fixes.

Arguments

  • $ARGUMENTS - Optional: job name filter, number of runs to check, or branch name. Examples: "test-core-rspec", "--runs 10", "master"

If no arguments are provided, investigate the most recent failing workflow on the current branch.

Context

  • Current branch: !git branch --show-current
  • Repo remote: !git remote get-url origin 2>/dev/null | head -1
  • CI config: !find . -maxdepth 2 \( -name ".circleci" -o -name ".github" \) -type d 2>/dev/null | head -5
  • CircleCI config snippet: !head -30 .circleci/config.yml 2>/dev/null | head -30

Instructions

Investigate CI failures by fetching multiple workflow runs, extracting test results, and categorizing failure patterns.

Step 1: Determine Scope

Parse $ARGUMENTS for:

  • Job name filter (e.g., "test-core-rspec") -- only analyze jobs matching this name
  • Run count (e.g., "--runs 10") -- how many recent runs to check (default: 5, max: 15)
  • Branch -- which branch to investigate (default: current branch from context above)

Derive the project slug from the git remote URL. For GitHub repos, format is "gh/org/repo".

Report the scope to the user before proceeding:

  • Project slug
  • Branch
  • Job filter (if any)
  • Number of runs to fetch

Step 2: Fetch Recent Workflow Runs

Detect the CI provider from the context above and use the appropriate tools.

CircleCI (if .circleci/ exists): Use ToolSearch to find available CircleCI MCP tools (search "circleci"). Then:

  1. Fetch recent pipelines for the project slug and branch
  2. For each pipeline, get its workflows
  3. For each workflow, get jobs and their statuses
  4. Filter to failed jobs (and optionally by job name from Step 1)

GitHub Actions (if .github/workflows/ exists): Use the gh CLI:

  1. gh run list --branch {branch} --limit {N} to get recent runs
  2. gh run view {run_id} to get job details
  3. gh run view {run_id} --log-failed to get failure output

Collect up to the target number of failed runs. If a workflow has no failures, skip it but note it as a passing run (useful for calculating flake rate).

Track:

  • Total workflow runs examined
  • Number with failures vs passing
  • Which specific jobs failed in each run

Step 3: Extract Failure Details

For each failed job found in Step 2:

CircleCI:

  1. Fetch test results for the failed job (with artifacts and logs if the MCP tools support it)
  2. If 0 test failures but non-zero exit code, fetch raw job logs. Flag as infrastructure failure.

GitHub Actions:

  1. Use gh run view {run_id} --log-failed to get failure output
  2. Parse test framework output (JUnit XML, RSpec, Jest, etc.) for structured results

For each failure, extract:

  • Test file path
  • Test name
  • Error message and stack trace
  • Node/container number (for parallel test splitting issues)

Use parallel Task tool calls to fetch test results for multiple jobs simultaneously when possible.

Step 4: Categorize Failures

Group failures by test file + test name. For each group, classify the root cause:

Category Signals Common Fix
Deterministic Fails every run, same error Fix the test or code -- this is a real bug
Timing flake Intermittent, error involves time comparison, values differ by milliseconds Freeze time in tests, use tolerance matchers
Parallel collision Hard-coded IDs, PK violations, "Duplicate entry" Use sequences/auto-increment, avoid hard-coded IDs
Test isolation Order-dependent failures, shared mutable state between tests Reset state between tests, avoid global side effects
Infrastructure 0 test failures + exit code 1, OOM killed, container timeout Retry or investigate resource limits
External dependency Timeout connecting to external service, API errors Add retry logic or stub external calls in tests

If a failure does not clearly fit one category, mark it as Unclassified and include the full error for manual review.

Step 5: Report Findings

Present the findings in this format:

## CI Investigation Report

**Scope:** {project} / {branch} / {job filter or "all jobs"}
**Runs analyzed:** {N} ({pass_count} passed, {fail_count} failed)
**Overall flake rate:** {fail_count/N * 100}%

### Failure Groups (by frequency)

#### 1. {test_file}:{test_name} -- {category}
- **Frequency:** {X}/{N} runs ({percentage}%)
- **Error:** {1-2 line error summary}
- **Affected nodes:** {node numbers if relevant}
- **Root cause:** {explanation}
- **Proposed fix:**
  {specific code change or strategy}

#### 2. ...

### Infrastructure Failures
{List any jobs that failed with 0 test failures}

### Cross-Repo Issues
{Flag any fixes needed in shared gems (Nucleus, etc.) or CI configuration}

### Recommended Priority
1. {highest frequency flake} -- affects X% of runs
2. ...

Step 6: Offer Next Steps

After presenting the report, ask the user if they want to:

  1. Fix a specific flake -- implement the proposed fix for a chosen failure group
  2. Investigate deeper -- fetch more runs or drill into a specific failure
  3. Export the report -- save findings to a file for reference

04 同仓库更多 Skills

drn
drn/dots

batch-pr-review

Review a batch of pull requests together, describe every change in plain language, and build a private Claude artifact that eases human review, with a severity-tagged and verified findings list. Use when asked to review several PRs, a stack of PRs, PRs listed in a Slack thread or message, or to summarize a batch of PRs for a reviewer.

★ 23
drn
drn/dots

Codex 目标设置包生成

plannotator-setup-goal

为长时间运行的 /goal 工作创建经过审查的 Codex 目标设置包。当用户想把想法、待办清单、项目使命或模糊目标,转化为项目 goals slug 文件夹下的持久化目标文件时使用;包含 Plannotator 审查关卡,覆盖简报、带验收标准的叙述性计划、验证方案、阻碍项,以及最终的 /goal 提示词。

项目经理任务规划与分解
★ 23
drn
drn/dots

plannotator-annotate

Open Plannotator's annotation UI for a markdown file, converted HTML file, URL, or folder and then respond to the returned annotations.

★ 23
drn
drn/dots

Claude 技能编写

write-skill

创建或改进 Claude Code 技能/斜杠命令,遵循结构、动态上下文和安全性方面的最佳实践。用于创建新技能、改进现有技能,或学习技能编写。

AI 工程师插件与技能管理
★ 23
drn
drn/dots

会话收尾检查

wrapup

会话结束时的检查清单,用于检测遗漏事项——未提交的变更、未合并的分支、需记录的经验教训、需完成的交接——并路由到相应的技能。用于会话收尾、结束工作、一天结束,或“还有其他要记录的吗”。

软件开发工程师编码会话复盘
★ 23
drn
drn/dots

文本转语音朗读

tts

使用文本转语音(text-to-speech)大声朗读文本。当用户说“读给我听”“念给我听”“大声朗读这个”“说出这个”“朗读摘要”,或要求听到某内容被朗读时使用。

普通用户音频与语音处理
★ 23