orchestratelisted
Install: claude install-skill AsiaOstrich/universal-dev-standards
# /orchestrate — 任務計畫編排 Skill
> **語言**: [English](../../../../skills/orchestrate/SKILL.md) | 繁體中文
## 用法
```
/orchestrate <plan.json> # 執行計畫
/orchestrate <plan.json> --dry-run # 僅驗證,不執行
```
---
## 執行流程
### Step 1:讀取與解析計畫(Claude-native)
使用 Read tool 讀取 plan.json,直接由 Claude 解析:
1. 讀取 JSON 檔案,解析為任務清單
2. 驗證結構:`tasks` 非空、每個 task 含 `id`、`title`、`spec`
3. 安全掃描:檢查 `task.spec` 是否含危險指令(`rm -rf /`、`DROP DATABASE`、`git push --force`)
- 若發現安全問題,列出所有問題並**詢問使用者是否繼續**
4. 拓撲排序:依 `depends_on` 欄位將 tasks 分組為執行層(layers)
- Layer 0:沒有依賴的 tasks(可並行)
- Layer N:依賴全部在 Layer 0..N-1 中的 tasks
若 `validation.valid` 為 false,輸出錯誤訊息並停止。
---
### Step 2:呈現執行計畫
向使用者顯示解析結果:
```
計畫:<project> 品質:<quality>
──────────────────────────────────
Layer 0 (並行):T-001, T-002
Layer 1 (序列):T-003 (依賴 T-001)
Layer 2 (序列):T-004 (依賴 T-002, T-003)
──────────────────────────────────
共 4 個任務,3 個執行層
```
若使用 `--dry-run`:顯示以上摘要後**立即停止**,不啟動任何 Agent。
---
### Step 3:逐層執行
對 `layers` 陣列中的每一層:
1. **同層並行**:同一層的 tasks 在同一訊息中啟動多個 Agent tool
2. **Agent tool 參數**:
- `prompt`:task.spec + acceptance_criteria + user_intent 組合而成的執行提示
- `isolation: "worktree"`:每個 task 在獨立 git worktree 執行
- `description`:`"Task {task.id}: {task.title}"`
3. **等待完成**���所有同層 agents 完成後,才進入下一層
**Agent 提示範本**:
```
Task: {task.title}
Spec:
{task.spec}
Acceptance Criteria:
{task.acceptance_criteria 逐條列出}
User Intent:
{task.user_intent}
After completing the task, run: {task.verify_command}
```
---
### Step 4:依賴失敗處理
如果某個 task