用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/qiniu/go-sdk --skill ci-analyze命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
| name | ci-analyze |
| description | 分析 CI 失败原因并给出修复建议。在用户提到 CI 失败、pipeline 失败、构建失败、测试失败时使用。典型场景:PR 合前 CI 红、需要根因与修复建议时。 |
| argument-hint | <PR 编号或 CI URL> |
| allowed-tools | ["Read","Grep","Glob","Bash(gh run list:*)","Bash(gh run view:*)","Bash(gh pr view:*)","Bash(gh pr checks:*)","Bash(gh api *)","Bash(git *)","Bash(curl *)","Bash(jq *)","Bash(cat *)","Bash(wc *)","Bash(head *)","Bash(tail *)","Bash(grep *)"] |
开始时声明:"我正在使用 ci-analyze skill 分析 CI 失败原因。"
本项目使用 GitHub Actions(.github/workflows/ci-test.yml),CI 流程:
gofmt -s -l . 检查未格式化文件make staticcheckgo build ./examples/...make unittest# 按 PR 编号分析
ci-analyze 123
# 按 run URL 分析
ci-analyze https://github.com/qiniu/go-sdk/actions/runs/999999
# 获取 PR 的 CI checks
gh pr checks <PR编号> --repo qiniu/go-sdk
# 或获取最近一次 workflow run 的失败
gh run list --repo qiniu/go-sdk --branch <branch> --limit 5
gh run view <run-id> --repo qiniu/go-sdk --log-failed
获取 CI 状态概览:
gh pr view <PR编号> --repo qiniu/go-sdk \
--json statusCheckRollup \
--jq '.statusCheckRollup[]? | {name: .context, state: .state, url: .targetUrl}'
# GitHub Actions 失败日志
gh run view <run-id> --repo qiniu/go-sdk --log-failed
对每个失败的 check/job:
## CI 失败分析报告
### 失败汇总
| 序号 | 测试/Job | 错误类型 | 根因 | 置信度 |
|------|----------|----------|------|--------|
| 1 | ... | ... | ... | 高/中/低 |
### 详细分析
#### 失败 1: <测试名>
错误信息:
<具体错误日志>
日志来源:
<GitHub Actions URL 或 API 端点>
根因分析:
<分析过程>
修复建议:
<具体修复方案>
相关代码:
<文件路径:行号>
gofmt -s -w . 或修复 staticcheck 报告的问题| 失败类型 | 典型表现 | 修复方式 |
|---|---|---|
| gofmt | "Files not formatted" | gofmt -s -w . |
| staticcheck | SA/S/ST 开头的错误码 | 按 staticcheck 建议修复 |
| examples 编译 | go build ./examples/... 失败 | 检查 examples 依赖的包是否有 breaking change |
| 单元测试 | FAIL + 具体测试函数名 | 定位测试代码和被测代码 |
| Windows/macOS | 平台相关路径、换行符问题 | 使用 filepath.Join 等跨平台写法 |
只有满足以下条件才能判定为 flaky:
# 检查历史运行
gh run list --repo qiniu/go-sdk --branch <branch> --workflow "Run Test Cases" --limit 10
执行本 skill 时同时遵守 AGENTS.md 中的系统规范;与本 skill 冲突时以本 skill 为准。
基于 SOC 职业分类