Anthropic Engineering 前天 03:40
Agent Skills:为AI代理赋能专业知识
index_new5.html
../../../zaker_core/zaker_tpl_static/wap/tpl_guoji1.html

 

Agent Skills 是一种创新的方式,能够为通用型AI代理提供特定领域的专业知识。通过将指令、脚本和资源组织到可发现和动态加载的文件夹中,Skills 扩展了AI的能力,使其能够更高效地执行特定任务。这种模块化的方法允许任何人捕获和分享他们的程序性知识,将通用代理转化为满足特定需求的专业代理。Skills 的核心是一个SKILL.md文件,包含YAML frontmatter元数据(名称和描述)以及详细指令。当AI认为某个Skill相关时,会加载其全部内容。Skills 还支持引用额外的文件和代码脚本,实现渐进式披露和高效的上下文管理。这种设计原则使得Skills既灵活又可扩展,并能与代码执行工具协同工作,为AI提供更强大、更可靠的能力。

🌟 **模块化专业知识扩展**:Agent Skills 提供了一种将特定领域知识打包成独立模块(文件夹)的方式,使通用AI代理能够按需加载和利用这些专业能力。这就像为AI提供一本本专业手册,让它在面对特定任务时能够调用最相关的知识和工具,从而提升其在特定领域的表现。

📄 **渐进式披露与高效上下文管理**:Skills 的核心是一个SKILL.md文件,其中包含必要的元数据(名称和描述),AI在启动时即可了解所有可用Skills。当AI认为某个Skill相关时,才会加载其完整的SKILL.md文件。如果内容过多,还可以通过引用额外的文件(如reference.md, forms.md)来进一步细分,确保AI只加载最相关的上下文信息,有效管理有限的上下文窗口。

💻 **代码执行与可信赖性**:Skills 不仅包含指令,还可以集成代码脚本,供AI作为工具自行调用执行。这使得AI能够处理那些更适合传统代码执行的任务,例如数据排序、精确计算或需要确定性结果的操作,提高了任务处理的效率和可靠性。

🛠️ **构建与安全考量**:开发Skills时,建议从小处着手,识别AI的现有能力差距,并逐步构建。结构化设计至关重要,将复杂内容拆分成独立文件。从AI的角度思考,密切关注Skills的名称和描述,因为它们是AI决定是否触发Skill的关键。同时,安装Skills时务必谨慎,只从可信来源获取,并仔细审计代码和资源,以防潜在的安全风险。

As model capabilities improve, we can now build general-purpose agents that interact with full-fledged computing environments. Claude Code, for example, can accomplish complex tasks across domains using local code execution and filesystems. 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. 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.

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.

A skill is a directory containing a SKILL.md file that contains organized folders of instructions, scripts, and resources that give agents additional capabilities.

The anatomy of a skill

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. 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). This PDF skill lets us give Claude these new abilities.

At its simplest, a skill is a directory that contains a SKILL.md file. This file must start with YAML frontmatter that contains some required metadata: name and description. At startup, the agent pre-loads the name and description of every installed skill into its 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. 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.

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.

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. In these cases, skills can bundle additional files within the skill directory and reference them by name from 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.

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. 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.

You can incorporate more context (via additional files) into your skill that can then be triggered by Claude based on the system prompt.

Progressive disclosure is the core design principle that makes Agent Skills flexible and scalable. 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:

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.

Skills and the context window

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 chooses to read the forms.md file bundled with the skill;Finally, Claude proceeds with the user’s task now that it has loaded relevant instructions from the PDF skill.

Skills and code execution

Skills can also include code for Claude to execute as tools at its discretion.

Large language models excel at many tasks, but certain operations are better suited for traditional code execution. For example, sorting a list via token generation is far more expensive than simply running a sorting algorithm. 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. Claude can run this script without loading either the script or the PDF into context. 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.

Developing and evaluating skills

Here are some helpful guidelines for getting started with authoring and testing skills:

Security considerations when using Skills

Skills provide Claude with new capabilities through instructions and code. 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.

We recommend installing skills only from trusted sources. When installing a skill from a less-trusted source, thoroughly audit it before use. 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. Similarly, pay attention to instructions or code within the skill that instruct Claude to connect to potentially untrusted external network sources.

The future of Skills

Agent Skills are supported today across Claude.ai, Claude Code, the Claude Agent SDK, and the Claude Developer Platform.

In the coming weeks, we’ll continue to add features that support the full lifecycle of creating, editing, discovering, sharing, and using Skills. We’re especially excited about the opportunity for Skills to help organizations and individuals share their context and workflows with 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.

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.

Skills are a simple concept with a correspondingly simple format. 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. Get started today by checking out our Skills docs and cookbook.

Acknowledgements

Written by Barry Zhang, Keith Lazuka, and Mahesh Murag, who all really like folders. Special thanks to the many others across Anthropic who championed, supported, and built Skills.

Fish AI Reader

Fish AI Reader

AI辅助创作,多种专业模板,深度分析,高质量内容生成。从观点提取到深度思考,FishAI为您提供全方位的创作支持。新版本引入自定义参数,让您的创作更加个性化和精准。

FishAI

FishAI

鱼阅,AI 时代的下一个智能信息助手,助你摆脱信息焦虑

联系邮箱 441953276@qq.com

相关标签

Agent Skills AI 人工智能 机器学习 模型能力 专业知识 模块化 上下文管理 代码执行 可扩展性 安全性 Agent Skills AI Artificial Intelligence Machine Learning Model Capabilities Domain Expertise Modularity Context Management Code Execution Scalability Security
相关文章