跳转到内容

implement-spec

你已经拿到一份规格。这份规格应该有关联的实现工单,说明如何实现它。

应该已经有人提供了 issue tracker。如果没有,请告诉用户运行 /setup-matt-pocock-skills。

目标是在一个集成分支上完成整份规格,并按照 issue tracker 关闭工作的方式解决每张工单。

工单不是步骤清单,而是一张有阻塞关系的任务图。因此,随时都会有一批可以开始处理的工单。

每个子代理都要从全新的上下文窗口开始。

与子代理的沟通应尽量简洁。主要通过上下文指针传递信息,例如规格、工单、研究笔记和先前的提交。不要重复指针中已经有的信息。

实现子代理应尽可能在后台运行,以最大限度提高并行度。

  1. 阅读规格和工单,了解任务图。

2.(可选)使用一个探索子代理完成工单所需的探索,例如查找相关代码文件或外部文档。确保探索子代理可以保存文件,并把 Markdown 笔记存到仓库之外的目录中,供之后的所有子代理访问。这样实现子代理就能专注于实现,不必再做探索。

  1. 创建集成分支。如果 issue tracker 通过 PR 关闭工作,或者用户要求开 PR,那么在第 5 步第一次合并后开一个草稿 PR,并标记它会关闭规格和工单。

  2. 使用实现子代理实现每张工单,每个子代理都在独立工作树和分支上工作。每个实现子代理都要:

    • 开始前确认自己的工作树基于集成分支;如果不是,就重置到集成分支;
    • 调用 Skill 工具,用 tdd 完成工单;
    • 汇报完成前,把集成分支的最新进度合并到自己的分支。
  3. 实现子代理完成后,使用合并子代理把它的工作合并到集成分支。

  4. 如果这让可处理工单的范围发生变化,就启动更多实现子代理处理新工单,以便尽可能提高并行度。

  5. 所有工单都完成后,在集成分支上调用 Skill 工具,使用 code-review。让一个实现子代理一次性修复代码审查提出的所有问题。

  6. 如果有草稿 PR,就把它标记为准备审查。否则,按照 issue tracker 的方式解决每张工单,并汇报集成分支。

  7. 清理所有实现子代理的工作树。

读者要自己输入 /implement-spec 才会用到它。它在 Claude Code 插件里。

按照规格和工单任务图,在集成分支上协调子代理完成实现、合并与代码审查。

Implement the result of /to-spec and /to-tickets in code.
英文 SKILL.md
---
name: implement-spec
description: "Implement the result of /to-spec and /to-tickets in code."
disable-model-invocation: true
---
You have been provided a spec. This spec should have tickets associated with it, describing how to implement the spec.
The issue tracker should have been provided to you. If not, tell the user to run `/setup-matt-pocock-skills`.
The goal is the entire spec implemented on a single **integration branch**, with every ticket resolved the way the issue tracker closes work.
The tickets are not a list of steps. They are a **task graph** with blocking relationships between them. This means there is always a **frontier** of tickets which are ready to be grabbed.
Start every subagent with a fresh context window.
Communication to and from subagents should be sparse. Communicate primarily through **context pointers**: to the spec, tickets, research notes, and previous commits. Don't duplicate information already available via pointers.
**Implementer subagents** should be run in the background where possible for maximum concurrency.
## Steps
1. Read the spec and tickets to understand the task graph.
2. (optional) Use an **exploration subagent** to conduct any exploration required by the tickets - relevant codebase files or external documentation. Ensure the exploration subagent can save files - it should save its markdown notes in a directory outside the repo, accessible by all future subagents. This lets **implementer subagents** focus on implementation rather than exploration.
3. Create the integration branch. If the issue tracker closes work through PRs, or the user asks for one, open a draft PR after the first merge in step 5 (a branch with no commits ahead of main can't open one), marked as closing the spec and tickets.
4. Use **implementer subagents** to implement each ticket, each in its own worktree on its own branch. Each implementer subagent:
- confirms its worktree is based on the integration branch before starting, and resets onto it if not;
- calls the Skill tool with `tdd` to build the ticket;
- merges the integration branch tip into its own branch before reporting done
5. Once an **implementer subagent** completes, merge its work to the integration branch with a **merger subagent**.
6. If this changes the **frontier** of available tickets, kick off more **implementer subagents** to work on the new tickets. This allows for maximum concurrency.
7. Once all tickets are complete, call the Skill tool with `code-review` on the integration branch. Fix all issues raised by the code review in a single **implementer subagent**.
8. If a draft PR exists, mark it ready for review. Otherwise, resolve each ticket the way the issue tracker closes work, and report the integration branch.
9. Clean up all **implementer subagent** worktrees.

非官方学习站,与 Matt Pocock 和 AI Hero 没有隶属关系。本站不提供可安装的中文技能包。

技能原文采用 MIT 许可。Copyright (c) 2026 Matt Pocock

鲁ICP备2025189036号