plan-orchestrate
affaan-m/ECC
读取计划文档,将其分解为各个步骤,从 ECC 目录中设计每个步骤对应的代理链,并生成可直接粘贴或进行编排的自定义提示,而无需实际执行这些提示。
...展开全部计划 编排
通过为每个步骤生成一条可直接粘贴的调用指令,将计划文档与/orchestrate custom 功能对接。该技能仅提供生成功能——它绝不会执行/orchestrate 命令。用户可在准备就绪时逐行粘贴。
何时启用
- 用户拥有一个多步骤计划文档(PRD、RFC、实施方案),并希望将其通过
/orchestrate进行处理。 - 用户说“协调此计划”、“为每个步骤提供协调提示”、“为此计划构建链”。
- 已有分步计划,但用户不想为每个步骤手动选择代理。
在以下情况下跳过:
- 工作仅包含一个临时步骤 → 请直接调用
/orchestrate custom。 - 计划不可读或为空。仅缺少明确的编号并不构成跳过条件——请参阅下文的“无明确步骤”边界情况。
输入
[--lang=python|typescript|go|rust|cpp|java|kotlin|flutter|auto] [--scope=all|step:|range:-] [--dry-run]
— 必填;支持相对或绝对路径(接受@docs/...格式)。--lang— 代码审查语言变体;默认值为auto(从项目中检测)。--scope— 限制生成的步骤;默认为all。--dry-run— 仅打印分解 + 链式推理依据;不输出最终提示。
权威的/orchestrate格式(请勿偏离)
{ORCH_CMD} custom ",,...," ""
其中{ORCH_CMD}在第 0 阶段确定(见下文)。发出的输出中的命令字符串始终采用一种具体形式——绝不同时使用两种形式,也绝不使用占位符。
custom是一个顺序链;每个代理的 HANDOFF 会传递给下一个。- 以逗号分隔的代理列表。建议不使用空格;允许出现一个空格。
- 不存在
--mode/--gate/--agents=...这些标志——切勿自行添加。 - 代理名称取自该技能的目录。任务描述中嵌入的双引号将转义为
\"。
ECC 安装形式与命名空间
两种安装形式决定了斜杠命令及每个代理名称的前缀。这两种形式必须保持同步——每种输出对应一种形式,切勿混用:
设 表示 Claude Code 的主目录:macOS/Linux 系统下为~/.claude,Windows 系统下为%USERPROFILE%\.claude。请按照主机平台解析用户主目录的方式进行解析(切勿硬编码~)。
| 形式 | 检测 | {ORCH_CMD} |
代理名称格式 |
|---|---|---|---|
| 插件安装(1.9.0+) | /plugins/marketplaces/everything-claude-code/ |
/everything-claude-code:orchestrate |
everything-claude-code: |
| 旧版精简安装 | 上述路径不存在;代理文件位于之下 |
/orchestrate |
|
为何这很重要:在插件安装模式下,代理会注册为everything-claude-code:tdd-guide。仅使用名称会导致模糊匹配,而在并行调用时会间歇性地失败。在传统模式下,带前缀的形式不会被注册,因此会直接失败。
可用代理目录(必须从以下选项中选择)
通用:
规划器— 需求重述、风险分解、步骤规划architect— 架构、系统设计、重构建议tdd-guide— 编写测试 → 实现 → 80%+ 代码覆盖率代码审查员— 通用代码审查安全审查员— 安全审计、OWASP、机密泄露重构清理员— 死代码、重复代码、knip类清理文档更新员— 文档、代码映射、READMEdocs-lookup— 第三方库 API 查询(Context7)e2e-runner— 端到端测试编排database-reviewer— PostgreSQL 模式、迁移、性能harness-optimizer— 本地代理测试框架配置loop-operator— 长期运行的自主循环chief-of-staff— 多渠道分流(很少适用于计划步骤)
构建错误解决器:
build-error-resolver(通用) /cpp-build-resolver/go-build-resolver/java-build-resolver/kotlin-build-resolver/rust-build-resolver/pytorch-build-resolver
代码审查工具:
python-reviewer/typescript-reviewer/go-reviewer/rust-reviewer/cpp-reviewer/java-reviewer/kotlin-reviewer/flutter-reviewer
代理名称拼写错误会导致/orchestrate 失败。在发送之前请与本列表进行交叉核对。
工作原理
第 0 阶段 — 检测 ECC 模式 + 编程语言
读取
。若缺失或为空,则报告并终止。检测一次 ECC 安装形式,并将其固定为
ECC_MODE。算法(按顺序执行,首次匹配即停止):- 如果存在
→/plugins/marketplaces/everything-claude-code/ ECC_MODE=plugin。 - 否则,如果
存在且包含至少一个 ECC 代理文件(例如/agents/ tdd-guide.md、code-reviewer.md)→ECC_MODE=legacy。 - 否则 → 默认设置为
ECC_MODE=legacy,并在输出顶部显示一行警告:> 警告:无法检测到 ECC 安装;默认采用旧版形式。如果您使用插件安装,请手动编辑前缀。 - 如果两种标记都存在(混合安装),则以
插件设置为准——只有插件命名空间会在解析代理名称时不进行模糊匹配。
从这一刻起,每行输出中,斜杠命令和所有代理名称均使用匹配的前缀。同一输出中绝不会同时出现两种形式。
- 如果存在
解析
--lang。当设置为auto时,执行支持多语言的检测:- 检测标记:
pyproject.toml/uv.lock/requirements.txt→ python;package.json→ typescript;go.mod→ go;Cargo.toml→ rust;CMakeLists.txt或顶级*.cpp→ cpp;pom.xml/build.gradle(Java)→ java;build.gradle.kts或顶级 Kotlin → kotlin;pubspec.yaml→ flutter。 - 多语言平局处理:如果有多个标记匹配,则选择源文件数量最多的语言(通过
git ls-files统计,排除vendor/、node_modules/、dist/、build/、.venv/、生成的文件以及明显的测试 fixture)。 若出现平局,或没有一种语言的源文件占比超过 60%,则将lang设为unknown。 - 无标记匹配 → 设置
lang=unknown。 lang=unknown是一个哨兵值——它不是代理名称。在第二阶段的规则 4 和 5 中,它会在构建链组合时被转换为代码审查者/构建错误解决者。
- 检测标记:
检测PyTorch 子配置文件:当
lang=python且pyproject.toml/requirements.txt/uv.lock中的任意文件声明了对torch的依赖时,将pytorch 设为 true。这仅影响构建链的选择(见下文第二阶段规则);代码审查者仍保持为python-reviewer。规范化计划中声明的任何代理名称:如果计划文本以带有插件前缀的形式引用代理(例如
everything-claude-code:tdd-guide),则在验证或组合链之前,去除前缀以获取原始目录名称。 根据ECC_MODE(第 4 阶段),仅在输出时才会重新添加前缀。切勿让已添加前缀的名称流入链组合过程——这会在插件模式下导致前缀重复。
第 1 阶段 — 分解步骤
按优先级顺序识别“步骤单元”:
- 显式编号:
## 第 N 步/### 第 N 阶段/## N. .../ 顶级有序列表。 - 表格中的“步骤”列。
- ----以动词开头的标题
分隔的块。 - 否则将每个H2视为一个步骤。
针对每个步骤提取ID(从1开始)、标题(≤80个字符)、意图(1–3句话)和标签。
第 2 阶段 — 标签与链式筛选
按意图进行标注(允许多标签;标签链由主标签 + 堆叠的次级标签构成):
以下触发词匹配不区分大小写。多语言方案通过匹配任何语言的词干来支持,只要其含义与列出的英文触发词一致即可。
| 标签 | 触发词 | 默认链 |
|---|---|---|
设计 |
建筑, 设计, 选择, 评估, RFC | 规划师、架构师 |
计划 |
计划、分解、里程碑 | 规划师 |
impl |
实现、构建、添加、创建、移植 | TDD指南, |
测试 |
测试、覆盖率、端到端、集成 | tdd-guide,e2e-runner |
重构 |
重构、清理、去重、拆分 | 架构师、重构清理工具、 |
迁移 |
迁移、升级、重写、移植 | 架构师、TDD指南、 |
数据库 |
模式、迁移、索引、SQL、Postgres、alembic、sqlmodel | 数据库审查员, |
安全 |
加密、身份验证、密钥、OWASP、PII | 安全审查员, |
构建 |
构建、编译、代码检查失败、持续集成 | (回退到构建错误解析器) |
文档 |
文档、读我文件、代码映射、变更日志 | 文档更新器 |
查找 |
lookup、参考、API 使用说明 | 文档查询 |
review |
审查、审计、验证 | |
循环 |
循环、自主、看门狗 | 循环运算符 |
链式组合规则:
- 主标签选择:当某一步匹配多个标签时,按表中顺序排在最前面的那个(表首 = 最高优先级)为主标签;其余为次要标签。下文的组合规则 2 和 3 明确处理特定的多标签组合;否则,按标签表中的顺序追加次要链。
impl+security→tdd-guide,.-reviewer,security-reviewer impl+db→tdd-guide,database-reviewer,。-reviewer - 对生成的链进行去重(保留首次出现的结果)。例如
,review+lang=unknown根据规则 5 会生成code-reviewer,code-reviewer;去重后将其合并为code-reviewer。 当 lang=unknown时,-reviewer解析为code-reviewer。当 lang=unknown时,-build-resolver解析为build-error-resolver。特殊情况:如果第 0 阶段设置了pytorch=true,则无论。不存在python-build-resolver;当--lang=python且pytorch=true未设置时,将解析为build-error-resolver。- 零标签步骤:如果没有触发词匹配,则将链设置为
code-reviewer并写入“未匹配任何标签”;在“链理由”下默认使用仅审查链。 - 去重后链长度 ≤ 4。若超出,则舍弃最弱的标签(优先
舍弃“lookup”和“docs”)。 - 不要在
实现链中将规划师和架构师配对(浪费令牌)。仅在设计步骤中将它们配对。 - 标记为
impl、refactor或migration的步骤以reviewer 类代理结尾——即、-reviewer code-reviewer、security-reviewer或database-reviewer中的任意一个。 最符合领域特性的审阅者将占据末尾位置(例如:规则 2 的impl+security以security-reviewer结束;规则 3 的impl+db以结束,因为-reviewer database-reviewer已在链条更早阶段对 migration 进行了门控)。测试和构建步骤由各自的验证器(分别是e2e-runner和构建解析器)进行门控,无需额外的审核员。
第三阶段 — 压缩任务描述
每个生成的 必须:
- 自成体系(第一个代理无需打开计划文档)。
- 以
[Plan:开头。#step- ] - 包含 1–3 条可验证的验收标准。
- 仅当计划为此步骤声明了范围限制(
范围外:...)时,才包含该限制。应原样继承。如果计划中没有范围外声明,则完全省略该子句——切勿自行添加。 - 长度为 200–600 个字符;仅占一行;转义
字符 "需用\表示;不得包含字面换行符。
第 4 阶段 — 输出
使用由ECC_MODE确定的格式输出 Markdown。 输出应始终采用统一格式——每个{ORCH_CMD}和每个代理名称均应使用第 0 阶段对应的前缀进行渲染。请勿同时输出两种形式;请勿在渲染后的输出中包含“这是插件形式”或“去除前缀”等说明。
具体渲染规则:
{ORCH_CMD}=插件模式下为/everything-claude-code:orchestrate,旧版模式下为/orchestrate。{AGENT(name)}= 在插件模式下为everything-claude-code:,在旧版中。- 概览表中的“Chain”列采用相同的
{AGENT(name)}渲染方式。 - 每步的 bash 代码块仅包含可执行的命令。不包含
# plugin 形式或# legacy 形式的注释——该形式是隐含的,并在整个输出中保持统一。
输出结构:
#Plan-Orchestrate 结果
**计划**:``
**语言**:``
**ECC 模式**:``
**步骤**:
**范围**:
## 步骤概览
| # | 标题 | 标签 | 链 |
|---|---|---|---|
| 1 | ... | 实现, 数据库 | `{AGENT(tdd-guide)},{AGENT(database-reviewer)},{AGENT(python-reviewer)}` |
| ... | | | |
---
## 步骤 1 —
**意图**:<1–3 sentences>
**标签**:
**链条依据**:
```bash
{ORCH_CMD} custom "{AGENT(tdd-guide)},{AGENT(database-reviewer)},{AGENT(python-reviewer)}" "[计划: docs/foo.md#step-1]; 验收:<1–3 items>; 超出范围:<…>"
```
上文中的
{ORCH_CMD}和{AGENT(...)}表示法描述了该技能在运行时执行的替换操作。实际输出的 Markdown 内容包含已解析的字符串,绝不会包含占位符。
在末尾追加一个“批量执行”块,按顺序汇总每个步骤的命令,以便用户可以一次性粘贴所有命令。在仅显示概览的模式下跳过该批量块(参见“大型计划”边界情况):当仅输出概览表时,没有需要汇总的逐步命令。
第 5 阶段 — 自检(在输出前运行)
- 每个链中的每个代理均来自目录(在计划中移除任何以
everything-claude-code:开头的前缀后;参见第 0 阶段第 5 步)。 - 已解析的
{ORCH_CMD}以及每个已解析的{AGENT(...)}均采用相同的形式(插件或传统形式)——绝不会在同一输出中混用。 - 渲染后的输出中不再包含任何
# 插件形式/# 传统形式注释,也不再有“去除前缀”的指令。 - 不存在虚构的
--mode/--gate/--agents=...字段。 - 每个任务描述均为单行,用双引号引起来,其中的
"已转义。 - 每个任务描述以
[Plan:开头,并包括验收条件(1–3 项)。只有从计划中继承时,才会出现#step- ] “Out of scope:”子句。 - 在第 2 阶段去重后,任何链中均不存在重复的代理。
- 链长度 ≤ 4。
- 标记为
impl/refactor/migration的步骤以评审员类代理(、-reviewer code-reviewer、security-reviewer或database-reviewer)结尾。test和build除外——参见第二阶段规则 10。 - 无标签的步骤会发出
“code-reviewer”,理由为“无匹配标签”;默认采用仅审查链。 - 概述表列出了计划中的每个步骤,无论
--scope参数如何。 - 每个步骤的详细信息块数量与已确定的
--scope参数相匹配(当--scope=all时为完整计划;step:n时为一个块;range:a-b时为范围大小)。在仅概述模式下,不会生成每个步骤的块,也不会生成“批处理”块。
边界情况
- 无明确步骤:优先采用 H2/H3 拆分;若仍存在歧义,则报告“未检测到结构化步骤”,同时提供文档大纲,并请用户确认是否按大纲运行。
- 大型计划(>1500 行):进入仅概述模式——仅输出概述表,并提示用户使用
--scope缩小范围后再重新运行以获取详细信息。在此模式下,跳过每步的详细信息块和“批处理”执行块。 - 步骤范围过广(例如“完成所有后端工作”):不要强行生成单一链。建议拆分为 N.a 和 N.b,并提出拆分方案。
- 计划声明代理(罕见):首先去除任何
everything-claude-code:前缀以获取原始目录名称(第 0 阶段第 5 步),然后对照目录进行验证。替换无效的代理,并在“链条依据”下进行说明。输出时将根据ECC_MODE对原始名称重新添加前缀。 - 在
--lang=auto无法确定优选方案的多语言项目中:将lang设为unknown;将 reviewer 解析为code-reviewer,并将 build resolver 解析为build-error-resolver。在“链条依据”部分提及该备选方案。
示例
示例 1 — 插件模式,Python 方案
输入:
plan-orchestrate @docs/plan/example-feature.md --lang=python
预期输出摘录:
## 第 2 步 — 加密敏感的 UserProfile 字段
**目标**:引入一个 `EncryptedString` SQLAlchemy 类型,并在持久化前使用 AES-GCM 对 `birth_datetime` / `location` 进行加密;从环境变量中加载密钥。
**标签**:实现, 安全, 数据库
**审查链依据**:由于涉及安全敏感的写入路径,因此由 `security-reviewer` 负责关闭审查链;`database-reviewer` 负责验证 Alembic 迁移;`python-reviewer` 负责检查类型和 PEP 8 规范。
```bash
/everything-claude-code:orchestrate custom "everything-claude-code:tdd-guide,everything-claude-code:database-reviewer,everything-claude-code:python-reviewer,everything-claude-code:security-reviewer" “[计划:docs/plan/example-feature.md#step-2] 实现 EncryptedString SQLAlchemy 类型,并迁移 UserProfile.birth_datetime/location 列;密钥来自环境变量 APP_DB_KEY; 验收标准:加密/解密往返测试通过;在空数据库上,Alembic 的升级/降级操作无异常;迁移后数据库中无明文;范围外:跨租户个人资料共享逻辑"
```
示例 2 — 传统模式,相同步骤
若检测到ECC_MODE=legacy,则会将该步骤作为单条统一命令输出(输出中任何位置均不包含以插件前缀开头的形式):
/orchestrate custom "tdd-guide,database-reviewer,python-reviewer,security-reviewer" "[Plan: docs/plan/example-feature.md#step-2] ..."
上述两个示例展示了两种不同环境下的两种可能输出。单次技能调用仅会生成其中一种,且为端到端输出。
注意事项
- 仅限生成模式。切勿在此技能内部调用
/orchestrate。 - 任务描述应与计划文档的语言保持一致(代理名称始终保持为英文)。
- 除非用户明确要求,否则请勿在输出中插入“Co-Authored-By”行或表情符号。
---
name: plan-orchestrate
description: Reads a plan document, decomposes it into steps, designs a per-step agent chain from the ECC catalogue, and emits ready-to-paste /orchestrate custom prompts without executing them.
---
# Plan Orchestrate
Bridge a plan document to `/orchestrate custom` by emitting one ready-to-paste invocation per step. The skill is generative only — it never executes `/orchestrate`. The user pastes each line when ready.
## When to Activate
- User has a multi-step plan document (PRD, RFC, implementation plan) and wants to drive it through `/orchestrate`.
- User says "orchestrate this plan", "give me orchestrate prompts for each step", "compose chains for this plan".
- A step-by-step plan exists but the user does not want to manually pick agents per step.
Skip when:
- The work is one ad-hoc step → call `/orchestrate custom` directly.
- The plan is unreadable or empty. Lack of explicit numbering alone is not a skip condition — see the "No clear steps" edge case below.
## Inputs
```
<plan-doc-path> [--lang=python|typescript|go|rust|cpp|java|kotlin|flutter|auto] [--scope=all|step:<n>|range:<a>-<b>] [--dry-run]
```
- `<plan-doc-path>` — required; relative or absolute path (`@docs/...` accepted).
- `--lang` — reviewer language variant; defaults to `auto` (detected from project).
- `--scope` — limits emitted steps; defaults to `all`.
- `--dry-run` — print decomposition + chain rationale only; do not emit final prompts.
## Authoritative `/orchestrate` shape (do not deviate)
```
{ORCH_CMD} custom "<agent1>,<agent2>,...,<agentN>" "<task description>"
```
Where `{ORCH_CMD}` is determined in Phase 0 (see below). The command string in the emitted output **always uses one concrete form** — never both, never a placeholder.
- `custom` is a sequential chain; each agent's HANDOFF feeds the next.
- Comma-separated agent list. No spaces preferred; one space tolerated.
- No `--mode` / `--gate` / `--agents=...` flags exist — never invent them.
- Agent names come from the catalogue in this skill. Embedded double quotes in the task description are escaped as `\"`.
## ECC install form and namespacing
Two install forms determine the prefix on **both** the slash command and every agent name. The two MUST stay in sync — one form per output, never mixed:
Let `<claude-home>` denote the Claude Code home directory: `~/.claude` on macOS/Linux, `%USERPROFILE%\.claude` on Windows. Resolve it the way the host platform resolves the user home directory (do not hardcode `~`).
| Form | Detection | `{ORCH_CMD}` | Agent name format |
|---|---|---|---|
| Plugin install (1.9.0+) | `<claude-home>/plugins/marketplaces/everything-claude-code/` exists | `/everything-claude-code:orchestrate` | `everything-claude-code:<name>` |
| Legacy bare install | Above absent; agent files under `<claude-home>/agents/` | `/orchestrate` | `<name>` |
Why this matters: under the plugin install, agents register as `everything-claude-code:tdd-guide`. Bare names force fuzzy matching, which fails intermittently under parallel calls. Under legacy, the prefixed forms are not registered and fail outright.
## Available agent catalogue (must pick from these)
General:
- `planner` — requirement restatement, risk decomposition, step planning
- `architect` — architecture, system design, refactor proposals
- `tdd-guide` — write tests → implement → 80%+ coverage
- `code-reviewer` — generic code review
- `security-reviewer` — security audit, OWASP, secret leakage
- `refactor-cleaner` — dead code, duplicates, knip-class cleanup
- `doc-updater` — documentation, codemap, README
- `docs-lookup` — third-party library API lookups (Context7)
- `e2e-runner` — end-to-end test orchestration
- `database-reviewer` — PostgreSQL schema, migration, performance
- `harness-optimizer` — local agent harness configuration
- `loop-operator` — long-running autonomous loops
- `chief-of-staff` — multi-channel triage (rarely a fit for plan steps)
Build error resolvers:
- `build-error-resolver` (generic) / `cpp-build-resolver` / `go-build-resolver` / `java-build-resolver` / `kotlin-build-resolver` / `rust-build-resolver` / `pytorch-build-resolver`
Code reviewers:
- `python-reviewer` / `typescript-reviewer` / `go-reviewer` / `rust-reviewer` / `cpp-reviewer` / `java-reviewer` / `kotlin-reviewer` / `flutter-reviewer`
A misspelled agent name fails `/orchestrate`. Cross-check against this list before emitting.
## How It Works
### Phase 0 — Detect ECC mode + language
1. Read `<plan-doc-path>`. If missing or empty, report and stop.
2. Detect ECC install form once and freeze it into `ECC_MODE`. Algorithm (run in order, stop at the first match):
1. If `<claude-home>/plugins/marketplaces/everything-claude-code/` exists → `ECC_MODE=plugin`.
2. Else if `<claude-home>/agents/` exists and contains at least one ECC agent file (e.g. `tdd-guide.md`, `code-reviewer.md`) → `ECC_MODE=legacy`.
3. Else → default to `ECC_MODE=legacy` and emit a one-line warning at the top of the output: `> Warning: could not detect ECC install; defaulting to legacy form. If you use the plugin install, edit the prefixes manually.`
4. If both markers exist (mixed install), `plugin` wins — the plugin namespace is the only one that resolves agent names without fuzzy matching.
From this point on, every emitted line uses the matching prefix on **both** the slash command and every agent name. **Never emit both forms in the same output.**
3. Resolve `--lang`. When `auto`, run a polyglot-aware detection:
- Probe markers: `pyproject.toml` / `uv.lock` / `requirements.txt` → python; `package.json` → typescript; `go.mod` → go; `Cargo.toml` → rust; `CMakeLists.txt` or top-level `*.cpp` → cpp; `pom.xml` / `build.gradle` (Java) → java; `build.gradle.kts` or top-level Kotlin → kotlin; `pubspec.yaml` → flutter.
- **Polyglot tie-break**: if more than one marker matches, pick the language whose source files outnumber the others (count via `git ls-files`, excluding `vendor/`, `node_modules/`, `dist/`, `build/`, `.venv/`, generated files, and obvious test fixtures). On a tie or when no language exceeds 60% of source files, set `lang=unknown`.
- No marker matched → set `lang=unknown`.
- `lang=unknown` is a sentinel — it is **not** an agent name. Phase 2 rules 4 and 5 turn it into `code-reviewer` / `build-error-resolver` at chain composition time.
4. Detect a **PyTorch sub-profile**: when `lang=python` and any of `pyproject.toml` / `requirements.txt` / `uv.lock` declares a dependency on `torch`, set `pytorch=true`. This only affects `build` chain selection (Phase 2 rule below); the reviewer remains `python-reviewer`.
5. **Normalize any agent names declared in the plan**: if the plan text references agents by their plugin-prefixed form (e.g. `everything-claude-code:tdd-guide`), strip the prefix to get the bare catalogue name before validating or composing chains. Re-prefixing happens only at output time per `ECC_MODE` (Phase 4). Never let a pre-prefixed name flow into chain composition — it would double-prefix in plugin mode.
### Phase 1 — Decompose steps
Identify "step units" in priority order:
1. Explicit numbering: `## Step N` / `### Phase N` / `## N. ...` / top-level ordered list.
2. A "Step" column in a table.
3. `---`-separated blocks with verb-led headings.
4. Otherwise treat each H2 as one step.
Per step extract `id` (1-based), `title` (≤ 80 chars), `intent` (1–3 sentences), `tags`.
### Phase 2 — Tag and pick chain
Tag by intent (multi-tag allowed; chain built from primary + stacked secondaries):
Trigger words below are matched case-insensitively. Multilingual plans are supported by matching the word stems in any language as long as the meaning aligns with the listed English trigger words.
| Tag | Trigger words | Default chain |
|---|---|---|
| `design` | architecture, design, choose, evaluate, RFC | `planner,architect` |
| `plan` | plan, breakdown, milestone | `planner` |
| `impl` | implement, build, add, create, port | `tdd-guide,<lang>-reviewer` |
| `test` | test, coverage, e2e, integration | `tdd-guide,e2e-runner` |
| `refactor` | refactor, cleanup, dedupe, split | `architect,refactor-cleaner,<lang>-reviewer` |
| `migration` | migrate, upgrade, rewrite, port | `architect,tdd-guide,<lang>-reviewer` |
| `db` | schema, migration, index, SQL, Postgres, alembic, sqlmodel | `database-reviewer,<lang>-reviewer` |
| `security` | encrypt, auth, secret, OWASP, PII | `security-reviewer,<lang>-reviewer` |
| `build` | build, compile, lint failure, CI | `<lang>-build-resolver` (falls back to `build-error-resolver`) |
| `docs` | docs, readme, codemap, changelog | `doc-updater` |
| `lookup` | lookup, reference, API usage | `docs-lookup` |
| `review` | review, audit, verify | `<lang>-reviewer,code-reviewer` |
| `loop` | loop, autonomous, watchdog | `loop-operator` |
Chain composition rules:
1. **Primary tag selection**: when a step matches multiple tags, the **first one in table order** (top of the table = highest priority) is the primary; the rest are secondaries. Composition rules 2 and 3 below handle specific multi-tag combinations explicitly; otherwise, append secondary chains in tag table order.
2. `impl` + `security` → `tdd-guide,<lang>-reviewer,security-reviewer`.
3. `impl` + `db` → `tdd-guide,database-reviewer,<lang>-reviewer`.
4. **Deduplicate** the resulting chain (preserve first occurrence). E.g. `review` + `lang=unknown` would yield `code-reviewer,code-reviewer` after rule 5; deduplication collapses it to `code-reviewer`.
5. `<lang>-reviewer` resolves to `code-reviewer` when `lang=unknown`.
6. `<lang>-build-resolver` resolves to `build-error-resolver` when `lang=unknown`. **Special case**: if Phase 0 set `pytorch=true`, use `pytorch-build-resolver` for `build` chains regardless of `<lang>`. There is no `python-build-resolver`; `--lang=python` without `pytorch=true` resolves to `build-error-resolver`.
7. **Zero-tag steps**: if no trigger word matches, set chain to `code-reviewer` and write `no tag matched; default review-only chain` under "Chain rationale".
8. Chain length ≤ 4 after deduplication. If exceeded, drop weakest tag (`lookup` and `docs` first).
9. Do not pair `planner` and `architect` in an `impl` chain (token waste). Pair them only on `design` steps.
10. Steps tagged `impl`, `refactor`, or `migration` end with a **reviewer-class** agent — any of `<lang>-reviewer`, `code-reviewer`, `security-reviewer`, or `database-reviewer`. The most domain-specific reviewer wins the tail position (e.g. rule 2's `impl+security` ends with `security-reviewer`; rule 3's `impl+db` ends with `<lang>-reviewer` because `database-reviewer` already gates the migration earlier in the chain). `test` and `build` steps are gated by their own validators (`e2e-runner` and the build resolver respectively) and do not require an additional reviewer.
### Phase 3 — Compress task description
Each emitted `<task description>` must:
- Be self-contained (the first agent does not need the plan document open).
- Start with `[Plan: <path>#step-<id>]`.
- Include 1–3 verifiable Acceptance criteria.
- Include a Scope guard (`Out of scope: ...`) **only if the plan declares one for this step**. Inherit verbatim. If the plan has no out-of-scope statement, omit the clause entirely — do not invent one.
- Be 200–600 characters; one line; embedded `"` escaped as `\"`; no literal newlines.
### Phase 4 — Output
Emit Markdown using **the form determined by `ECC_MODE`**. The output uses one form throughout — every `{ORCH_CMD}` and every agent name is rendered with the matching prefix from Phase 0. **Do not emit both forms; do not include "this is plugin form" / "strip the prefix" instructions in the rendered output.**
Concrete rendering rules:
- `{ORCH_CMD}` = `/everything-claude-code:orchestrate` under `plugin`, `/orchestrate` under `legacy`.
- `{AGENT(name)}` = `everything-claude-code:<name>` under `plugin`, `<name>` under `legacy`.
- The overview-table "Chain" column uses the same `{AGENT(name)}` rendering.
- Per-step bash blocks contain only the runnable command. **No `# plugin form` or `# legacy form` comments** — the form is implicit and uniform across the whole output.
Output structure:
````markdown
# Plan-Orchestrate Result
**Plan**: `<path>`
**Lang**: `<detected-or-given>`
**ECC mode**: `<plugin | legacy>`
**Steps**: <N>
**Scope**: <all | step:n | range:a-b>
## Steps overview
| # | Title | Tags | Chain |
|---|---|---|---|
| 1 | ... | impl, db | `{AGENT(tdd-guide)},{AGENT(database-reviewer)},{AGENT(python-reviewer)}` |
| ... | | | |
---
## Step 1 — <title>
**Intent**: <1–3 sentences>
**Tags**: <a, b>
**Chain rationale**: <why this chain; which agent closes the loop>
```bash
{ORCH_CMD} custom "{AGENT(tdd-guide)},{AGENT(database-reviewer)},{AGENT(python-reviewer)}" "[Plan: docs/foo.md#step-1] <compressed task description>; Acceptance: <1–3 items>; Out of scope: <…>"
```
````
> The `{ORCH_CMD}` and `{AGENT(...)}` notation above describes the substitution this skill performs at runtime. The actual emitted Markdown contains the resolved strings, never the placeholders.
Append a final "Batch execution" block aggregating every step's command in order so the user can paste them all at once. **Skip the Batch block in overview-only mode** (see "Large plan" edge case): when only the overview table is being emitted, there are no per-step commands to aggregate.
### Phase 5 — Self-check (run before emitting)
- [ ] Every agent in every chain comes from the catalogue (after stripping any `everything-claude-code:` prefix that appeared in the plan; see Phase 0 step 5).
- [ ] Resolved `{ORCH_CMD}` and every resolved `{AGENT(...)}` use the **same** form (`plugin` or `legacy`) — never mixed in one output.
- [ ] No `# plugin form` / `# legacy form` annotations and no "strip the prefix" instructions remain in the rendered output.
- [ ] No invented `--mode` / `--gate` / `--agents=...` fields.
- [ ] Each task description is single-line, double-quoted, with embedded `"` escaped.
- [ ] Each task description begins with `[Plan: <path>#step-<id>]` and includes Acceptance (1–3 items). The `Out of scope:` clause is present only when inherited from the plan.
- [ ] No duplicate agent in any chain after Phase 2 dedup.
- [ ] Chain length ≤ 4.
- [ ] Steps tagged `impl`/`refactor`/`migration` end with a reviewer-class agent (`<lang>-reviewer`, `code-reviewer`, `security-reviewer`, or `database-reviewer`). `test` and `build` are exempt — see Phase 2 rule 10.
- [ ] Zero-tag steps emit `code-reviewer` with the rationale `no tag matched; default review-only chain`.
- [ ] Overview table lists every step in the plan, regardless of `--scope`.
- [ ] Per-step detail block count matches the resolved `--scope` (full plan when `--scope=all`; one block for `step:n`; range size for `range:a-b`). In overview-only mode, no per-step blocks and no Batch block are emitted.
## Edge cases
- **No clear steps**: prefer H2/H3 splitting; if still ambiguous, report "no structured steps detected" with the document outline and ask the user to confirm running by outline.
- **Large plan (>1500 lines)**: enter **overview-only mode** — emit only the overview table and ask the user to narrow with `--scope` before re-running for details. In this mode, skip per-step detail blocks and skip the Batch execution block.
- **Step too broad** (e.g. "complete all backend work"): do not force a single chain. Suggest splitting into N.a and N.b and propose a split.
- **Plan declares agents** (rare): first **strip any `everything-claude-code:` prefix** to get the bare catalogue name (Phase 0 step 5), then validate against the catalogue. Replace invalid agents and explain under "Chain rationale". The bare name is re-prefixed at output time per `ECC_MODE`.
- **Polyglot project where `--lang=auto` cannot pick a winner**: set `lang=unknown`; reviewer resolves to `code-reviewer` and build resolver to `build-error-resolver`. Mention the fallback under "Chain rationale".
## Examples
### Example 1 — Plugin mode, Python plan
Input:
```
plan-orchestrate @docs/plan/example-feature.md --lang=python
```
Excerpt of expected output:
````markdown
## Step 2 — Encrypt sensitive UserProfile fields
**Intent**: Introduce an `EncryptedString` SQLAlchemy type and AES-GCM encrypt `birth_datetime` / `location` before persistence; load the key from an environment variable.
**Tags**: impl, security, db
**Chain rationale**: Security-sensitive write path, so `security-reviewer` closes the chain; `database-reviewer` validates the alembic migration; `python-reviewer` covers typing and PEP 8.
```bash
/everything-claude-code:orchestrate custom "everything-claude-code:tdd-guide,everything-claude-code:database-reviewer,everything-claude-code:python-reviewer,everything-claude-code:security-reviewer" "[Plan: docs/plan/example-feature.md#step-2] Implement EncryptedString SQLAlchemy type and migrate UserProfile.birth_datetime/location columns; key from ENV APP_DB_KEY; Acceptance: encrypt/decrypt roundtrip tests pass; alembic upgrade/downgrade clean on empty DB; no plaintext in DB after migrate; Out of scope: cross-tenant profile sharing logic"
```
````
### Example 2 — Legacy mode, same step
If `ECC_MODE=legacy` were detected, the same step would be emitted as a single uniform command (no plugin-prefixed forms anywhere in the output):
```bash
/orchestrate custom "tdd-guide,database-reviewer,python-reviewer,security-reviewer" "[Plan: docs/plan/example-feature.md#step-2] ..."
```
The two examples above illustrate **the two possible outputs** for two different environments. A single skill invocation produces only one of them, end to end.
## Notes
- Generative only. Never invoke `/orchestrate` from inside this skill.
- Match the language of the plan document for task descriptions (agent names always remain English).
- Do not insert "Co-Authored-By" lines or emoji in the output unless the user explicitly asks.
所有文件
1 个文件安装 plan-orchestrate
下载技能文件并将其解压到 .claude/skills/ 目录中。
下载ZIP克隆仓库并复制技能文件到您的项目中。
git clone https://github.com/affaan-m/ECC/tree/main/skills/plan-orchestrate # Copy SKILL.md to your .claude/skills/ directory
复制





首页
