写 Subagent 不翻车?Anthropic 官方这个 129k 星 Skill 救我命
Claude Code 用久了,你是不是也想过:能不能让 Claude 自动派一个”小弟”出去,把活儿干完再回来?比如让它自己跑一个 code reviewer、或者单独拎一个 agent 去搞安全审计。
这就是 Subagent(子代理)。但问题是:很多人照着官方文档写了一个 agent.md,要么触发不了,要么跑偏。问题出在哪?在 frontmatter。
今天挖到 Anthropic 官方仓库里一个被严重低估的 Skill —— agent-development。它在 GitHub 129k 星的 anthropics/claude-code 仓库里,是 plugin-dev 系列六件套之一(另外五个是 skill-development、command-development、hook-development、mcp-integration、plugin-structure、plugin-settings)。
它到底教 Claude 干什么
这个 Skill 的核心职责非常单一:当你让 Claude “创建一个 subagent” 的时候,它会按照官方规范输出一个标准的 Markdown agent 文件。 听上去很无聊?实际上——
它把 Anthropic 沉淀的 agent 设计哲学,变成了可复用的模板:
- frontmatter 字段怎么填:
name(3-50 字符,小写+连字符)、description(必须含触发条件和 2-4 个 example)、model(inherit/sonnet/opus/haiku)、color(UI 配色,blue/cyan/green/yellow/magenta/red) - description 怎么写才不跑偏:必须用 “Use this agent when…” 开头,example 块必须含
Context / user / assistant / Why四要素,这是 Claude 真正决定要不要触发这个 agent 的关键字段 - tools 怎么限制遵循最小权限原则——只读分析只给
["Read","Grep","Glob"],代码生成给["Read","Write","Grep"],测试才给Bash - system prompt 怎么写:第二人称直接对 agent 说话,套 “You are [role]… Your Core Responsibilities… Analysis Process… Output Format…” 四段式结构
最实用的三个 example
Skill 里给的范例可以现抄:
- code-reviewer
- test-generator
- api-docs-writer
- security-analyzer
而反面教材也很经典:helper(太泛)、-agent-(首尾连字符不合法)、my_agent(下划线不允许)、ag(太短)。这些坑没这个 Skill 之前,你只能一次次踩。
怎么装
一行命令:
npx skills add https://github.com/anthropics/claude-code --skill agent-development
装完之后,你让 Claude “create a code review agent” 或者 “write a subagent for security audit”,它就会按这个 Skill 的规范输出,而不是瞎写一通。
为什么我推荐这个
作为 GitHub 上 star 数最高的 Claude Code 官方配套仓库,anthropics/claude-code 里其实藏着大量这种”小而美”的 Skill。agent-development 是其中最被低估的一个——大家都在研究怎么写 Skill,却忽略了写 Subagent 也是一门手艺,而且 Subagent 才是 Claude Code 真正能并行干活的灵魂。
如果你已经在用 Claude Code 写复杂工作流,这个 Skill 几乎必备。
GitHub: https://github.com/anthropics/claude-code/tree/main/plugins/plugin-dev/skills/agent-development
GitHub: https://github.com/anthropics/claude-code/tree/main/plugins/plugin-dev/skills/agent-development
评论区
登录后可评论。