/workspace:agent-orchestrationfrom workspace
適用於多階段 agent chain(≥2 個 agent 接力)、需要用 output file 交棒、把多步工作流展示給使用者確認、偵測到「工作完成」需清理階段性產物、跨 agent 任務串接決策。涵蓋 chain 規範、output 路徑、清理流程、工作流呈現格式、subagent 作為 context 隔離工具的使用時機。觸發語:「召喚某 agent」「多階段流程」「工作流規劃」「agent 交棒」。
Ships in workspace. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
多階段 agent chain 的協調規範。原則:subagent 通常不能再 spawn subagent,多階段流程靠主對話串接 + output file 作交棒。
動手前先判斷:
| 情況 | 交給 |
|---|---|
| 小、需要目前對話的 context | 自己做 |
| 範圍明確、不需中途問人、結果一份回報裝得下 | subagent(多個就在同一則訊息平行派) |
| 長(預估 15 分鐘以上)、可能中途問人、要完整 session 能力,或要換另一套 CLI | 獨立 worker session(如終端多工器裡另開的 pane) |
tmp-scratch)。當一條 chain 有多個 agent 接力時,上游 agent 把結論寫成 output file,下游 agent 讀檔取得 context,避免主對話用「口頭摘要」轉述而丟失細節。
建議 output 路徑約定(依專案調整根目錄):
| Agent 類型 | Output 路徑 | 用途 |
|---|---|---|
| 架構 / 技術選型 | <workdir>/architecture/{topic}/adr-{seq}-{slug}.md | ADR:決策、trade-off、補救路線 |
| 領域 / 業務諮詢 | <workdir>/domain-review/{topic}/report.md | 諮詢 / 審查報告 |
| 程式碼審查 | <workdir>/code-review/{topic}/round-{n}.md | 審查報告(n 為迴圈次數) |
| 除錯 | <workdir>/debug/{topic}/report.md | 根因診斷與修復方案 |
| 資料 / 事實探勘 | <workdir>/data-exploration/{topic}.md(選用) | 探勘結果 |
| 實作 / 測試 | 直接寫程式碼 / 測試檔 | 不另寫 markdown report |
round-{n}.md 編號。架構決策 → 架構 agent 寫 <workdir>/architecture/feat-x/adr-001-strategy.md
↓ 主對話讀檔,召喚下一棒
實作 → 開發 agent 讀 ADR 實作 → 提 PR 引用 ADR
↓
審查 → 審查 agent 讀 ADR + code → 寫 <workdir>/code-review/feat-x/round-1.md
接到「召喚 X agent」需求時,主對話必須:
請先讀 <workdir>/{path}/{file}.md 取得上下文,再執行 {任務}
禁止:
當偵測到「工作完成」意圖時(任一觸發即執行清理):
| 觸發條件 | 範例 |
|---|---|
| 使用者明確表達結束 | 「完成了」「結束」「告一段落」「收工」「done」 |
| Commit 流程完成 | commit skill 結束後 |
| PR 建立完成 | gh pr create / glab mr create 成功後 |
| 所有任務完成 | 任務清單全 completed 且使用者沒提新需求 |
architecture/):移到永久決策紀錄目錄(如 decisions/{slug}.md,推薦)/ 保留原處 / 刪除(決策已被取代)。rm;移動 → git mv(保留歷史);保留 → 不動。禁止:
| 任務複雜度 | 判斷標準 | 行為 |
|---|---|---|
| 單步 | 除錯、查詢、提交、單一 skill | 直接執行 |
| 多步 | 涉及 2+ 命令或 agent | 展示工作流 → 使用者確認 → 執行 |
| 全流程 | 從需求到實作 | 展示完整流程 → 逐階段確認 |
📋 工作流規劃:{任務摘要}
步驟:
1. `{tool/agent}` — {目的} {[平行]/[依賴 N]}
2. `{tool/agent}` — {目的} {[平行]/[依賴 N]}
3. ...
預估涉及:{模組/檔案範圍}
→ 確認後開始執行
每次召喚 subagent = 全新 context window。subagent 除了「分工」之外,還是 context 隔離工具。
「我之後還需要這些 tool output,還是只要結論?」
| 我之後需要什麼? | 做法 |
|---|---|
| 只要結論 / 分析 / 判斷 | 派 subagent(tool output 不污染主 context) |
| 需要完整 tool output 細節(原始檔案內容、原始查詢結果) | 主對話自己做;之後若冗餘再壓縮 context |
| 不確定 | 先假設「只要結論」派 subagent;真要細節再重讀 |
| 場景 | 為什麼派 subagent |
|---|---|
| 讀 >5 個檔案才能回答 | 讀檔 tool output 會填滿主 context,只要結論 |
| 驗證實作是否符合規格 | 驗證過程的中間步驟不需留在主對話 |
| 寫文件 / summary | 需翻大量 git diff 但產出只是一段文字 |
| 探勘真實資料 | 查詢結果留在 subagent 的 context 即可 |
兩者互補:平行跑多 agent 仍適用 context 隔離原則,每個 subagent 只回報結論。
裝了 superpowers 時,方法類(規劃、執行、審查、除錯、TDD)以它為準;superpowers:dispatching-parallel-agents 管「能不能平行」。本 skill 管 chain 接力、output file 交棒、清理;herdr/Herdr.app 的 pane(mux.py)與跨 CLI 派工用 toolkit:agent-dispatch(可選)。沒裝 superpowers 就照本檔與 §0。
當 agent chain ≥ 2 stage 且預估總時長 ≥ 5 分鐘:
目的:全自動的長流程中,人幾乎不介入,必須定時回報使用者或自我偵測 sub-agent 是否還活著,不要傻傻地空等。
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub kerryhuang/plugharbor --plugin workspace13 skills in this plugin
/commit建立符合 Conventional Commits 規範的提交訊息,支援 Git Flow+Semantic Release。Use when 你自己要下 git commit(含自動流程中)、使用者說「commit」「幫我提交」。/context-hygieneUse when 對話很長 / context 快滿 / 連續修同一錯誤失敗 / 即將切換到無關任務 / 要讀大量檔案探索 / agent 交接(handoff)/ 對話要搬到別的專案目錄 / 使用者說「對話太長」「感覺變笨」「context 滿了」「要不要清一下」「clean context」時。/convention-first適用於在既有 codebase 撰寫任何新元件(class / module / handler / component 等)、審查程式碼是否引入新風格、判斷「該自己發揮還是模仿既有寫法」。先 grep 既有實作當樣板,禁止單方面引入新模式。慣例優先於創新。觸發語:「這樣寫對嗎」「有沒有既有寫法」「該模仿哪個」「引入新 pattern」「convention first」「follow existing pattern」。Other plugins' skills for the same job