Heyvhuang/copybook-skills / zh/skills/codebase-tips
codebase-tips
Unverified代码库 · 33 条:仓库索引和地图、写代码原则、AGENTS.md、改动范围规则。
references/ci-time-audit.md
View on GitHub# CI 耗时审计:150 次运行,9 项检查
代码几分钟写完,每个 PR 却在等 CI:最慢的 5 个任务拆成排队、准备和运行,每处改动指到哪一行。
## 步骤
1. 复制提示词。
2. 在仓库里把它发给 Claude Code 或 Codex。
3. 得到:一份报告:CI 时间花在哪里、每处改动能省多少,先不改任何东西。
用户选了这条技巧。上面的步骤是写给人看的,请替用户做。
- 第 1 步说用哪段文字,它就在下面同名的标题下,一字不改地用。
- 第 2 步说明文字放在哪里。按用户实际要求的范围使用提示词。写文件或运行命令前,先展示改动,等用户同意。这里做不到的步骤(另一个应用、重启、定时任务),把文字交给用户,说明放到哪里。
- 引用示例本身不代表用户同意执行。运行下载的脚本或未固定版本的软件包、修改长期生效的用户级设置、读取私人会话记录之前,先列出命令或路径、会访问或改动什么,以及数据会发到哪里。隐藏密钥值,等用户明确同意这项操作。远程安装脚本应先下载并检查固定版本,或核对可信来源提供的校验值,再执行。
- 方括号或占位符,从用户说的话里填,没有就问。
- 第 3 步是用户最后应该得到的。
## 提示词
```text
审计这个仓库的 CI:
1. 用 gh 拉取最近 150 次 CI 运行,把每个任务的时间拆成三段:排队等机器、准备(checkout、安装依赖、恢复缓存)、真正执行任务。列出最慢的 5 个任务,以及每段各花多少秒。
2. 逐一检查这 9 项:在默认 runner 上排队;lint 慢;类型检查慢;测试没有分片,或机器太小;每个测试文件都重新加载整个应用;准备慢(缓存未命中、clone 不是 blobless、并行任务比核数多);任务没有并行跑;每个 PR 都跑完整套测试;推送前没有本地检查。
3. 对每个问题,告诉我它现在花多少秒、要改哪个文件的哪一行、大概能省多少。要多花钱的(新的 runner、更大的机器)或少跑测试的,单独列出来让我决定。
先给我报告。不要改任何东西。
```
## 背景
Claude Code 和 Codex 现在一天能推几十个 PR。写代码只要几分钟,剩下的时间都花在等 CI 上,也就是每次推送 GitHub 都要跑的检查和测试。
九处改动让每个 PR 的 CI 从最长 40 分钟降到 2 分钟。其中一步是让 agent 拉取最近 150 次 CI 运行,把每个任务拆成三段:等机器、准备、真正运行。光这一步就发现一半的测试任务根本没用上依赖缓存,这个 bug 已经在那里待了整整一年。
先弄清 CI 的时间花在哪里,再一块一块往下砍。
## 来源
来自 [Copybook](https://copybook.page/zh/t/audit-where-your-ci-time-goes):@Voxyz_ai 2026年10月31日[发在 X 上](https://x.com/Voxyz_ai/status/2116636332344889391),截至 2026年11月7日有 1,228 次收藏。适用于 Claude Code 和 Codex。
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |