用 Agent Skills 为现实世界装备智能体
Equipping agents for the real world with Agent Skills
段落导航
Update: We've published Agent Skills as an open standard for cross-platform portability.
更新:我们已将 Agent Skills 发布为开放标准,以实现跨平台可移植性。
(December 18, 2025)
(2025 年 12 月 18 日)
As model capabilities improve, we can now build general-purpose agents that interact with full-fledged computing environments.
随着模型能力提升,我们现在可以构建与完整计算环境交互的通用智能体(agent)。
Claude Code, for example, can accomplish complex tasks across domains using local code execution and filesystems.
例如,Claude Code 可以利用本地代码执行和文件系统跨领域完成复杂任务。
But as these agents become more powerful, we need more composable, scalable, and portable ways to equip them with domain-specific expertise.
但随着这些智能体变得更强大,我们需要更可组合、可扩展且可移植的方式,来为它们配备领域特定的专业知识。
This led us to create Agent Skills: organized folders of instructions, scripts, and resources that agents can discover and load dynamically to perform better at specific tasks.
这促使我们创建了 Agent Skills:组织有序的指令、脚本和资源文件夹,智能体可以发现并动态加载它们,以便在特定任务上表现更好。
Skills extend Claude’s capabilities by packaging your expertise into composable resources for Claude, transforming general-purpose agents into specialized agents that fit your needs.
Skills 将你的专业知识打包成可供 Claude 使用的可组合资源,从而扩展 Claude 的能力,把通用智能体转变为满足你需求的专用智能体。
Building a skill for an agent is like putting together an onboarding guide for a new hire.
为智能体构建技能就像为新员工整理一份入职指南。
Instead of building fragmented, custom-designed agents for each use case, anyone can now specialize their agents with composable capabilities by capturing and sharing their procedural knowledge.
现在,任何人都可以通过捕获并分享自己的程序性知识,用可组合的能力让智能体专业化,而不必为每个用例构建零散、定制设计的智能体。
In this article, we explain what Skills are, show how they work, and share best practices for building your own.
在本文中,我们解释 Skills 是什么,展示它们如何运作,并分享构建你自己的技能的最佳实践。

A skill is a directory containing a SKILL.md file that contains organized folders of instructions, scripts, and resources that give agents additional capabilities.
一个技能是一个目录,其中包含一个 SKILL.md 文件,以及组织有序的指令、脚本和资源文件夹,这些为智能体提供额外能力。
To see Skills in action, let’s walk through a real example: one of the skills that powers Claude’s recently launched document editing abilities.
要了解 Skills 的实际应用,我们来看一个真实示例:Claude 最近推出的文档编辑能力背后的技能之一。
Claude already knows a lot about understanding PDFs, but is limited in its ability to manipulate them directly (e.g. to fill out a form).
Claude 已经非常擅长理解 PDF,但直接操作它们(例如填写表单)的能力有限。
This PDF skill lets us give Claude these new abilities.
这个 PDF 技能让我们能够赋予 Claude 这些新能力。
At its simplest, a skill is a directory that contains a SKILL.md file.
最简单的形式是,技能(skill)就是一个包含 SKILL.md file 的目录。
This file must start with YAML frontmatter that contains some required metadata: name and description.
该文件必须以 YAML frontmatter 开头,其中包含一些必需的元数据:name 和 description。
At startup, the agent pre-loads the name and description of every installed skill into its system prompt.
在启动时,智能体会将每个已安装技能的 name 和 description 预加载到其系统提示词(system prompt)中。
This metadata is the first level of progressive disclosure: it provides just enough information for Claude to know when each skill should be used without loading all of it into context.
这些元数据是渐进式披露(progressive disclosure)的第一层:它提供刚好足够的信息,让 Claude 知道每个技能应在何时使用,而无需将全部内容加载到上下文中。
The actual body of this file is the second level of detail.
该文件的实际正文是第二层细节。
If Claude thinks the skill is relevant to the current task, it will load the skill by reading its full SKILL.md into context.
如果 Claude 认为该技能与当前任务相关,它就会通过将完整的 SKILL.md 读入上下文来加载该技能。

A SKILL.md file must begin with YAML Frontmatter that contains a file name and description, which is loaded into its system prompt at startup.
SKILL.md 文件必须以 YAML Frontmatter 开头,其中包含文件名和描述,这些内容会在启动时加载到其系统提示词中。
As skills grow in complexity, they may contain too much context to fit into a single SKILL.md, or context that’s relevant only in specific scenarios.
随着技能变得越来越复杂,它们可能包含太多上下文,无法塞进单个 SKILL.md,或者包含只在特定场景下才相关的上下文。
In these cases, skills can bundle additional files within the skill directory and reference them by name from SKILL.md.
在这些情况下,技能可以在技能目录中捆绑额外文件,并从 SKILL.md 中按名称引用它们。
These additional linked files are the third level (and beyond) of detail, which Claude can choose to navigate and discover only as needed.
这些额外链接的文件是第三层(以及更外层)细节,Claude 可以只在需要时选择浏览和发现它们。
In the PDF skill shown below, the SKILL.md refers to two additional files (reference.md and forms.md) that the skill author chooses to bundle alongside the core SKILL.md.
在下面展示的 PDF 技能中,SKILL.md 引用了两个额外文件(reference.md 和 forms.md),这是技能作者选择与核心 SKILL.md 一起捆绑的。
By moving the form-filling instructions to a separate file (forms.md), the skill author is able to keep the core of the skill lean, trusting that Claude will read forms.md only when filling out a form.
通过将填写表单的说明移到一个单独文件(forms.md)中,技能作者能够让技能核心保持精简,并相信 Claude 只会在填写表单时读取 forms.md。

You can incorporate more context (via additional files) into your skill that can then be triggered by Claude based on the system prompt.
你可以(通过额外文件)将更多上下文纳入你的技能,这些上下文随后可以由 Claude 根据系统提示词触发。
Progressive disclosure is the core design principle that makes Agent Skills flexible and scalable.
渐进式披露是使 Agent Skills 灵活且可扩展的核心设计原则。
Like a well-organized manual that starts with a table of contents, then specific chapters, and finally a detailed appendix, skills let Claude load information only as needed:
就像一本组织良好的手册,从目录开始,然后是具体章节,最后是详细附录,技能让 Claude 只按需加载信息:

Agents with a filesystem and code execution tools don’t need to read the entirety of a skill into their context window when working on a particular task.
拥有文件系统和代码执行工具的智能体在处理特定任务时,不需要将整个技能读入其上下文窗口。
This means that the amount of context that can be bundled into a skill is effectively unbounded.
这意味着可以打包进一个技能的上下文量实际上是无限的。
The following diagram shows how the context window changes when a skill is triggered by a user’s message.
下图展示了当技能被用户消息触发时,上下文窗口如何变化。

Skills are triggered in the context window via your system prompt.
技能通过你的系统提示词在上下文窗口中被触发。
The sequence of operations shown:
所示操作序列:
To start, the context window has the core system prompt and the metadata for each of the installed skills, along with the user’s initial message;
开始时,上下文窗口包含核心系统提示词、每个已安装技能的元数据,以及用户的初始消息;
Claude triggers the PDF skill by invoking a Bash tool to read the contents of pdf/SKILL.md;
Claude 通过调用 Bash 工具读取 pdf/SKILL.md 的内容来触发 PDF 技能;
Claude chooses to read the forms.md file bundled with the skill;
Claude 选择读取该技能附带的 forms.md 文件;
Finally, Claude proceeds with the user’s task now that it has loaded relevant instructions from the PDF skill.
最后,既然 Claude 已从 PDF 技能中加载了相关指令,它便继续执行用户的任务。
Skills can also include code for Claude to execute as tools at its discretion.
技能还可以包含代码,供 Claude 自行决定作为工具执行。
Large language models excel at many tasks, but certain operations are better suited for traditional code execution.
大语言模型(LLM)擅长许多任务,但某些操作更适合用传统代码执行。
For example, sorting a list via token generation is far more expensive than simply running a sorting algorithm.
例如,通过 token 生成来对列表排序,远比直接运行一个排序算法昂贵得多。
Beyond efficiency concerns, many applications require the deterministic reliability that only code can provide.
除了效率方面的考量之外,许多应用还需要只有代码才能提供的确定性可靠性。
In our example, the PDF skill includes a pre-written Python script that reads a PDF and extracts all form fields.
在我们的示例中,PDF 技能包含一个预编写的 Python 脚本,该脚本读取 PDF 并提取所有表单字段。
Claude can run this script without loading either the script or the PDF into context.
Claude 可以运行此脚本,而无需将脚本或 PDF 加载到上下文窗口。
And because code is deterministic, this workflow is consistent and repeatable.
而且由于代码具有确定性,这一工作流是一致且可重复的。

Skills can also include code for Claude to execute as tools at its discretion based on the nature of the task.
技能也可以包含代码,供 Claude 根据任务性质自行决定作为工具执行。
Here are some helpful guidelines for getting started with authoring and testing skills:
以下是一些有助于开始编写和测试技能的实用指南:
Start with evaluation: Identify specific gaps in your agents’ capabilities by running them on representative tasks and observing where they struggle or require additional context.
从评测(eval)开始:让智能体运行代表性任务,观察它们在哪些地方遇到困难或需要额外上下文(context),从而识别其能力中的具体缺口。
Then build skills incrementally to address these shortcomings.
然后逐步构建技能,以弥补这些不足。
Structure for scale: When the SKILL.md file becomes unwieldy, split its content into separate files and reference them.
为规模化而组织:当 SKILL.md 文件变得臃肿时,将其内容拆分到单独的文件中并引用它们。
If certain contexts are mutually exclusive or rarely used together, keeping the paths separate will reduce the token usage.
如果某些上下文互斥或很少一起使用,保持路径独立将减少 token 用量。
Finally, code can serve as both executable tools and as documentation.
最后,代码既可以作为可执行工具,也可以作为文档。
It should be clear whether Claude should run scripts directly or read them into context as reference.
应当明确 Claude 是应直接运行脚本,还是将脚本读入上下文作为参考。
Think from Claude’s perspective: Monitor how Claude uses your skill in real scenarios and iterate based on observations: watch for unexpected trajectories or overreliance on certain contexts.
从 Claude 的视角思考:观察 Claude 在真实场景中如何使用你的技能,并根据观察结果迭代:留意意外的轨迹或对某些上下文的过度依赖。
Pay special attention to the name and description of your skill.
特别关注你的技能的 name 和 description。
Claude will use these when deciding whether to trigger the skill in response to its current task.
Claude 在决定是否针对当前任务触发该技能时会使用这些内容。
Iterate with Claude: As you work on a task with Claude, ask Claude to capture its successful approaches and common mistakes into reusable context and code within a skill.
与 Claude 一起迭代:当你与 Claude 合作处理任务时,让 Claude 将其成功方法和常见错误捕获为技能中可复用的上下文和代码。
If it goes off track when using a skill to complete a task, ask it to self-reflect on what went wrong.
如果它在使用技能完成任务时偏离轨道,让它自我反思哪里出了问题。
This process will help you discover what context Claude actually needs, instead of trying to anticipate it upfront.
这个过程将帮助你发现 Claude 实际需要什么上下文,而不是试图预先推测。
Skills provide Claude with new capabilities through instructions and code.
Skill 通过指令和代码为 Claude 提供新的能力。
While this makes them powerful, it also means that malicious skills may introduce vulnerabilities in the environment where they’re used or direct Claude to exfiltrate data and take unintended actions.
这虽然让它们变得强大,但也意味着恶意 Skill 可能在使用它们的环境中引入漏洞,或引导 Claude 泄露数据并执行非预期的操作。
We recommend installing skills only from trusted sources.
我们建议只从可信来源安装 Skill。
When installing a skill from a less-trusted source, thoroughly audit it before use.
当从可信度较低的来源安装 Skill 时,请在使用前对其进行彻底审计。
Start by reading the contents of the files bundled in the skill to understand what it does, paying particular attention to code dependencies and bundled resources like images or scripts.
首先阅读 Skill 中打包的文件内容,了解它的作用,尤其要注意代码依赖以及随附的资源,例如图像或脚本。
Similarly, pay attention to instructions or code within the skill that instruct Claude to connect to potentially untrusted external network sources.
同样,注意 Skill 中指示 Claude 连接可能不可信的外部网络来源的指令或代码。
Agent Skills are supported today across Claude.ai, Claude Code, the Claude Agent SDK, and the Claude Developer Platform.
目前,Claude.ai、Claude Code、Claude Agent SDK 和 Claude Developer Platform 均已支持 Agent Skills。
In the coming weeks, we’ll continue to add features that support the full lifecycle of creating, editing, discovering, sharing, and using Skills.
在接下来的几周里,我们将继续添加功能,以支持创建、编辑、发现、分享和使用 Skill 的完整生命周期。
We’re especially excited about the opportunity for Skills to help organizations and individuals share their context and workflows with Claude.
我们尤其期待 Skill 能够帮助组织和个人与 Claude 分享他们的上下文和工作流。
We’ll also explore how Skills can complement Model Context Protocol (MCP) servers by teaching agents more complex workflows that involve external tools and software.
我们还将探索 Skill 如何补充 Model Context Protocol (MCP) 服务器,方式是教会智能体涉及外部工具和软件的更复杂工作流。
Looking further ahead, we hope to enable agents to create, edit, and evaluate Skills on their own, letting them codify their own patterns of behavior into reusable capabilities.
展望更远的未来,我们希望让智能体能够自行创建、编辑和评测 Skill,从而将它们自己的行为模式固化为可复用的能力。
Skills are a simple concept with a correspondingly simple format.
Skill 是一个简单的概念,其格式也相应地简单。
This simplicity makes it easier for organizations, developers, and end users to build customized agents and give them new capabilities.
这种简单性让组织、开发者和最终用户更容易构建定制化的智能体,并赋予它们新的能力。
We’re excited to see what people build with Skills.
我们很期待看到大家用 Skills 构建出什么。
Get started today by checking out our Skills docs and cookbook.
现在就查看我们的 Skills 文档和 cookbook,开始上手吧。
Written by Barry Zhang, Keith Lazuka, and Mahesh Murag, who all really like folders.
本文由 Barry Zhang、Keith Lazuka 和 Mahesh Murag 撰写,他们三人都非常喜欢文件夹。
Special thanks to the many others across Anthropic who championed, supported, and built Skills.
特别感谢 Anthropic 内部许多其他倡导、支持和构建 Skills 的同事。