بنقرة واحدة
ci-job-analysis
CI Job 失败分析知识库,包含失败类型分类、置信度评估、技术栈识别和常见错误模式
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
CI Job 失败分析知识库,包含失败类型分类、置信度评估、技术栈识别和常见错误模式
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
工作流过程日志格式规范和写入模式。定义 JSONL 和文本两种格式的日志结构、事件类型、级别定义和写入方法。
master-coordinator 和 review-coordinator 共享的通用模式,包括 Phase 验证、错误处理、TodoWrite 管理和状态说明。所有 coordinator agents 应引用此 skill 以保持一致性。
计划执行工作流知识库,包含计划格式规范、任务解析、依赖分析和执行策略
Strunk 写作规则,用于提升文档质量。适用于所有面向人类读者的文本:文档、报告、注释、提交信息等。
PR Review 修复模式库。在处理 PR Review 评论时自动查阅,寻找已知问题模式和解决方案。
通用 Bugfix 工作流知识库,包含 TDD 流程、输出格式规范、置信度评分标准和通用最佳实践。适用于所有技术栈(backend/frontend/e2e)。
| name | ci-job-analysis |
| description | CI Job 失败分析知识库,包含失败类型分类、置信度评估、技术栈识别和常见错误模式 |
本知识库提供 GitHub Actions Job 失败分析和修复的专业知识。
| 子类型 | 频率 | 关键信号 | 可自动修复 |
|---|---|---|---|
| unit_test | 45% | pytest FAILED, jest FAIL, vitest | 是 |
| integration_test | 30% | integration, api test, mock server | 是 |
| snapshot_test | 15% | snapshot, toMatchSnapshot | 是 |
| other_test | 10% | 其他测试框架 | 部分 |
注意:频率数据基于历史统计,总和为 100%。
常见根因:
修复策略:
1. 定位失败测试和断言
2. 比较期望值 vs 实际值
3. 追踪数据流到源头
4. 更新 mock 或修复断言
5. 验证修复
| 子类型 | 频率 | 关键信号 | 可自动修复 |
|---|---|---|---|
| timeout | 35% | Timeout, 30000ms, waiting for | 是 |
| selector | 30% | strict mode, not found, resolved to | 是 |
| assertion | 20% | expect().toHave, toBeVisible | 是 |
| network | 15% | Route handler, net::ERR | 部分 |
常见根因:
修复策略:
1. 分析超时/选择器错误的具体位置
2. 检查 UI 是否变更
3. 添加适当的等待策略
4. 更新选择器或断言
| 子类型 | 频率 | 关键信号 | 可自动修复 |
|---|---|---|---|
| typescript | 45% | tsc, error TS, compile | 部分 |
| webpack | 20% | webpack, Module not found | 部分 |
| python | 20% | SyntaxError, ModuleNotFound | 部分 |
| other | 15% | build failed, make error | 否 |
常见根因:
| 子类型 | 频率 | 关键信号 | 可自动修复 |
|---|---|---|---|
| eslint | 50% | eslint, @typescript-eslint | 是 |
| ruff | 25% | ruff, E501, W503 | 是 |
| prettier | 20% | prettier, formatting | 是 |
| other | 5% | mypy, pylint | 部分 |
快速修复路径:
# ESLint
npx eslint --fix {files}
# Ruff
ruff check --fix {files}
# Prettier
npx prettier --write {files}
| 子类型 | 频率 | 关键信号 | 可自动修复 |
|---|---|---|---|
| typescript | 70% | tsc --noEmit, error TS | 部分 |
| mypy | 30% | mypy, type: ignore | 部分 |
常见错误类型:
| 错误码 | 描述 | 自动修复 |
|---|---|---|
| TS2345 | 参数类型不匹配 | 否 |
| TS2322 | 类型赋值错误 | 否 |
| TS2339 | 属性不存在 | 否 |
| TS7006 | 隐式 any | 是 |
| 子类型 | 频率 | 关键信号 | 可自动修复 |
|---|---|---|---|
| npm | 40% | npm install, ERESOLVE | 否 |
| pip | 35% | pip install, requirement | 否 |
| yarn | 15% | yarn, resolution | 否 |
| other | 10% | pnpm, poetry | 否 |
常见问题:
建议:依赖问题通常需要手动处理,因为涉及版本策略决策。
| 子类型 | 频率 | 关键信号 | 可自动修复 |
|---|---|---|---|
| env | 50% | env, secret, KEY_ERROR | 否 |
| permission | 30% | permission denied, 403 | 否 |
| config_file | 20% | config, settings | 否 |
不可自动修复原因:涉及敏感信息和权限配置,需要人工处理。
| 子类型 | 频率 | 关键信号 | 可自动修复 |
|---|---|---|---|
| runner | 40% | runner, self-hosted | 否 |
| resource | 35% | OOM, killed, disk | 否 |
| network | 25% | network, timeout | 否 |
不可自动修复原因:涉及 CI 基础设施,需要运维处理。
| 因素 | 权重 | 描述 |
|---|---|---|
| 信号明确性 | 40% | 错误信号是否清晰明确 |
| 文件定位 | 30% | 是否能定位到具体文件和行号 |
| 模式匹配 | 20% | 是否匹配已知错误模式 |
| 上下文完整 | 10% | 是否有完整的堆栈追踪 |
| 分数 | 级别 | 行为 |
|---|---|---|
| >= 80 | 高 | 自动修复 |
| 60-79 | 中 | 询问用户后修复 |
| 40-59 | 低 | 展示分析,建议手动 |
| < 40 | 极低 | 跳过 |
提升条件:
降低条件:
backend:
patterns:
- "**/*.py"
- "tests/backend/**"
- "tests/unit/**"
- "src/api/**"
- "app/**"
signals:
- "pytest"
- "FastAPI"
- "Django"
- "Python"
frontend:
patterns:
- "**/*.tsx"
- "**/*.jsx"
- "**/*.ts"
- "tests/frontend/**"
- "src/components/**"
signals:
- "jest"
- "vitest"
- "React"
- "Vue"
e2e:
patterns:
- "e2e/**"
- "tests/e2e/**"
- "playwright/**"
- "cypress/**"
signals:
- "playwright"
- "cypress"
- "puppeteer"
当检测到多个技术栈时:
secondary_stack# 断言失败
FAILED tests/test_xxx.py::test_name - AssertionError: assert X == Y
# 异常未捕获
FAILED tests/test_xxx.py::test_name - ExceptionType: message
# fixture 错误
ERROR tests/test_xxx.py::test_name - fixture 'xxx' not found
# 导入错误
ERROR tests/test_xxx.py - ModuleNotFoundError: No module named 'xxx'
# 断言失败
FAIL src/xxx.test.ts
✕ test name (123ms)
expect(received).toBe(expected)
# 超时
FAIL src/xxx.test.ts
✕ test name (5001ms)
Timeout - Async callback was not invoked within 5000ms
# 快照失败
FAIL src/xxx.test.ts
✕ test name
expect(received).toMatchSnapshot()
# 超时
Error: locator.click: Timeout 30000ms exceeded.
waiting for locator('selector')
# 选择器问题
Error: locator.click: Error: strict mode violation:
locator('selector') resolved to 2 elements
# 断言失败
Error: expect(locator).toBeVisible()
Locator expected to be visible
# 类型不匹配
error TS2345: Argument of type 'X' is not assignable to parameter of type 'Y'
# 属性不存在
error TS2339: Property 'xxx' does not exist on type 'Y'
# 隐式 any
error TS7006: Parameter 'xxx' implicitly has an 'any' type
| 失败类型 | 修复方式 | 关联工作流 |
|---|---|---|
| test_failure (backend) | bugfix_workflow | /fix-backend |
| test_failure (frontend) | bugfix_workflow | /fix-frontend |
| e2e_failure | bugfix_workflow | /fix-e2e |
| lint_failure | quick_fix | 直接运行 lint --fix |
| type_check_failure | bugfix_workflow | 对应栈工作流 |
| build_failure | bugfix_workflow | 对应栈工作流 |
| dependency_failure | manual | 无 |
| config_failure | manual | 无 |
| infrastructure_failure | manual | 无 |
def calculate_similarity(current, historical):
score = 0
# 错误类型匹配 (30%)
if current.failure_type == historical.failure_type:
score += 30
# 文件路径匹配 (25%)
file_overlap = len(set(current.files) & set(historical.files))
score += min(25, file_overlap * 5)
# 错误消息相似 (25%)
message_similarity = text_similarity(current.error, historical.error)
score += message_similarity * 25
# 修复模式相似 (20%)
if current.suggested_fix_type == historical.fix_type:
score += 20
return score
值得记录为历史案例的修复: