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/、生成的檔案以及明顯的測試輔助檔案)。 若出現平手,或沒有任何語言的原始碼檔案佔比超過 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 句)及標籤。
第二階段 — 標籤與鏈選
根據意圖進行標籤標記(允許多標籤;標籤鏈由主要標籤 + 堆疊的次要標籤構成):
以下觸發詞的匹配不區分大小寫。只要語義與列出的英文觸發詞一致,系統便會透過匹配任何語言的詞幹來支援多語言計畫。
| 標籤 | 觸發詞 | 預設鏈 |
|---|---|---|
設計 |
建築、設計、選擇、評估、RFC | 規劃師、建築師 |
計畫 |
計畫、細分、里程碑 | 規劃師 |
實作 |
實作、建置、新增、建立、移植 | TDD 指南、 |
測試 |
測試、覆蓋率、端到端、整合 | tdd-guide, e2e-runner |
重構 |
重構、清理、去重、拆分 | 架構師、重構清理工具、 |
遷移 |
遷移、升級、重寫、移植 | 架構師、TDD 指南、 |
資料庫 |
資料結構、遷移、索引、SQL、Postgres、Alembic、SQLModel | 資料庫審查員、 |
安全性 |
加密、身份驗證、機密資訊、OWASP、個人識別資訊 | 安全審查員、 |
建置 |
建置、編譯、程式碼檢查失敗、持續整合 | (若失敗則回退至build-error-resolver) |
文件 |
文件、讀我檔、程式碼地圖、變更紀錄 | 文件更新器 |
查詢 |
查詢、參考、API 使用說明 | 文件查詢 |
審查 |
審查、稽核、驗證 | |
迴圈 |
迴圈、自主、看門狗 | 迴圈運算子 |
鏈結組合規則:
- 主要標籤選取:當某個步驟符合多個標籤時,依表格順序排在最前面的標籤(表格頂端 = 最高優先級)即為主要標籤;其餘則為次要標籤。下方的組合規則 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`,則無論如何,建置鏈皆使用`pytorch-build-resolver`。不存在python-build-resolver;若未設定pytorch=true且使用--lang=python,則解析為build-error-resolver。- 零標籤步驟:若無觸發詞匹配,則將鏈設定為
code-reviewer並註明「無標籤匹配」;預設在「鏈邏輯依據」下採用僅審查鏈。 - 去重後鏈長 ≤ 4。若超過此限制,則捨棄最弱的標籤(優先捨棄「
查詢」與「文件」)。 - 請勿在
實作鏈中將規劃者與架構師配對(浪費標籤)。僅在設計步驟中將其配對。 - 標記為
impl、refactor或migration的步驟,必須以審查員類別的代理作為結尾——包括、-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)}= 在plugin模式下為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- ] 範圍外:」子句。 - 在第 2 階段去重後,任何鏈中均不得有重複的代理。
- 鏈長 ≤ 4。
- 標記為
impl/refactor/migration 的步驟以審查員類別的代理結尾(、-reviewer code-reviewer、security-reviewer或database-reviewer)。test和build除外 — 請參閱第二階段規則 10。 - 標籤為零的步驟會發出「
code-reviewer」,理由為「無標籤匹配」;預設為僅審查鏈。 - 概覽表會列出計畫中的每個步驟,無論
--scope設定為何。 - 每個步驟的詳細區塊數量與已解析的
--scope相符(當--scope=all時為完整計畫;步驟:n為一個區塊;範圍:a-b為範圍大小)。在僅概覽模式下,不會產生每個步驟的區塊,也不會產生批次區塊。
邊緣情況
- 無明確步驟:優先採用 H2/H3 分割;若仍不明確,則報告「未偵測到結構化步驟」,並附上文件大綱,要求使用者確認是否依大綱執行。
- 大型計畫(>1500 行):進入僅概覽模式— 僅輸出概覽表,並請使用者在重新執行以取得詳細資訊前,先使用
--scope縮小範圍。在此模式下,將跳過每步驟的詳細區塊以及「批次」執行區塊。 - 步驟過於寬泛(例如「完成所有後端工作」):不要強行建立單一鏈。建議拆分為 N.a 和 N.b,並提出拆分方案。
- 計畫中宣告代理程式(罕見):首先移除所有
everything-claude-code:前綴,以取得原始目錄名稱(第 0 階段第 5 步),然後對照目錄進行驗證。替換無效的代理程式,並在「鏈結依據」下說明原因。原始名稱將在輸出時根據ECC_MODE重新加上前綴。 - 在
--lang=auto無法選定首選語言的多語言專案中:將lang設為 unknown;將 code-reviewer 解析為code-reviewer,並將 build-resolver 解析為build-error-resolver。請在「鏈結理由」中提及此備用方案。
範例
範例 1 — 外掛程式模式,Python 計畫
輸入:
plan-orchestrate @docs/plan/example-feature.md --lang=python
預期輸出節錄:
## 步驟 2 — 加密敏感的 UserProfile 欄位
**目標**:引入 SQLAlchemy 的 `EncryptedString` 類型,並在資料持久化前使用 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
複製





首頁
