with one click
cc-do
// Use when implementing planned tasks, resuming interrupted work, applying a frozen investigation handoff, or landing review feedback after cc-plan or cc-investigate.
// Use when implementing planned tasks, resuming interrupted work, applying a frozen investigation handoff, or landing review feedback after cc-plan or cc-investigate.
| name | cc-do |
| version | 1.6.2 |
| description | Use when implementing planned tasks, resuming interrupted work, applying a frozen investigation handoff, or landing review feedback after cc-plan or cc-investigate. |
| triggers | ["开始做 T003","继续上次做到一半的任务","按 planning/tasks.md 开始实现","修这个 review comment","implement this task","resume this requirement","repair this investigated bug"] |
| reads | ["PLAYBOOK.md","CHANGELOG.md","references/execution-recovery.md","references/parallel-dispatch.md"] |
| writes | [{"path":"devflow/changes/<change-key>/execution/tasks/<task-id>/checkpoint.json","durability":"durable","required":true},{"path":"devflow/changes/<change-key>/execution/tasks/<task-id>/events.jsonl","durability":"durable","required":false,"when":"debug mode is enabled or the task execution fails"},{"path":"devflow/changes/<change-key>/execution/team-state.json","durability":"durable","required":false,"when":"execution mode uses delegated or team workers"},{"path":"devflow/changes/<change-key>/meta/change-state.json","durability":"durable","required":false,"when":"pause, resume, dispatch, or quick-lane state changes"}] |
| effects | ["code changes","test changes","workspace scratch runtime updates"] |
| entry_gate | ["Read planning/design.md or planning/analysis.md, then planning/tasks.md, planning/task-manifest.json, change-meta.json, related capability specs, and the latest checkpoint before changing code.","Select only ready tasks whose dependencies, wave, touched paths, and file ownership are clear.","Reject parallel execution when touched paths overlap by exact path or parent/child path; submodule touches must be isolated unless the task explicitly owns that submodule.","If the current task cannot be restated from canonical artifacts, run a context reset before coding.","Validate the current task's TDD shape before coding: spec-style test name, one logical behavior, public verification path, allowed boundary mocks, Green minimality guard, and refactor candidates."] |
| exit_criteria | ["The current task has red/green evidence, public-seam test quality evidence, review evidence, and a resumable checkpoint trail.","Red evidence proves one observable behavior through a public verification path; Green evidence shows only the minimal production change; Refactor evidence names the concrete smell removed or says why none was needed.","Execution leaves the next verifier enough runtime truth to judge the task without chat memory.","The honest next step is cc-check or an explicit reroute."] |
| reroutes | [{"when":"Three failed repair attempts or new evidence show the investigation contract is wrong.","target":"cc-investigate"},{"when":"New evidence shows the requirement design or scope contract is wrong.","target":"cc-plan"},{"when":"Implementation and reviews are complete for the current task set.","target":"cc-check"}] |
| recovery_modes | [{"name":"resume-from-checkpoint","when":"Work was interrupted but the current design contract is still valid.","action":"Reload the latest checkpoint, rebuild task context, and continue from the last confirmed red/green/review milestone."},{"name":"context-reset","when":"The conversation history is noisy, stale, or cannot reproduce the exact task state.","action":"Discard chat memory, reread planning/design.md or planning/analysis.md plus planning/tasks.md/planning/task-manifest.json and the latest checkpoint, then restate the next action before coding."}] |
| tool_budget | {"read_files":9,"search_steps":6,"shell_commands":8} |
[PROTOCOL]: 变更时同步更新
version、CHANGELOG.md、相关模板/脚本引用,然后检查CLAUDE.md
cc-do 是 PDCA 里的 Do。
同时它也是 IDCA / DDCA 里的 Do。
它只做一件事:沿着已经冻结的任务,把代码真正做出来,并把执行证据留到足够让别人接手、复盘、复验。
写入任何 durable Markdown 或 JSON metadata 前,先运行 cc-devflow config resolve --format policy。
Output language 是机器约束,checkpoint、events、team-state 中新增的人类可读摘要必须记录并遵守它。agent_preferences 是用户偏好建议,只影响表达方式和结构选择,不覆盖本 Skill 的工作流边界。上游冻结合同可以来自两条路:
cc-plan 产出的 planning/design.mdcc-investigate 产出的 planning/analysis.mdPLAYBOOK.mdCHANGELOG.mdreferences/execution-recovery.mdreferences/parallel-dispatch.mdplanning/tasks.md / planning/task-manifest.jsoncc-investigate 里冻结,准备开始修如果方案还没冻结、任务边界还没定,停下并回 cc-plan 或 cc-investigate。
先判断现在是哪一种执行局面,再开始编码:
| 现实状态 | 先走什么路径 |
|---|---|
| 已有 ready task,直接实现 | implement |
| 上次做到一半,需要继续 | resume |
| bug 根因已冻结 | repair-from-investigation |
| bug 还没搞清根因 | reroute 到 cc-investigate |
| 收到 review comment,要在既定范围内修正 | review-fix |
如果连“当前 task 是什么”都说不清,先别写代码,先跑 scripts/select-ready-tasks.sh 和 scripts/build-task-context.sh。
cc-investigate; if scope or design truth breaks, go back to cc-plan; after task closure, hand off to cc-check.NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
cc-do 默认采用测试先行的执行纪律:
checkpoint.json,必要时写入 events.jsonl。Red 不是形式上的红,而是公共 seam 上的行为缺失证明。测试必须通过公共接口、调用方流程、CLI/API/UI 路径或其它真实边界进入系统;只验证私有函数、内部调用次数、临时数据结构或 mock 自己控制的内部协作者,不算 TDD 证据。
一个 Red 只证明一个逻辑行为。测试名要像规格说明,而不是实现步骤;结果要从同一类公共入口读回。直接查数据库、读内部状态、扫描临时文件或绕过 API 来证明行为,只在那个边界本身就是被测对象时成立。
例外只能用于 throwaway prototype、纯生成文件、纯配置改动;例外必须写进 checkpoint 的 tddException,包含原因、风险和替代验证命令。测试第一次就绿,说明测试没有证明新行为,必须修测试而不是继续写生产代码。
禁止水平切片:不要先写一批测试,再写一批实现。每次只推进一个 tracer bullet:一个可观察行为的 Red -> 让它变绿的最小实现 -> 必要重构 -> 记录证据,然后再进入下一个行为。
测试数据也必须诚实。fixture 只提供当前行为需要的最小输入;partial fixture、类型断言、mock payload 或 generated stub 必须写清哪些字段是真实 contract,哪些只是测试填充。不能用 as、any、双重 cast、缺字段 partial mock 或 test-only method 掩盖 seam 设计问题。
Green 不是顺手把未来行为都做掉。只写当前红灯要求的最小生产代码;如果需要新接口,优先保持小接口深模块,依赖从调用方传入,外部 boundary adapter 拆成具体操作,而不是用一个 generic fetcher 把复杂条件推给 mock。
Refactor 只能发生在 Green 之后。优先处理当前 slice 暴露出的重复、长方法、浅模块、feature envy、primitive obsession、命名混乱、三层以上分支和新代码揭开的旧代码坏味道;没被当前绿色测试保护的扩张性整理,回到 cc-plan 或后续任务。
planning/design.md 或 planning/analysis.md,再读 planning/tasks.md、planning/task-manifest.json;如果是恢复执行,再补读最近 checkpoint 或已有 handoff/resume-index.md。scripts/select-ready-tasks.sh 判断现在到底哪几个任务真的 ready。cc-investigate,必须把 planning/analysis.md 当成 canonical contract,而不是一边实现一边重新调查。scripts/build-task-context.sh 从 planning/design.md 或 planning/analysis.md、planning/tasks.md、planning/task-manifest.json、change-meta.json 与相关 capability spec 组装上下文。task-manifest.json.metadata.lane == "quick",仍然必须有 current task、verification、checkpoint 和 handoff;quick 只缩短文档密度,不跳过证据。.gitmodules 或 manifest 提供 submodulePaths,先用 scripts/detect-file-conflicts.sh 标出 submoduleTouches;只有触达该 submodule 的任务失去默认 worktree 隔离资格,未触达任务不能被无辜串行化。touches 父子路径重叠也算同一执行表面。fail-first:先写失败测试,先看见预期红,再写生产代码。Red -> Green -> Refactor 推进,Green 只允许最小实现,不预铺未来测试尚未要求的分支、状态或 API。tdd.testQuality.fixtureRisk 或先修 seam。events.jsonl + checkpoint.json,并记录 tdd.testQuality、tdd.greenMinimality、tdd.refactorCandidates 或 tddException。spec review,再过 code review,两道门都过才算任务收口;这里只验证 spec delta,不回写长期 spec。cc-check。devflow/changes/<change-key>/execution/tasks/<task-id>/checkpoint.jsondevflow/changes/<change-key>/execution/tasks/<task-id>/events.jsonl(仅 debug / failed 默认保留)planning/task-manifest.json 里的 task review verdictCHANGELOG.mdreferences/execution-recovery.mdreferences/parallel-dispatch.mdscripts/recover-workflow.shscripts/check-task-status.shscripts/select-ready-tasks.shscripts/build-task-context.shscripts/write-task-checkpoint.shscripts/record-review-decision.shscripts/verify-task-gates.shscripts/mark-task-complete.shscripts/detect-file-conflicts.shspec review,再过 code review,顺序不能反。cc-do 里改 capability spec 正文;这里只产出实现证据和 spec 对齐证据。spec review / code review 两道门证据devflow/changes/<change-key>/execution/tasks/<task-id>/cc-check,或明确退回 cc-investigate / cc-planPLAYBOOK.mdCHANGELOG.mdreferences/execution-recovery.mdreferences/parallel-dispatch.md[HINT] Download the complete skill directory including SKILL.md and all related files