your AI toolbox arrives
Join 1,200+ super-solo operators making money with AI
你的 AI 工具箱
已有 1,200+ 订阅者正在用 AI 搞钱
How to Write AI Agent Skills That Actually Trigger in 2026 | 2026年如何写出真正会被触发的AI Agent技能
Most agent skills are never loaded. The model reads your description line, decides the skill is not relevant, and moves on — and you never find out why. This guide covers how skill triggering actually works, how to structure a SKILL.md that survives contact with a real agent, and how to test that your skill fires before you ship it to a team.
大多数 Agent 技能从来没有被加载过。模型读完你的描述行,判断这个技能不相关,然后继续往下走——而你永远查不出原因。本指南讲清楚技能触发到底是怎么运作的,一个 SKILL.md 怎样才能在真实智能体手里活下来,以及在你把技能发给团队之前,如何验证它真的会被触发。
There is a specific kind of disappointment that every team hits around week three of building agent tooling. The skill was written carefully. The instructions were clear, the examples were good, the file was committed to the repository. The agent was told to use it. And then a week later someone asked the agent to do exactly the thing the skill covered, and the agent did it the way it always does — improvised, inconsistent, and worse than the person who wrote the skill had done it for three months.
每个团队在构建 Agent 工具的第三周左右都会撞上一种特定的失望。技能是认真写的,指令清晰,示例到位,文件也已提交到仓库。Agent 被明确告知要使用它。然后一周之后,有人让 Agent 做一件这个技能本来就覆盖的事情,而 Agent 依然用老办法做——即兴发挥、不一致,而且比写这个技能的人已经做了三个月的水平还差。
Nothing crashed. There was no error in the logs. The skill was simply never consulted, and the failure mode is invisible unless you go looking for it. That is the core problem this guide addresses: skill quality has two independent axes, and most teams only ever measure one of them. Axis one is whether the skill is correct — the instructions are right, the commands work, the guidance is sound. Axis two is whether the skill is reachable — whether the agent’s selection logic decides to open it at all. You can have a perfect skill that never fires, and a trivial skill that fires every time and wastes a context window.
没有崩溃,日志里也没有错误。技能只是从未被查阅,而这个失败模式在你专门去找之前是完全不可见的。这就是本指南要解决的核心问题:技能质量有两个彼此独立的维度,而大多数团队只测量了其中一个。维度一是技能是否正确——指令对不对、命令能不能跑、建议是否可靠。维度二是技能是否可达——Agent 的选择逻辑到底会不会决定打开它。你可以拥有一个完美但永不触发的技能,也可以拥有一个每次都触发、却白白消耗上下文窗口的琐碎技能。
This guide is written for the engineer who has to make a skill work for other people, not just for themselves. It covers the anatomy of a skill file, the description mechanics that drive selection, progressive disclosure for large skills, how to bundle scripts and reference documents, how MCP and skills occupy different layers, how to test triggering in isolation, and the supply-chain security questions nobody asks before installing a third-party skill from a marketplace.
本指南写给那些必须让技能对别人也生效的工程师,而不只是对自己生效的人。内容包括技能文件的结构解剖、驱动选择逻辑的描述行机制、大体量技能的渐进式披露方式、如何打包脚本与参考文档、MCP 与技能各自占据哪一层、如何单独测试触发行为,以及在从市场安装第三方技能之前几乎没人会问的供应链安全问题。
📑 Table of Contents
📑 文章目录
- 1. What an Agent Skill Actually Is (and What It Is Not)
- 2. The Anatomy of a SKILL.md File
- 3. Why Most Skills Fail to Trigger
- 4. The Description Line Is the API
- 5. Progressive Disclosure for Large Skills
- 6. Frontmatter, Allowed-Tools and Metadata
- 7. Bundling Scripts, References and Assets
- 8. Skill Creator: AI-Assisted Skill Authoring
- 9. What Good Skill Authors Do Differently
- 10. find-skills and the Discovery Problem
- 11. Testing That a Skill Actually Fires
- 12. Versioning and Maintaining Skills Across a Team
- 13. MCP vs Skills: Which Layer Does What
- 14. Skill Supply Chain Security
- 15. A 90-Day Rollout for Skills in an Engineering Org
1. What an Agent Skill Actually Is (and What It Is Not) / Agent 技能到底是什么(以及不是什么)
A skill is a directory that contains a markdown file the agent reads on demand. That is the whole mechanism, and the simplicity is the point: the agent carries only a short index of available skills in its context, and when a task looks relevant it opens the file and reads the full instructions. The heavy content is not resident until it is needed. This is why skills exist as a concept distinct from a prompt, a system prompt, a document, or a tool.
技能就是一个包含 markdown 文件的目录,Agent 按需读取它。机制就这么多,而这种简单正是重点所在:Agent 的上下文里始终只保留一份可用技能的简短索引,当任务看起来相关时,它才打开该文件并阅读完整指令。重量级内容在被需要之前并不驻留。这正是「技能」作为一个独立于提示词、系统提示词、文档或工具的概念而存在的原因。
It is not a system prompt, and this distinction causes a lot of confusion. A system prompt is always resident and applies to every turn; it is expensive in context and blunt in effect. A skill is conditional and cheap, and it is loaded only when the agent’s own judgment says the task matches. If you find yourself wanting to paste a skill into the system prompt, that is usually a sign the skill should be a tool instead — a deterministic function the agent calls, rather than prose the agent reads and interprets.
它不是系统提示词,这个区别造成了很多困惑。系统提示词是常驻的,作用于每一轮对话;它在上下文里很贵,效果也很钝。而技能是条件性的、廉价的,只有当 Agent 自己的判断认为任务匹配时才会被加载。如果你发现自己想把某个技能粘贴进系统提示词,那通常说明这个技能应该做成一个工具——一个 Agent 调用的确定性函数,而不是 Agent 读懂并自行解释的散文。
It is also not a tool, and the practical difference is about who does the thinking. A tool does something: it runs a command, queries an API, writes a file. The output is deterministic and the agent does not interpret it. A skill tells the agent how to do something well: it carries judgment, heuristics, and the traps you already learned about. The best setups combine both — a script for the mechanical part, a skill for the judgment part. Our guide to building an MCP server step by step covers the tool layer in detail if you need to extend what an agent can reach.
它也不是工具,而实际区别在于「谁来做判断」。工具负责做事:执行命令、查询 API、写文件。输出是确定的,Agent 不需要解释它。技能则告诉 Agent 如何把某件事做好:它承载判断力、经验法则,以及你已经踩过的坑。最好的组合是两者兼用——机械部分交给脚本,判断部分交给技能。如果你需要扩展 Agent 能触达的范围,我们的MCP 服务器分步搭建指南详细覆盖了工具层。
It is not a document either, in one specific respect: nobody reads a skill for understanding. A skill is read to be acted on. That means the writing style matters more than in documentation — imperative voice, no hedging, no explaining what the reader already knows. If a skill file reads like a blog post, it will perform worse than a checklist, even if it contains exactly the same information.
它在某个特定意义上也不是文档:没有人为了「理解」去读技能。技能是为了被执行而读的。这意味着它的写作风格比普通文档更重要——祈使语气,不含糊,不解释读者已经知道的东西。如果一个技能文件读起来像博客文章,即使它包含的信息完全一样,表现也会比一份清单更差。
Finally, it is not a plugin or an extension that the agent automatically discovers because it is installed. Installation grants eligibility, not selection. The agent is handed a catalogue and makes a per-request judgement about what to open. If your skill does not fire, the fix is almost never “install it harder” — it is nearly always the description line, or the fact that you wrote the skill for a task the agent was never asked to do.
最后,它也不是「因为装上了就自动被发现」的插件或扩展。安装赋予的是「被纳入候选」的资格,而不是「被选中」。Agent 拿到的是一份目录,它会针对每个请求自行判断该打开什么。如果你的技能不触发,解决办法几乎从来不是「再装得用力一点」,而几乎总是描述行的问题,或者你写的技能覆盖的压根不是 Agent 被要求做的任务。
2. The Anatomy of a SKILL.md File / SKILL.md 文件的解剖结构
A skill directory has a conventional shape. The core file is named SKILL.md, and it starts with a YAML frontmatter block followed by markdown body. The frontmatter is metadata; the body is the instruction. The split is functional: the frontmatter is what the agent reads to decide whether to open the file, and the body is what it reads once it has decided. Anything you put in the body costs context only when the skill is used.
技能目录有一个约定俗成的结构。核心文件名为 SKILL.md,开头是一段 YAML frontmatter,然后是 markdown 正文。frontmatter 是元信息,正文是指令。这个划分是有功能意义的:frontmatter 是 Agent 用来决定是否打开该文件时读的东西,正文则是决定之后的阅读内容。放在正文里的任何东西,都只在这个技能被用到时才消耗上下文。
The frontmatter block is small and its fields are few. The name is a short identifier, typically lowercase and hyphenated, matching the directory name. The description is the critical field and it is not a title — it is a natural-language statement of when to use the skill, including the trigger conditions. Optional fields handle tool restrictions and other metadata. If you have ever written a description that reads like a summary of what the skill contains, you have written it wrong, and section four explains why.
frontmatter 块很小,字段也不多。name 是一个短标识符,通常是小写连字符形式,与目录名一致。description 是关键字段,而它不是标题——它是一句自然语言陈述,说明什么情况下该使用这个技能,其中要包含触发条件。还有一些可选字段用于工具限制和其他元信息。如果你曾经写出一个「总结这个技能包含什么」的描述,那你写错了,第四节会解释原因。
The body is where the real work happens, and it has a rough order that works far better than freeform prose. A one-paragraph statement of what the skill does and the non-obvious constraint it encodes. Then a numbered procedure — the actual sequence of steps, written so that each step is a command or an unambiguous action rather than a principle. Then the failure modes, which is the section that separates a skill that helps from a skill that occasionally helps.
正文是真正的工作所在,它有一种粗糙但极其有效的顺序,远好过自由散落的散文。先用一段话说明这个技能做什么、以及它编码了哪条不显而易见的约束。然后是编号流程——真正的步骤序列,每一步都要写成一条命令或一个没有歧义的动作,而不是一条原则。再然后是失败模式,这一节才是「有帮助的技能」与「偶尔有帮助的技能」之间的分水岭。
The single most common structural mistake is putting the procedure inside prose paragraphs. An agent executing a procedure benefits enormously from a numbered list, because list items are addressable — the agent can say “step 3” and reason about its position. Prose forces the agent to reconstruct the sequence from a paragraph, which it does unreliably, particularly across long procedures where ordering matters.
最常见的结构性错误是把流程埋进散文段落里。执行流程的 Agent 从编号列表中获益巨大,因为列表项是可寻址的——Agent 可以说「第 3 步」,并对自身所处位置进行推理。而散文会迫使 Agent 从段落里重建顺序,它做这件事并不可靠,在流程较长、顺序又重要的情况下尤其如此。
A second mistake is writing the skill as background knowledge. Anything the agent needs to know before it can act belongs in the skill, not in a wiki page, a README, or a doc that requires a separate fetch. If a skill says “see the internal deploy documentation”, the agent now has to make a network call, parse a page nobody shaped for an agent, and infer relevance — three separate opportunities to fail. If you are wondering whether the agent can even reach that page, our comparison of agent deployment platforms covers what agents can and cannot reach in practice.
第二个错误是把技能写成背景知识。Agent 在行动前需要知道的一切,都应当写在技能里,而不是放在 wiki 页、README 或需要单独抓取的文档里。如果技能写的是「参见内部部署文档」,那么 Agent 现在必须发起一次网络请求、解析一个根本没有为 Agent 设计的页面,再推断其相关性——三个各自独立的失败机会。
Finally, keep the skill narrow. A skill that tries to cover a whole workflow usually ends up doing two jobs at half quality, and its description becomes so vague that it stops being selectable. If a skill feels like it needs “and” in its title, it is probably two skills.
最后,保持技能的边界狭窄。一个试图覆盖整条工作流的技能,通常会以一半的质量干两份活,而它的描述也会变得过于模糊,直到彻底失去被选中的可能。如果一个技能的标题里需要出现「和」,那它多半是两个技能。
3. Why Most Skills Fail to Trigger / 为什么大部分技能不会触发
When a skill does not fire, the cause is almost always one of five things, and they are worth learning to recognise because each has a different fix. The first and most common by far: the description describes the skill rather than the trigger. The second: the description is written in the vocabulary of the skill’s author rather than the vocabulary of the request. The third: the skill overlaps with another skill and loses the tie-break. The fourth: the skill is scoped too narrowly, so its trigger phrase never matches the phrasing the user actually typed. The fifth: the skill is fine, but the task never reaches the agent at all.
当一个技能不触发时,原因几乎总是以下五件事之一。值得学会识别它们,因为每一种的修法都不一样。第一种也是最常见的一种:描述写的是「这个技能是什么」,而不是「什么情况下该触发」。第二种:描述使用的是技能作者的词汇,而不是请求本身的词汇。第三种:技能与另一个技能重叠,在比较中落败。第四种:技能范围收得太窄,导致它的触发短语永远匹配不上用户实际输入的说法。第五种:技能本身没问题,但那个任务压根没到 Agent 手里。
Take the description mistake first because it is so widespread that it deserves a concrete example. Here is a description that fails: “A comprehensive guide to database migration patterns including schema versioning, zero-downtime deploys, and rollback strategies.” The agent scanning the catalogue has no idea when to use this, because it describes the contents. Here is a description that fires: “Use when changing a database schema on a live production table — covers zero-downtime migrations, backfill ordering, and rollback.” The second version names the situation, and situations are what the agent is trying to match against.
先看描述问题,因为它极其普遍,值得用一个具体例子说明。下面是一个失败的描述:「一份关于数据库迁移模式的全面指南,涵盖 schema 版本管理、零停机发布与回滚策略。」扫描目录的 Agent 完全不知道什么时候该用它,因为它描述的是内容。而下面这个描述会触发:「当你要在生产环境的活跃表上修改数据库 schema 时使用——涵盖零停机迁移、回填顺序与回滚。」第二个版本点名了「情境」,而情境正是 Agent 试图匹配的东西。
The vocabulary mismatch is the same problem in a subtler form. If you write “refactor the ingestion pipeline” in the description, the agent will not match a user who asks to “fix the ETL job that keeps failing”. These are the same task to a human and different tasks to a matching system. The fix is to write descriptions using the words users and teammates actually use in their requests, which means looking at real prompts from your team rather than writing from first principles.
词汇错配是同一个问题的隐蔽版本。如果你在描述里写「重构摄入管道(ingestion pipeline)」,Agent 就不会匹配上那些说「修复那个老是失败的 ETL 任务」的用户。对人来说是同一件事,对匹配系统来说却是两件事。修法是:写描述时使用用户和同事在真实请求里实际会用的词,这意味着要去翻你团队的真实提示记录,而不是凭空构想。
Overlap deserves special attention because it becomes more likely every time a team adds skills without a registry. Two skills that both cover “debugging” produce a tie-break that depends on ordering, on wording, and occasionally on model mood. The result is non-deterministic behaviour, which is worse than a skill that never fires, because at least a never-firing skill is boring. If you are auditing a skill library, our systematic debugging guide for AI agents is a good candidate for one of those overlapping slots — and the point is to notice the overlap, not to add a third one.
重叠问题值得单独强调,因为随着团队不断新增技能而没有登记表,这种概率只会越来越高。两个都覆盖「调试」的技能,会产生一次取决于排序、措辞、甚至模型心情的比较结果。结果是非确定性行为——这比一个从不触发的技能更糟,因为从不触发的技能至少是无聊的。如果你要审计一个技能库,我们的AI Agent 系统化调试指南正是那些重叠位置的一个合适候选——重点是发现重叠,而不是再添第三个。
Over-scoping is the mirror-image failure. A skill scoped to “the postgres migration script” will never match “we need to move our users table”. Narrow triggers need near-exact phrasing to hit, and real requests are phrased loosely. The practical fix is to widen the trigger surface with synonyms and situation words while keeping the body’s procedure narrow — the description can be broad as long as the instructions inside stay specific.
范围过窄是镜像式的失败。一个限定在「那个 postgres 迁移脚本」的技能,永远匹配不上「我们要把 users 表搬过去」。狭窄的触发条件需要近乎逐字一致的措辞才能命中,而真实请求的表述总是比较松散。实际修法是:用同义词和情境词拓宽触发面,同时保持正文流程的狭窄——描述可以宽,只要里面的指令保持具体。
And the fifth cause deserves a sanity check before you spend a week rewriting descriptions: confirm the task is even reaching an agent. A surprising share of “the skill doesn’t work” reports are actually a routing problem upstream — the request is being handled by a different tool, a different model, or a human workflow that never touched your skill. Our comparison of agent tools for developers walks through how requests get routed in the mainstream setups, and it is worth checking which layer the request lands in before you blame the skill.
第五种原因在动手改描述之前值得先做个合理性检查:确认任务到底有没有到达 Agent。相当一部分「技能不好用」的报告,实际上是上游的路由问题——请求被另一个工具、另一个模型,或者一条根本没碰到你技能的人工工作流处理了。我们的开发者 AI Agent 工具对比讲解了主流 setups 中请求是如何被路由的,在责怪技能之前,先查清请求落在哪一层是值得的。
4. The Description Line Is the API / 描述行就是 API
Because the description is the only thing the agent sees before deciding, it deserves the same discipline you would give a public API. It should be written for a reader who has no other context: not the team that built the skill, not the agent, and not you three months from now. Treat it as a contract with three obligations — say what situation this applies to, say what it does in that situation, and say what it does not do.
由于描述是 Agent 在做决定之前唯一能看到的东西,它值得你给出与公共 API 同等的严谨度。它应当写给一个没有任何其他上下文的读者:不是造这个技能的团队,不是 Agent,也不是三个月后的你自己。把它当成一份有三个义务的契约——说清它适用于什么情境、在该情境下它做什么、以及它不做什么。
The “when to use” clause is the part most authors omit and the part that carries the most weight. A useful pattern is to lead with an explicit trigger phrase, then add the synonyms and near-misses that your real requests use. Something like: “Use when the user asks to run, re-run, or debug the nightly ETL job, or mentions ‘airflow dag’, ‘scheduled pipeline’, or ‘last night’s load’. Does not cover ad-hoc one-off SQL queries.” That single description gives the agent a situation, three synonyms, and an explicit exclusion — and the exclusion is often the highest-value part, because it prevents the skill from firing on the wrong request.
「何时使用」这一句是大多数作者省略的部分,也是承载权重最大的部分。一个好用的模式是:先给出明确的触发短语,再补上真实请求里会用的同义词和近似说法。比如:「当用户要求运行、重跑或调试夜间 ETL 作业,或提到 airflow dag、scheduled pipeline、昨晚的加载时使用。不覆盖临时的单次 SQL 查询。」这样一句话同时给出了情境、三个同义词和一条明确排除——而排除部分往往价值最高,因为它阻止技能在错误请求上触发。
The “does not cover” clause is what most people leave out and it does more work than it appears to. Selection is a comparative process, and giving the agent an explicit negative boundary makes the comparison sharper. Without it, a skill describing debugging will be considered for a request that is really about logging configuration, and the cost of that wrong selection is a context window spent on an irrelevant file plus a token or two for the request that actually needed it.
「不覆盖什么」这一句是多数人会省略的,而它做的功比看上去更多。筛选是一个比较过程,给 Agent 一条明确的负面边界会让比较更锐利。没有它的话,一个描述调试的技能会被拿去考虑一个其实是在问日志配置的请求,而这次错误筛选的代价是:花掉一个上下文窗口去读无关文件,外加消耗掉真正需要的那一两个 token。
A second discipline: keep it under a sensible length. Long descriptions dilute. If the description runs to several sentences with caveats and sub-cases, the signal about the core trigger gets buried, and the agent’s attention is finite. The full rule set should live in the body, which is exactly where the agent looks after it has already decided to open the file.
第二条纪律:把描述控制在合理长度内。描述过长会稀释信号。如果描述写了好几个句子、塞满了注意事项和子情况,关于核心触发的信号就被埋掉了,而 Agent 的注意力是有限的。完整的规则集应当写在正文里——那正是 Agent 决定打开文件之后才会去看的地方。
Test your description the way you would test an API contract: write down five requests that should trigger the skill and five that should not, and check whether the description distinguishes them. This takes ten minutes and it catches nearly all the problems described in the previous section. If a request you expect to trigger reads ambiguously against the description, the agent will do the same thing you would.
像测试 API 契约那样测试你的描述:写下五个应该触发的请求和五个不该触发的请求,检查描述能否区分它们。这只要十分钟,却能捕捉到上一节描述的几乎所有问题。如果某个你预期会触发的请求,在描述面前读起来含混不清,那么 Agent 会做出和你一样的判断。
5. Progressive Disclosure for Large Skills / 大体量技能的渐进式披露
The whole point of the skill format is that the agent does not carry your documentation in context until it needs it. Progressive disclosure is how you push that further for a skill that is genuinely large. The structure is layered: a short body in SKILL.md that tells the agent what the skill covers and when to reach for the deeper material, then separate files it opens only when the specific sub-topic comes up.
技能格式的整个意义就在于:Agent 不需要在上下文里一直背着你的文档,直到真正需要它。渐进式披露就是让大体量技能把这层能力再推进一步。结构是分层的:SKILL.md 里是一段简短正文,告诉 Agent 这个技能覆盖什么、什么时候该去取更深层的材料;然后是独立的文件,只有当具体子话题出现时才被打开。
The canonical pattern uses a references directory. The SKILL.md body contains the core procedure that applies to most uses, and a short pointer list like: “for language-specific migration syntax, read references/postgres.md; for rollback semantics, read references/rollback.md; for the full runbook, read references/runbook.md”. The agent opens the relevant file on demand. Each referenced file is a normal markdown document, so it can also be read by a human when debugging.
标准做法是使用 references 目录。SKILL.md 正文里放适用于大多数场景的核心流程,以及一段简短的指引列表,例如:「各语言迁移语法见 references/postgres.md;回滚语义见 references/rollback.md;完整运行手册见 references/runbook.md」。Agent 按需打开对应文件。每个被引用的文件都是普通的 markdown 文档,因此调试时人类也能直接阅读。
Scripts belong in the same layered model, and for a different reason. A script that implements a deterministic step is better executed than read, because execution produces a fact while reading produces text the agent has to interpret and possibly misapply. The canonical case is validation: a script that checks whether a migration is safe is far more reliable than instructions telling the agent to check whether a migration is safe, because instructions admit to a fairly wide range of interpretations.
脚本同样属于这个分层模型,但理由不同。实现确定性步骤的脚本,执行优于阅读——执行产出一个事实,而阅读产出的文本需要 Agent 解释、且可能被误用。典型场景是校验:一个「检查迁移是否安全」的脚本,远比「让 Agent 去检查迁移是否安全」的指令可靠,因为指令允许相当宽泛的解释空间。
There is a limit to how deep you should go. If a skill requires the agent to open four reference files to answer one question, you have built a file system rather than a skill, and the agent will burn significant context and time on navigation. The practical test is whether the reference list in SKILL.md is short enough that the agent can make a good decision without opening anything — if it cannot, the pointers are too vague to be useful.
这个深度是有上限的。如果一个技能要回答一个问题就需要打开四个参考文件,那你造出来的是一套文件系统而不是一个技能,而 Agent 会在导航上消耗大量上下文和时间。一个实用检验是:SKILL.md 里的参考清单是否足够短,以至于 Agent 不打开任何东西也能做出好的决定——如果做不到,说明这些指引太模糊,起不到作用。
A related discipline is to put the failure modes at the top of the referenced file rather than the bottom. When an agent opens references/postgres.md, it is usually because something went wrong. If the file opens with the common mistakes, the agent reads them at the moment they matter. If it opens with background theory, the agent has to read through the theory before it reaches the thing it needed. Our guide to agent workflow orchestration patterns covers the same layering principle applied to multi-step agent systems.
相关的纪律是:把失败模式放在被引用文件的开头而不是结尾。Agent 打开 references/postgres.md,通常是因为出了问题。如果文件以常见错误开头,Agent 就在最需要的时候读到它们。如果它以背景理论开头,Agent 就得先读完理论才能碰到真正需要的内容。
6. Frontmatter, Allowed-Tools and Metadata / Frontmatter、Allowed-Tools 与元数据
The frontmatter supports a few optional fields beyond name and description, and one of them — allowed-tools — is underused and occasionally misused. It restricts the tool set that can be invoked while the skill is active. This is a genuine safety control, not just hygiene: a skill that instructs the agent to run a deployment command should not implicitly grant the ability to read arbitrary files or send network requests.
frontmatter 除了 name 和 description 之外还支持若干可选字段,其中一个——allowed-tools——被低估了,而且偶尔会被误用。它限制技能激活期间可调用的工具集合。这是一个真正的安全控制,而不只是卫生习惯:一个指示 Agent 执行部署命令的技能,不应隐含地授予它读取任意文件或发起网络请求的能力。
But the narrower the allowed-tools list, the more likely you are to break the skill. The common failure is to restrict to the exact command the skill runs, which means the agent cannot use a read command to gather context first, or a search command to locate a file. A good default is to allow the class of operations the skill needs — file reading and searching, plus the specific write or execute tools — rather than a single narrow entry.
但 allowed-tools 列表越窄,就越容易把技能弄坏。常见的失败是把它限制到技能所运行的那一条确切命令,于是 Agent 既不能用读取命令先收集上下文,也不能用搜索命令定位文件。一个好的默认做法是:允许技能所需的那一类操作——文件读取与搜索,加上特定的写入或执行工具——而不是单一狭窄条目。
Treat allowed-tools as a review item rather than a default. The question to ask is not “can I restrict this?” but “what is the blast radius if this skill’s instructions are wrong or malicious?” A read-only skill has a small blast radius. A skill that can write files or execute commands should have an explicit, narrow allowlist, and should be reviewed by someone other than its author. That review question is exactly the one that section fourteen comes back to.
把 allowed-tools 当作一项需要评审的事,而不是随手填的默认值。要问的问题不是「我能不能限制它」,而是「如果这个技能的指令有误或带着恶意,爆炸半径有多大」。只读技能的爆炸半径很小。一个能写文件或执行命令的技能,应当有明确且狭窄的白名单,并且应由作者之外的人评审。这正是第十四节要回到的问题。
Metadata beyond the tool restriction is mostly for humans and for tooling. Version fields help you know which copy of a skill is in play when behaviour changes unexpectedly. Author and source fields help with attribution when skills are shared across teams or pulled from a marketplace. Neither affects selection, but both affect your ability to reason about a skill after the fact — which, in practice, is often when you need it.
工具限制之外的元数据主要是给人看的,也是给工具链用的。版本字段能让你在行为出现意外变化时知道在用的是哪一份技能副本;作者与来源字段在技能跨团队共享或从市场拉取时有助于署名。两者都不影响筛选,但都影响你事后推理一个技能的能力——而实际上,你往往正是在事后才需要这种能力。
One metadata decision matters more than the rest: whether the skill is scoped to a project or to a user. A project skill sits in the repository and is versioned with the code it applies to. A user skill sits in a personal configuration directory and follows the person. The distinction determines who maintains it, who gets updates, and whether a change to the skill needs a pull request. Skills that encode project-specific procedures — deploy steps, migration syntax, release checklists — belong in the project; skills that encode personal workflow preferences belong with the person.
有一个元数据决策比其他都重要:技能的作用域是项目级还是用户级。项目级技能放在仓库里,与它所适用的代码一起做版本管理;用户级技能放在个人配置目录,跟随人走。这个区分决定了谁来维护它、谁会收到更新,以及修改技能是否需要走 pull review。那些编码了项目特定流程的技能——部署步骤、迁移语法、发布检查清单——属于项目;编码个人工作流偏好的技能属于个人。
7. Bundling Scripts, References and Assets / 打包脚本、参考资料与资源
A skill that only contains markdown is limited. Real procedures often involve a specific command with a specific flag, a data file the agent needs to read, or a template that should be filled in rather than improvised. Bundling these alongside the instructions turns a description of a task into an executable task, and it removes a whole category of small errors where the agent gets the concept right but the invocation subtly wrong.
只包含 markdown 的技能是受限的。真实流程往往涉及一条带特定参数的命令、一个 Agent 需要读取的数据文件,或者一个应该被填入而不是临场发挥的模板。把这些和指令打包在一起,就把「对一个任务的描述」变成了「一个可执行的任务」,同时消除了一整类小错误——Agent 概念理解对了,但调用方式微妙地错了。
The most valuable thing to bundle is usually a validation script, and the reason is specific: it moves a judgement from the agent to a program. If a skill says “verify the migration has no full table lock”, the agent has to reason about lock behaviour from prose, which it will sometimes get wrong. If a skill bundles a script that runs the check and prints a verdict, the agent reports a fact. The difference matters enormously in the cases where being wrong is expensive.
最有价值的打包物通常是校验脚本,理由很具体:它把一项判断从 Agent 转移给程序。如果技能说「验证这次迁移没有全表锁」,Agent 就必须从散文中推理锁的行为,这有时会出错。而如果技能打包了一个运行检查并输出结论的脚本,Agent 报告的就是一个事实。在「搞错代价很高”的场景里,这个差别非常大。
Bundled scripts must be executable and their invocation must be stated exactly, including the working directory and any arguments. “Run the validator” is not enough. “Run `bash scripts/validate.sh –strict` from the repository root” is. The more exact the invocation, the less room there is for the agent to substitute a plausible-looking alternative. If the script needs a specific interpreter version, say so, because the agent will otherwise pick whatever is on PATH.
打包的脚本必须可执行,并且其调用方式要精确写明,包括工作目录和任何参数。「运行校验器」不够;「在仓库根目录执行 `bash scripts/validate.sh –strict`」才够。调用方式越精确,Agent 自行替换成一个看起来合理的替代品的空间就越小。如果脚本需要特定解释器版本,也要写明,因为否则 Agent 会从 PATH 上随便挑一个。
Reference data — schemas, config samples, lookup tables — belongs in the skill directory too, for the same reason. If the agent has to fetch a schema from a network endpoint mid-task, the task becomes non-deterministic and depends on that endpoint being up and unchanged. A bundled reference file is versioned, diffable, reviewable, and works offline. The cost is that it can go stale, which is why it needs the same update discipline as the rest of the skill.
参考数据——schema、配置样例、查找表——也应当放在技能目录里,理由相同。如果 Agent 必须在任务中途从网络端点拉取 schema,任务就变得非确定,并且依赖那个端点在线且未变。一份打包的参考文件是可控版本、可 diff、可评审的,而且能离线工作。代价是它可能过时,因此它需要和技能其余部分一样的更新纪律。
Assets follow the same logic. Templates, boilerplate files, and starter configurations are what separate a skill that describes what to do from a skill that hands over a working artifact. If your team keeps rewriting the same config header in every generated file, put that header in the skill as an asset. The agent copies it instead of approximating it, and the approximation goes away.
资源也遵循同样的逻辑。模板、样板文件和起始配置,正是把「描述该做什么」的技能与「直接交付可用产物」的技能区分开的东西。如果你的团队每次生成文件都在重写同一段配置头,那就把这段配置头作为资源放进技能里。Agent 会复制它而不是近似它,而那些近似也就消失了。
8. Skill Creator: AI-Assisted Skill Authoring / Skill Creator:AI 辅助的技能创作
Writing a skill by hand is tedious, and AI-assisted authoring tools have made the first draft nearly free. The tool takes a description of what you want the skill to do and produces a scaffold: the frontmatter, a section structure, and a starter body that follows the conventions described above. This is genuinely useful for the parts that are mechanical, and it is worth understanding exactly which parts those are.
手写一个技能很枯燥,而 AI 辅助创作工具已经把初稿变得几乎免费。该工具接收一段「你想让技能做什么」的描述,生成一个脚手架:frontmatter、章节结构,以及一段遵循上述约定的起始正文。这对机械性的部分确实有用,而且值得搞清楚具体是哪些部分。
What AI authoring is genuinely good at is the mechanical scaffolding: producing valid frontmatter with a reasonable name, laying out the numbered procedure section, creating the reference pointers, generating a first-pass trigger phrase. These are the parts where you would otherwise spend twenty minutes on structure and formatting. The generated scaffold is also a useful forcing function, because it makes you fill in the sections explicitly rather than writing a rambling paragraph and hoping the agent can parse intent out of it.
AI 创作真正擅长的是机械脚手架:生成带有合理 name 的合法 frontmatter、铺好编号流程章节、创建参考指引、生成第一版触发短语。这些正是你原本要花二十分钟在结构和排版上的部分。生成的脚手架也是一种有用的强制机制,因为它逼你把各章节明确填上,而不是写一大段散漫的段落、指望 Agent 能从中解析出意图。
What AI authoring is not good at is the part that determines whether the skill works: the trigger phrase. An AI will generate a description that summarises the skill, because that is what descriptions sound like in training data — documentation about something. The description is the one thing you should write yourself, ideally by looking at real requests your team has made. This is the single most common way an otherwise good skill fails.
AI 创作不擅长的是决定技能能否生效的那部分:触发短语。AI 会生成一个总结技能的描述,因为训练数据里的描述听起来就是那样——关于某物的一段文档说明。而描述恰恰是你应该自己写的东西,理想方式是去翻你团队真实提出过的请求。这是一个本来不错的技能最常见的失败方式。
The second thing AI authoring is bad at is failure modes. It will happily produce a procedure that looks complete and covers the happy path, and it will not spontaneously add the “the deploy succeeded but the migration silently failed because the column had a default” paragraph — because that knowledge lives in your head, not in the prompt. Failure modes are where most of a skill’s value sits, and they can only come from your experience.
AI 创作第二件不擅长的事是失败模式。它会乐意产出一份看起来完整、覆盖了顺利路径的流程,却不会自发地补上「部署成功了但迁移静默失败,因为那一列有默认值」这样的段落——因为这类知识在你脑子里,而不在提示词里。失败模式承载了技能大部分价值,而它们只能来自你的经验。
So the recommended workflow is: generate the scaffold, then rewrite the description and add the failure modes by hand. That combination gets you most of the time saving without inheriting the two weaknesses. If you want to see how these tools sit inside a broader agent setup, our Claude Code complete guide covers the terminal workflow where skill authoring happens most often in practice.
因此推荐的协作流程是:生成脚手架,然后自己重写描述并手动补上失败模式。这个组合能拿到大部分时间节省,同时不继承那两个弱点。如果你想了解这类工具在一个更完整的 Agent 体系中的位置,我们的Claude Code 完整指南覆盖了实践中skill创作最常发生的终端工作流。
9. What Good Skill Authors Do Differently / 优秀的技能作者有什么不同
There is a body of practice around writing skills that genuinely get used, and it differs from good technical writing in a few specific ways. The first is that good skill authors write for a stranger with no context. Not for their teammates, not for their future self, and definitely not for the agent — for a competent stranger who has never seen the codebase. This constraint eliminates a huge amount of prose.
围绕「写出真正会被用起来的技能」已经形成了一套实践,它与优秀的技术写作在几个具体方面不同。第一点是:优秀的技能作者是写给一个没有上下文的陌生人看的。不是写给同事,不是写给未来的自己,更不是写给 Agent——而是写给一个从未见过这个代码库的能干的陌生人。这个约束会消灭大量废话。
The second is that they encode traps, not tasks. A skill listing “run the tests” is a task list. A skill saying “run the tests with `npm run test:unit` — not `npm test`, which also triggers the e2e suite and takes forty minutes” is encoding a trap. The second version is worth writing because it saves the next agent forty minutes, and it is only knowable by someone who has already made that mistake.
第二点是:他们编码的是「坑」而不是「任务」。一个写着「运行测试」的技能是任务清单。而一个写着「用 `npm run test:unit` 运行测试——不要用 `npm test`,后者还会触发 e2e 套件并耗时四十分钟」的技能,编码的是一个坑。后者值得写出来,因为它为下一个 Agent 省下四十分钟,而这种知识只有已经犯过这个错的人才知道。
The third is that they write the failure modes as procedures. Not a paragraph about what can go wrong, but a numbered list of symptoms and the corresponding action: “symptom: agent reports the migration succeeded but the row count is unchanged → check for the trigger not firing on the presence of the default value”. Symptom-action pairs are directly usable by an agent that is currently staring at that symptom.
第三点是:他们把失败模式写成流程。不是一段关于「可能出什么问题」的文字,而是一份编号的症状与对应处置清单:「症状:Agent 报告迁移成功,但行数没有变化 → 检查触发器是否因存在默认值而未触发」。症状-处置对,对一个此刻正盯着这个症状的 Agent 是直接可用的。
The fourth is that they keep one skill per job, and they merge skills that overlap. The instinct to consolidate everything into one comprehensive “engineering skills” document is almost always wrong, because a single large skill has one description, and one description can only target one situation well. Splitting into three focused skills with three precise descriptions beats one broad one every time.
第四点是:他们坚持一个技能只做一件事,并且会合并互相重叠的技能。把所有内容整合成一份「工程技能大全」的直觉几乎总是错的,因为一个大技能只有一条描述,而一条描述只能很好地服务一个情境。拆成三个聚焦的技能、配三条精确的描述,永远胜过一个宽泛的大技能。
The fifth is that they test. Good skill authors assume the skill will not work and go looking for evidence, rather than shipping it and waiting for a complaint. The testing method is simple and is covered in section eleven, but the attitude is the thing: the author who has never watched their skill fire has not verified anything.
第五点是:他们会测试。优秀的技能作者默认技能不会生效,会主动去找证据,而不是发布出去然后等着挨投诉。测试方法很简单,第十一节会讲,但态度才是关键:一个从未亲眼看自己的技能触发过的作者,什么都还没有验证过。
10. find-skills and the Discovery Problem / find-skills 与发现难题
As skill libraries grow across a team or an organisation, the problem shifts from authoring to discovery. The question stops being “how do I write a skill” and becomes “how does anyone find the skill that already exists, given that I do not know it exists and neither does the agent”. Discovery tools address this by indexing available skills and letting an agent query the index before deciding to work from scratch.
随着技能库在团队或组织内不断增长,问题就从「创作」转向了「发现」。问题不再是「怎么写一个技能」,而变成「既然我不知道那个技能存在、Agent 也不知道,它怎么才能被找到」。发现类工具正是解决这个问题的:它们为可用技能建立索引,让 Agent 在决定从零开始之前可以先查询索引。
This is a real capability and it changes behaviour in a measurable way. An agent that can search a skill index will find your obscure skill covering an internal deployment quirk instead of improvising. The value is proportional to the size of the library: with five skills, discovery is trivial; with two hundred, indexed discovery is the difference between reuse and reinvention. Our OpenSpace complete guide on skill management covers this layer in more depth, including how retrieved skills get evaluated and shared back into the loop.
这是一项真实的能力,而且它会可测量地改变行为。一个能搜索技能索引的 Agent,会找到你那份覆盖内部部署怪癖的冷门技能,而不是临场发挥。它的价值与库的大小成正比:五个技能时,发现是 trivial 的;两百个技能时,索引式发现就是复用与重复造轮子之间的分界线。
The limitation is that the index is only as good as the descriptions it contains. If the skill descriptions in your library are weak, discovery inherits the weakness — the search returns nothing useful because the entries have no usable trigger vocabulary. Fixing discovery in a library with bad descriptions produces a faster route to the same dead end. This is why section four, which looks like a small copywriting exercise, is actually the highest-leverage change most teams can make to their skill library.
局限在于,索引的质量完全取决于它所包含的描述。如果你的技能库里的描述很弱,发现能力就会继承这份弱——搜索返回不了有用的结果,因为条目里没有可用的触发词汇。在一个描述糟糕的库里提升发现能力,只是让你更快地撞到同一堵墙。这正是第四节——看起来像个小文案练习——实际上是大多数团队能为技能库做的最高杠杆改动的原因。
Second limitation: discovery widens the attack surface. If an agent can query an index of skills from many sources, then any skill in that index can be selected. That makes the index an input to the trust boundary, and it is why section fourteen treats third-party skills as a supply chain concern rather than a convenience feature.
第二个局限:发现机制扩大了攻击面。如果 Agent 可以查询来自多个来源的技能索引,那么该索引中的任何技能都可能被选中。这使得索引成为信任边界的一部分,这也是第十四节把第三方技能当作供应链问题(而不是便利功能)来对待的原因。
The practical recommendation is to keep an inventory of your skills with a human-readable one-line description each, independent of whether an agent can search them. That inventory is what stops the team from writing the same skill four times, and it is cheap to maintain. Automated discovery helps the agent; the inventory helps the humans, and the humans are the ones who decide what goes in the index.
实用建议是:维护一份技能清单,每个技能配一句人类可读的单行描述,与 Agent 能否搜索到无关。这份清单能阻止团队把同一个技能写四遍,而且维护成本很低。自动化发现帮的是 Agent,而这份清单帮的是人——而决定哪些技能进入索引的,正是人。
11. Testing That a Skill Actually Fires / 测试技能是否真的会触发
A skill is only worth what it does when it fires, and the surprising part is that testing a skill for firing is much easier than testing software. You do not need assertions. You need a set of prompts and an observation of what the agent did. The technique that works: prepare five phrasings of a request the skill should handle, phrased the way different people would actually phrase it, and five near-misses it should not handle. Then run them and record which skill the agent loaded.
一个技能只有在触发时才具备其应有价值,而令人意外的是,测试一个技能是否会触发,比测试软件要容易得多。你不需要断言,你需要一组提示和一次对 Agent 行为的观察。有效的做法是:准备五条对该技能应当处理的请求的表述,用不同人实际会用的方式表达,再准备五条不应处理的近似请求。然后跑一遍,记录 Agent 加载了哪个技能。
The most valuable version of this test uses a different phrasings of the same underlying task, deliberately including the informal version. “Please run the nightly load” and “the ETL job failed again, can you look” and “why is last night’s data missing” are one task with three surfaces, and a skill description that only matches the first surface is not done. Real users do not read your skill catalogue and align their phrasing to it.
这个测试最有价值的版本,是用同一个底层任务的不同表述——并且刻意包含非正式的说法。「请运行夜间加载」「ETL 作业又失败了,能看一下吗」「为什么昨晚的数据不见了」是同一个任务的三种面貌,而一个只匹配第一种面貌的技能描述还不能算完成。真实用户不会去读你的技能目录然后对齐自己的措辞。
The second version of the test checks the negative cases, and this is where most libraries fail. If a skill that covers “migrating the schema” also fires on “write me a SQL query to count rows”, the agent is spending context on a file it does not need, and worse, it may follow that skill’s procedure when answering a question that has nothing to do with it. Negative-case failures are usually caused by an over-broad description, and they are usually invisible in normal use because the outcome still looks reasonable.
这个测试的第二个版本是检查否定用例,而大多数技能库就败在这里。如果一个覆盖「迁移 schema」的技能,同时也对「帮我写个 SQL 查询统计行数」触发,那么 Agent 会把上下文浪费在一个并不需要的文件上;更糟的是,它可能用那个技能的流程去回答一个与之毫无关系的问题。否定用例的失败通常由描述过于宽泛引起,而且在正常使用中往往看不出来,因为结果看起来仍然合理。
Third, test the transition case: a request where the skill and no-skill behaviours differ only slightly. A skill that says “when writing a migration, always add a down migration” is valuable precisely in the case where the agent would otherwise have skipped it. These are the cases that separate a working skill from a decorative one, and they are the ones worth putting into a regression suite that runs on every change to the library.
第三,测试临界场景:技能行为与无技能行为仅略有差异的请求。写着「写迁移时总要加上向下迁移」的技能,价值恰恰体现在 Agent 本来可能会跳过的那些情况里。这类场景才是区分「能用的技能」和「装饰性技能」的关键,值得放进一个随技能库每次变更而运行的回归套件。
Keep these prompts in version control next to the skill. The moment a skill changes, the prompts should be re-run, because a description edit that fixes one trigger phrase can easily break another. This is a genuinely light-weight CI check — a handful of prompts and a grep for the skill name — and it is the difference between a skill library that keeps working and one that silently degrades over six months.
把这些提示和技能一起纳入版本控制。技能一变更,提示就应当重跑,因为一次修复某个触发短语的描述改动,很容易弄坏另一个。这确实是一个极轻量的 CI 检查——几条提示加一次对技能名的 grep——而它正是「技能库能持续正常工作」与「在半年里无声退化」之间的分界线。
12. Versioning and Maintaining Skills Across a Team / 团队内技能的版本管理与维护
Skills are code. They contain procedures, commands, and assumptions about how a system behaves, and they break when the system changes without the skill being updated. A skill that references a command whose flags were renamed last quarter will keep instructing the agent to run a flag that no longer exists, and it will fail in a way that looks like the agent’s fault rather than the skill’s.
技能就是代码。它们包含流程、命令,以及关于系统行为的假设;而当系统变了、技能没跟上时,技能就会坏掉。一个引用了上个季度被改过参数名的命令的技能,会继续指示 Agent 去运行一个已不存在的参数,而且失败方式看起来像是 Agent 的问题,而不是技能的问题。
Put project skills in the repository, under a directory the agent actually loads, and treat changes to them like any other code change: pull request, review, and a note in the changelog when the behaviour changes. The review is not ceremony here, because the failure mode is invisible to the person who wrote the skill — only a second reader notices that step 4 refers to a script that no longer exists.
把项目级技能放进仓库,放在 Agent 确实会加载的目录下,并把对它们的改动当作任何其他代码改动对待:走 pull request、要评审、行为变化时在变更日志里记一笔。这里的评审不是走过场,因为这种失败模式对技能作者本人是不可见的——只有第二双眼睛才会注意到第 4 步引用了一个已经不存在的脚本。
Give skills the same ownership rules as the code they describe. If the CI pipeline lives with the platform team, the deploy skill lives with the platform team. Skills that outlive their owners are the most common source of stale procedures, and the fix is an explicit ownership statement in the skill’s metadata rather than a hope that whoever needs it will update it.
让技能与它们所描述的代码遵循同样的归属规则。如果 CI 流水线归平台团队管,那么部署技能就归平台团队管。活得比主人久的技能,是陈旧流程最常见的来源,而解法是在技能元数据里写明归属,而不是指望谁需要用的时候顺手更新。
Version the behaviour, not just the file. A skill can change in a way that is invisible in the diff but obvious in use: tightening a description changes which requests trigger it; changing a script’s output format changes how the agent should report it. When that happens, bump a version field and note the behavioural change, because the debugging question “why did the agent stop using this skill” is otherwise answered only by git archaeology.
要给「行为」做版本,而不只是给文件做版本。技能可能以一种在 diff 里看不出来、但在使用中很明显的方式发生变化:收紧描述会改变哪些请求会触发;改变脚本的输出格式会改变 Agent 应该如何汇报。这类情况下应当提升版本号字段并记录行为变更,否则「Agent 为什么不再用这个技能」这个排查问题,只能靠翻 git 历史来回答。
Retire skills deliberately. When a procedure stops being the team’s practice, the skill should be deleted rather than left in place with a deprecation note. A stale skill that is still loadable is a trap, because nothing tells the agent it is out of date. Deleting it is a one-line commit, and the alternative is a slow leak of wrong behaviour that nobody can attribute.
要有意识地淘汰技能。当一个流程不再是团队的实际做法时,应当删除这个技能,而不是留着并加一条弃用说明。仍然可被加载的陈旧技能是个陷阱,因为没有任何机制会告诉 Agent 它已经过期。删除它只是一次一行的提交,而另一种选择是一种缓慢渗漏的错误行为,且无人能追溯归因。
13. MCP vs Skills: Which Layer Does What / MCP vs 技能:各自负责哪一层
Skills and MCP servers are both often called “extending an agent”, and confusing the two is a common architectural mistake. They operate at different layers and solve different problems. MCP provides capability: a protocol that connects an agent to external systems and exposes tools and resources that the agent can call. Skills provide judgment: instructions that tell the agent how to use those capabilities well, including which ones, in what order, and with what caveats.
技能和 MCP server 都被称作「扩展 Agent」,混淆两者是常见的架构错误。它们工作在不同的层、解决不同的问题。MCP 提供能力:一个把 Agent 连接到外部系统、暴露可调用工具与资源的协议。技能提供判断:告诉 Agent 如何把这些能力用好——用哪些、按什么顺序用、有什么注意事项。
The clean mental model is: MCP is the API, skills are the usage guide for that API. If you only have MCP servers, the agent can technically perform every operation but has to work out the procedure each time, which means it improvises and is inconsistent. If you only have skills, the agent has excellent guidance about steps that reference tools it does not have, which is the “follow these instructions but the tool does not exist” failure.
干净的思维模型是:MCP 是 API,技能是这份 API 的使用指南。如果只有 MCP server,Agent 技术上能执行每个操作,但每次都得自己琢磨流程,这意味着它会临场发挥且不稳定。如果只有技能,Agent 拥有极好的分步指引,却引用着它并不具备的工具——这就是「照着步骤做,但工具不存在」这种失败。
The overlap case is worth naming: a skill that bundles a script which calls an MCP tool. This is legitimate and common, but it creates a dependency chain — the skill needs the script, the script needs the server, the server needs credentials. When the MCP server changes its tool signature, the skill breaks in a way that looks like a skill problem. Our guide on MCP versus function calling for AI agents covers the transport decision in detail, and the same layering applies whether the tool arrives over MCP or as a native function.
重叠的情况值得点明:捆绑了调用 MCP 工具的脚本的技能。这本身合理且很常见,但它制造了一条依赖链——技能需要脚本,脚本需要 server,server 需要凭据。当 MCP server 改了工具签名,技能就会以一种看起来像技能问题的方式坏掉。
There is one more distinction that matters in practice: cost of loading. An MCP server’s tool definitions are usually resident in the agent’s context, because the agent must know what tools exist in order to call them. A skill’s content is loaded on demand. So adding MCP servers has a baseline context cost, while adding skills has a near-zero baseline cost and a per-use cost. That arithmetic is often decisive: a large library of MCP servers is expensive, while a large library of skills is not.
还有一点实践中的区分很关键:加载成本。MCP server 的工具定义通常常驻在 Agent 上下文中,因为 Agent 必须知道存在哪些工具才能调用。而技能的内容是按需加载的。因此,接入 MCP server 有固定的上下文成本,而新增技能的基线成本近乎为零、使用时才付。这笔账往往是决定性的:一个庞大的 MCP server 库成本高昂,而一个庞大的技能库则不然。
Use both, with the split clean: MCP for what the agent can do, skills for how your team does it. If you find yourself writing a skill that mostly documents a tool’s parameters, it probably should have been the tool’s own schema description. If you find yourself writing an MCP server that contains process opinions, it probably should have been a skill.
两者都用,但切分要干净:MCP 负责 Agent「能做什么」,技能负责「你们团队怎么做」。如果你发现自己在写的技能大部分是在描述工具的参数,那它大概应该并入工具自身的 schema 描述里;如果你发现自己在写的 MCP server 里包含了流程性的主观判断,那它大概应该是一个技能。
14. Skill Supply Chain Security / 技能供应链安全
A skill is executable content that an agent will follow, and in the common skill marketplace model, that content comes from strangers. This is the same trust problem that package managers solved decades ago, and the same answer applies: do not install what you have not reviewed, and understand what you are actually granting when you install.
技能是 Agent 会照着执行的可执行内容,而在常见的技能市场模型里,这些内容来自陌生人。这与包管理器几十年前解决的信任问题完全一样,答案也一样:不要安装你没审阅过的东西,并且要弄清楚安装时你实际授予了什么权限。
The permissions are the risk. A skill can instruct the agent to run shell commands, read files outside the project, make network requests, or write to specific paths. Installing a third-party skill effectively grants that behaviour. The narrow allowed-tools list from section six is the primary control, and it is why it matters that a skill’s tool restrictions are reviewed rather than accepted by default from the marketplace.
权限就是风险所在。技能可以指示 Agent 运行 shell 命令、读取项目之外的文件、发起网络请求,或写入特定路径。安装一个第三方技能,实质上就授予了这些行为。第六节讲的那份狭窄 allowed-tools 列表是首要控制手段,这也正是为什么技能的工具限制应当经过评审,而不是从市场里默认接受。
The second risk is subtler and, in my view, more dangerous: a skill can be technically harmless and still harmful, because its instructions are what the agent treats as guidance. A skill that instructs an agent to always deploy without asking, or to prefer a specific vendor in its output, or to omit caveats from a security review, does not need to execute anything to cause damage. It just needs to be loaded. This is the argument for reviewing the prose, not only the scripts.
第二种风险更微妙,在我看来也更危险:一个技能可以在技术上完全无害,却依然有害——因为它的指令正是 Agent 当作行动依据的东西。一个指示 Agent「总是部署而不询问」、或「在输出中偏向某个特定厂商」、或「在安全审查中省略注意事项」的技能,不需要执行任何东西就能造成伤害,它只需要被加载。这就是为什么必须审阅文字,而不只是审阅脚本。
Concrete mitigations, roughly in order of effort. Review the full text of any skill before installing it, including the description. Prefer skills with an explicit source and a version history over anonymous ones. Run new skills in a sandboxed environment the first time, with a throwaway repository and no production credentials. Restrict allowed-tools on install rather than inheriting the author’s list. And keep a human in the loop for anything irreversible — a skill that can deploy, delete, or send should always have a confirmation step that a human satisfies.
具体的缓解措施,按投入从低到高排列:安装前审阅技能的完整文本,包括描述部分;优先选择有明确来源和版本历史的技能,而非匿名的;首次运行时把新技能放在沙箱环境里,配一个一次性仓库、不给生产凭据;安装时收紧 allowed-tools,而不是继承作者的列表;并且对任何不可逆操作保留人工环节——一个能部署、能删除、能发送的技能,应当始终有一个人来确认的步骤。
There is a parallel here with the red-teaming and security-testing tooling we covered elsewhere on this site: the same ideas of narrowing the blast radius, of testing before trusting, and of having a measurable rubric apply to skills as much as they apply to models. Our guide to LLM security testing goes deeper on the evaluation rubric side if you want the underlying methodology.
这与我们站上另外讨论过的红队与安全测试工具有平行之处:收窄爆炸半径、信任之前先测试、以及拥有一套可衡量的评分标准——这些理念对技能和对模型同样适用。
15. A 90-Day Rollout for Skills in an Engineering Org / 工程团队技能落地 90 天路线图
Days one through twenty are inventory and audit. Find every skill that exists, including the ones nobody remembers writing. For each one, record its description, its trigger prompts, its owner, and whether anyone has watched it fire. You will usually find that the majority have never been verified, and that two or three of them overlap badly. Do not delete anything yet — just build the picture, because the picture is what makes every later decision cheaper.
第 1 到 20 天用于盘点和审计。找出所有存在的技能,包括那些没人记得自己写过的。对每一个,记录它的描述、它的触发提示、它的归属人,以及是否有人亲眼看它触发过。你通常会发现大多数从未被验证过,并且其中有两三个重叠得厉害。先不要删任何东西——先把全局图画出来,因为这张图会让后面每个决定都更省事。
Days twenty-one through forty are the highest-leverage fix: rewriting descriptions across the library so that each one names a situation and includes an exclusion. This is the change that most directly affects whether skills fire, and it is also the change that is easiest to defer indefinitely because nothing breaks when you skip it. Budget a fixed number of skills per day and hold the line. If you have fifty skills, this is five weeks of short focused sessions, and it is worth more than any new skill you could write in the same time.
第 21 到 40 天是最高杠杆的修复:重写整个技能库的描述,让每一条都点明情境并包含一条排除。这是最直接影响技能能否触发的改动,也是最容易无限期推迟的改动——因为跳过它不会坏掉任何东西。请为每天设定一个固定的技能数量并坚守。如果有五十个技能,这就是五周短而专注的时段,而它比你在同样时间里能写出的任何一个新技能都更值钱。
Days forty-one through sixty are testing. For the skills with the highest usage, build the five-should-fire and five-should-not-fire prompt set, run them, and fix the failures. Put these prompts in the repository and wire them into CI as a smoke test. Expect roughly a third of your skills to fail the negative cases on the first run, which is normal and also the clearest possible evidence that the exercise was worth doing.
第 41 到 60 天是测试。为使用率最高的技能构建「五个应触发 + 五个不应触发」的提示集,跑一遍,修掉失败项。把这些提示放进仓库并接入 CI 作为冒烟测试。预计大约三分之一的技能会在第一次跑时未通过否定用例——这很正常,同时也是这项工作值得做的最清晰证据。
Days sixty-one through eighty are governance. Assign explicit owners, put project skills in the repository with review requirements, decide the install policy for third-party skills, and write down the allowed-tools policy. This is the phase where a skill library stops being a pile of files that individuals happened to write and becomes something the organisation can rely on. It is also the phase most likely to be skipped, because nothing breaks if you skip it — until the incident.
第 61 到 80 天是治理。指定明确的归属人,把项目级技能放进仓库并纳入评审要求,确定第三方技能的安装政策,并写下 allowed-tools 政策。这一阶段让技能库从「碰巧由个人写出来的一堆文件」变成组织可以依赖的东西。这也是最容易被跳过的一阶段,因为跳过不会坏掉任何东西——直到出事为止。
Days eighty-one through ninety are expansion, and the question at this point is which skill to write next. The answer is not “the one that would be most impressive” but “the one that the team keeps doing manually and inconsistently”. The best first skills to author are the ones where a wrong result is visible and cheap to check — a release checklist, a database migration procedure, a log triage routine — because those give you a fast feedback loop on whether the skill is helping. If you are weighing a broader agent foundation underneath all this, our agent deployment platform guide covers where the runtime layer fits relative to the skill layer.
第 81 到 90 天是扩张,而此时的问题是要写下一个技能。答案不是「哪个看起来最漂亮」,而是「团队一直在手工做、且做得不一致的那件事」。最值得先写的技能,是那些结果出错时既显眼又容易检查的——发布检查清单、数据库迁移流程、日志排查套路——因为它们能给你一个关于技能是否有效的快速反馈回路。
By day ninety, the useful metric is not the number of skills. It is the ratio of skills that fire when they should and stay quiet when they should not. Everything else — the count, the catalogue size, the marketplace installs — is a proxy for that ratio, and a much worse one.
到第 90 天,真正有用的指标不是技能的数量,而是「该触发时触发、不该触发时安静」的技能比例。其他一切——数量、目录规模、市场安装量——都只是这个比例的代理变量,而且是一个差得多的代理变量。
EN: What exactly is an agent skill?
CN: Agent 技能到底是什么?
A directory containing a markdown file with frontmatter that an agent reads on demand. The frontmatter describes when the skill applies; the body carries the instructions. The agent only loads the body after deciding the skill is relevant, which is what keeps the context cost low.
一个包含 markdown 文件(带 frontmatter)的目录,Agent 按需读取。frontmatter 说明这个技能何时适用,正文承载指令。Agent 只有在判定技能相关之后才加载正文,这正是上下文成本保持低位的原因。
EN: Why does my skill never get used even though the instructions are correct?
CN: 为什么我的技能指令完全正确,却从来不被使用?
Because selection happens on the description, not the body. If the description summarises the skill instead of naming the situation that triggers it, the agent has no way to match it to a request. Rewrite the description as “use when…”, list the phrasings real users use, and state what the skill does not cover.
因为筛选依据的是描述,而不是正文。如果描述是在总结这个技能,而不是指出触发它的情境,Agent 就没办法把它和请求匹配上。把描述改写成「在……时使用」,列出真实用户会用的说法,并写明这个技能不覆盖什么。
EN: Should I use a skill or an MCP server for this?
CN: 这个需求我该用技能还是 MCP server?
Use MCP for capability the agent does not have — reading a database, calling an API, querying a tracker. Use a skill for judgment: the sequence, the caveats, the traps. If the agent needs a new tool to reach a system, that is MCP. If the agent can already reach the system but does the task differently every time, that is a skill.
用 MCP 提供 Agent 不具备的能力——读数据库、调 API、查任务系统。用技能承载判断:顺序、注意事项、坑。如果 Agent 需要一个新工具才能触达某个系统,那是 MCP;如果 Agent 本来就能触达,却每次做法都不一样,那就是技能。
EN: How do I know a skill is actually being triggered?
CN: 我怎么知道技能到底有没有被触发?
Write five prompts that should trigger it, phrased five different ways including one informal one, plus five near-misses that should not. Run them and observe which skill the agent loaded. The negative cases are the ones that usually fail, because an over-broad description quietly selects on requests it should ignore.
写五条应当触发的提示,用五种不同说法、其中包括一条非正式的,再写五条不应触发的近似请求。跑一遍,观察 Agent 加载了哪个技能。通常失败的是否定用例,因为过于宽泛的描述会悄悄选中那些本该忽略的请求。
EN: Are third-party skills safe to install?
CN: 第三方技能安装安全吗?
Treat them like any other third-party code and review the full text before installing, including the description and any bundled scripts. Narrow the allowed-tools list yourself rather than inheriting the author’s. A skill that can deploy, delete or send should always require a human confirmation, and a technically harmless skill can still be harmful through the behaviour it instructs.
要像对待任何第三方代码那样对待它们:安装前审阅完整文本,包括描述和任何打包脚本。自己收窄 allowed-tools 列表,而不是继承作者的。能部署、能删除、能发送的技能,应当始终要求人工确认;而一个技术上无害的技能,仍可能通过它所指示的行为造成伤害。
EN: How many skills does a team actually need?
CN: 一个团队到底需要多少个技能?
Fewer than you think, and each one narrower than you expect. One skill per job, with a description that names a specific situation, beats a comprehensive skill every time. If a title needs an “and” in it, split it. And measure success by the ratio of skills that fire when they should and stay quiet when they should not — not by catalogue size.
比你以为的要少,而且每一个都比预期更狭窄。一次只做一件事、描述里点明具体情境的技能,永远胜过一个综合大技能。如果标题里需要出现「和」,就拆开。衡量成功的指标是「该触发时触发、不该触发时安静」的技能比例,而不是目录规模。
Frequently Asked Questions / 常见问题
EN: How do I know whether my agent skill is being triggered at all?
The reliable method is a trigger test, not a read-through. Take ten real requests that the skill should handle and ten near-misses that it should not, run them through your agent with a fresh session each time, and count how often the skill file was actually opened. If it fires on fewer than seven of the ten true positives, the description line is the problem — the model never gets far enough to judge the instructions. If it fires on the near-misses too, the description is too broad.
CN: 我怎么知道 Agent 技能到底有没有被触发?
可靠的方法是触发测试,而不是通读检查。取十条这个技能本该处理的真实请求,再取十条不该处理的近似请求,每次都用全新会话跑一遍,统计技能文件到底被打开了几次。如果十条真实请求里触发不足七次,问题出在描述行——模型根本没走到判断指令那一步;如果近似请求也触发了,说明描述写得过于宽泛。
EN: How long should a SKILL.md be?
Short enough that the model finishes reading it before it starts working. In practice that means the frontmatter plus the trigger and workflow sections stay under roughly five hundred lines, and anything longer — reference tables, API details, troubleshooting matrices — moves into separate reference files that the skill points to and the agent loads only when it needs them. That progressive disclosure structure is what keeps large skill libraries inside the context budget.
CN: 一个 SKILL.md 应该写多长?
要短到模型在工作开始之前就能读完。实践上,frontmatter 加触发条件与工作流部分应控制在五百行以内;更长的内容——参考表、API 细节、排错矩阵——应拆到单独的参考文件里,由技能指路、Agent 需要时再加载。这种渐进式披露结构,是大型技能库能控制在上下文预算内的关键。
EN: Should skills and MCP servers both handle the same capability?
No. MCP is a connectivity layer: it exposes tools, resources and data to the agent across process and vendor boundaries. Skills are an instruction layer: they encode procedure, judgment and format so the agent does the task your way. A capability usually needs both, but they are not substitutes. If you find yourself writing an MCP tool whose description is three paragraphs long, that procedure belongs in a skill; if you find yourself writing a skill that lists a dozen API calls by hand, that connectivity belongs in an MCP server.
CN: 技能和 MCP Server 应该是同一层吗?
不是。MCP 是连接层:跨进程、跨厂商地把工具、资源和数据暴露给 Agent。技能是指令层:把流程、判断和格式编码进去,让 Agent 按你的方式做任务。一个能力通常两者都需要,但它们不是替代关系。如果你发现自己在给一个 MCP 工具写三段长的描述,那段流程应该放进技能;如果你发现自己在手写技能里罗列十几个 API 调用,那层连接应该交给 MCP Server。
EN: How do I keep a shared skill library from drifting?
Treat skill behaviour as the versioned artifact, not just the file. A tightened description changes which requests trigger the skill; a changed script output format changes how the agent reports back. Neither shows up in a code diff, so record behavioural changes explicitly, bump a version field, and keep a short changelog next to the skill. For team-wide libraries, run the same trigger test suite in CI so a change that breaks triggering fails the build instead of quietly reaching production.
CN: 共享技能库怎么防止逐渐跑偏?
要把「技能行为」当成被版本化的产物,而不只是文件本身。收紧描述会改变哪些请求会触发它;改了脚本输出格式会改变 Agent 该怎么汇报。这些变化在代码 diff 里都看不出来,所以要显式记录行为变更、升级版本号字段,并在技能旁边放一份简短变更日志。团队级技能库应该在 CI 里跑同一套触发测试,让破坏触发的改动直接失败,而不是悄悄进到线上。
🏷️ Tags: AI agent skills, agent skills, SKILL.md, skill creator, find skills, Claude Code skills, AI agent development, prompt engineering for agents, MCP vs skills, AI agent tools 2026, agent skills guide, agent skill security, progressive disclosure, AI workflow automation, AI skills best practices
🏷️ Tags: AI Agent技能, 智能体技能, SKILL.md, skill-creator, 技能发现, Claude Code技能, AI智能体开发, 智能体提示词工程, MCP对比技能, 2026 AI Agent工具, Agent技能指南, 技能安全, 渐进式披露, AI工作流自动化, AI技能最佳实践
📰 Category: Best Practices (Category ID: 9)
📰 分类:最佳实践(Category ID: 9)
📬 Your AI toolbox, every Monday at 9am
Battle-tested prompt templates, copy-and-paste ready
Join 1,200+ super-solo operators making money with AI
🔒 Unsubscribe anytime · No ads · Pure value · Delivered Mondays 9am
📬 下周一早上 9 点,你的 AI 工具箱
每个提示词模板都经过实测验证,复制即用
已有 1,200+ 超级个体正在用 AI 搞钱
🔒 随时退订 · 绝无广告 · 只发价值 · 下周一早 9 点送达