技能与自动化
SKILL.md 格式
技能清单:结构、必填字段、工具、输入与示例。
每个技能都由一个文件定义:SKILL.md。它告诉智能体这个技能做什么、何时使用,以及如何去做。清单写对了,技能就能可靠触发;写错了,智能体就永远不会取用它。本页是该格式的参考。
文件结构
一个技能是一个目录,其中包含一份 SKILL.md 清单,以及若干可选的支撑文件:
my-skill/
├── SKILL.md ← 必需:frontmatter + 指令
├── scripts/ ← 可选:技能运行的可执行辅助脚本
├── references/ ← 可选:智能体按需加载的文档
└── assets/ ← 可选:技能产出中使用的文件清单本身是 YAML frontmatter 后接一段 Markdown 正文:
---
name: keyword-research
description: Discover high-intent keywords and cluster them by topic. Use when the user asks to research keywords or analyze search intent.
---
# Keyword Research
Instructions for the agent go here — the actual steps to run the workflow.必填字段
有两个 frontmatter 字段是必填的:
| 字段 | 必填 | 说明 |
|---|---|---|
name | ✓ | 技能的简短标识符。 |
description | ✓ | 技能做什么以及何时使用。这是主要的触发依据——智能体读它来决定是否运行该技能,所以要具体,并写明应当激活它的场景或措辞。 |
把所有触发上下文都放进 description,而不是正文。模糊的描述(「帮助处理内容」)很少触发;具体的描述(「当用户要求把博客文章改写到社交渠道时使用」)则能可靠触发。
可选字段
| 字段 | 说明 |
|---|---|
version | 版本字符串,例如 "1.0.0"。 |
author | 技能的发布者。 |
tags | 逗号分隔的分类,用于筛选与发现。 |
allowed-tools | 技能被允许使用的工具,例如 Read, Write, Edit, Bash。技能无法超出这些范围。 |
user-invocable | 人是否可以手动触发该技能(相对于仅限智能体触发)。 |
compatibility | 技能所需的工具或依赖。 |
metadata | 自定义键值对。 |
Markdown 正文承载操作指令——保持聚焦,用分节和链接维持可读性,而不是把所有内容一股脑塞进去。
工具与输入
- 工具——用
allowed-tools声明技能可以使用哪些工具。技能运行在智能体自己的云电脑中,因此技能只能使用智能体本就拥有的工具。 - 输入——技能没有固定的参数签名;智能体会从对话中提供工作流所需的内容。在正文中描述你期望的输入(文件路径、一个主题、一个目标格式),让智能体知道运行前要收集什么。
示例
最小技能:
---
name: My Skill
description: A one-sentence summary of what this does and when to use it.
---
# My Skill
Step-by-step instructions for the agent.更完整的清单:
---
name: blog-to-social
description: Rewrite a finished blog post into Xiaohongshu, LinkedIn, and a short-video script. Use when the user finishes a blog post and asks for social versions.
version: "1.2.0"
author: Content Ops
tags: marketing, content, repurposing
allowed-tools: Read, Write, Edit
---
# Blog to Social
1. Read the source blog post the user points to.
2. Produce a Xiaohongshu draft, a LinkedIn post, and a 30-second video script.
3. Save each to the agent Drive and link them back in the chat.有几个细节需要知道:如果 skill.json 和 SKILL.md 同时存在,以 skill.json 为准。如果找不到清单,技能会回退到使用目录名和一个空描述——这通常不会触发,所以请始终附带一份 SKILL.md。