cc-agent-design
Agent 配置設計指南 — 基於 Claude Code 6 個 built-in agent 的逆向分析。Use when: 設計新 agent、優化現有 agent prompt、決定工具/模型配置、撰寫 dispatch prompt。
npx skills add majiayu000/claude-skill-registry --skill cc-agent-design --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Agent 設計指南 ## 1. Agent Prompt 三層架構 Claude Code 的 prompt 職責嚴格分離,不要混在一起: | 層 | 由誰提供 | 內容 | |---|---|---| | **身份 + 邊界** | `getSystemPrompt()` | 我是誰、我能做什麼、我不能做什麼 | | **環境資訊** | `enhanceSystemPromptWithEnvDetails()` | cwd、絕對路徑規則、emoji 禁用 | | **具體 context** | dispatcher 的 `prompt` 參數 | 任務描述、已知資訊、目標檔案 | **實際做法**:`generalPurposeAgent.ts` 的 system prompt 只有 ~10 行(身份 + 指導方針),環境細節由系統自動追加,任務細節全靠 caller 的 `prompt` 參數。 **反模式**:在 system prompt 裡寫「目前的任務是修改 src/foo.ts」。那是 dispatcher 的責任。 --- ## 2. 工具最小化原則 給越少工具,模型越聚焦。Claude Code 的具體做法: - **Explore agent**:禁 5 個工具(AgentTool、ExitPlanMode、FileEdit、FileWrite、NotebookEdit)。唯讀任務不需要寫工具。 - **statusline-setup**:只給 `['Read', 'Edit']` 兩個工具。任務明確,工具也明確。 - **claude-code-guide**:`['Glob', 'Grep', 'Read', 'WebFetch', 'WebSearch']`,文件查詢專用。 **設計流程**:先列出任務需要的最小動作集,再對應工具。不要從「給所有工具」開始往回刪。 **決策樹**: 1. 這個 agent 需要寫入能力嗎?不需要 → 禁 Edit/Write 2. 需要派生子 agent 嗎?不需要 → 禁 AgentTool(防深度爆炸) 3. 需要執行系統命令嗎?不需要 → 考慮禁 Bash --- ## 3. 模型選擇矩陣 | 場景 | 模型 | Claude Code 案例 | |---|---|---| | 快速搜尋 / 唯讀探索 | `haiku` | Explore agent、claude-code-guide | | 特定語言轉換邏輯 | `sonnet` | statusline-setup(需解析 bash/zsh 語法) | | 深度架構推理 | `inherit`(繼承父模型) | Plan agent、verification agent | | 通用執行(兜底) | 不指定(`getDefa
- 1. Agent Prompt 三層架構
- 2. 工具最小化原則
- 3. 模型選擇矩陣
- 4. omitClaudeMd 模式
- 5. Dispatch Prompt 撰寫原則
- 6. Agent Prompt 模板
- 7. 反模式清單
What does the cc-agent-design skill do?
Agent 配置設計指南 — 基於 Claude Code 6 個 built-in agent 的逆向分析。Use when: 設計新 agent、優化現有 agent prompt、決定工具/模型配置、撰寫 dispatch prompt。
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill cc-agent-design --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
