SKILL.md File
SKILL.md is the core file of Agent Skills.
This section will explain in depth the complete structure of SKILL.md and all available fields.
Basic structure
A SKILL.md file contains two main parts:
- YAML Frontmatter (metadata section)
- Markdown content (instructions section)
Complete example
name
:
my-skill
description
:
Skill description, telling us when to use this skill
license
:
Apache-
2.0
compatibility
:
Requires Python
3.10
metadata
:
author
:
your-name
version
:
"1.0"
Skill names
Here are the detailed instructions for the skill
...
Step 1
Specific operation steps
...
Step 2
More operation steps
...
Metadata fields in detail
The following are all metadata fields supported by SKILL.md:
| Field | Required | Constraint |
|---|---|---|
| name | Is | Up to 64 characters, only lowercase letters, digits, and hyphens allowed, cannot start or end with a hyphen |
| description | Is | Up to 1024 characters, describing the skill's function and use cases |
| license | No | License name or a reference to a bundled license file |
| compatibility | No | Up to 500 characters, describing environment requirements (target product, system packages, network access, etc.) |
| metadata | No | Arbitrary key-value pairs for storing additional metadata |
| allowed-tools | No | Space-separated list of pre-approved tools (experimental feature) |
The name field in detail
The name field is the skill's identifier and must follow these rules:
- Length: 1-64 characters
- Character restrictions: only Unicode lowercase letters (a-z) and hyphens (-) allowed
- Start/end: cannot start or end with a hyphen
- Consecutive characters: cannot contain consecutive hyphens (--)
- Matching requirement: must match the parent directory name
Valid examples:
name: pdf-processing
name: data-analysis
name: code-review
Invalid examples:
name: PDF-Processing # 错误:不能使用大写字母
name: -pdf # 错误:不能以连字符开头
name: pdf--processing # 错误:不能包含连续连字符
The description field in detail
The description field is one of the most important fields; it tells the agent when to activate this skill.
A good description should:
- Describe the skill's function (what it does)
- Explain use cases (when to use it)
- Include keywords to help the agent identify relevant tasks
Good description examples:
description: 从 PDF 文件中提取文本和表格,填写 PDF 表单,合并多个 PDF。处理 PDF 文档或用户提及 PDF、表单或文档提取时使用。
Bad description examples:
description: 帮助处理 PDF 文件。 # 太笼统,代理无法判断何时使用
Tip: the description field is loaded at the start of a conversation. Make sure it contains enough keywords so the agent can correctly recognize when to activate the skill.
The license field in detail
The license field is used to specify the skill's license. This is an optional field.
license: Apache-2.0
# Or reference the bundled license file
license: Proprietary. LICENSE.txt has complete terms
The compatibility field in detail
The compatibility field is used to describe the skill's environment requirements. It only needs to be added when the skill has special environment requirements.
# Specify target product
compatibility: Designed for Claude Code
# Specify system dependencies
compatibility: Requires git, docker, jq, and access to the internet
# Specify programming language version
compatibility: Requires Python 3.14+ and uv
Note: most skills don't need the compatibility field. Only add it when the skill truly has specific environment requirements.
The metadata field in detail
The metadata field can store arbitrary key-value information. Clients can use it to store extra properties not defined in the specification.
metadata:
author: example-org
version: "1.0"
tags:
- pdf
- document
- extraction
Tip: it's recommended to use relatively unique key names to avoid conflicts with other skills.
The allowed-tools field in detail
allowed-tools is an experimental field used to specify pre-approved tools that the skill can use.
allowed-tools: Bash(git:*) Bash(jq:*) Read
Note: this is an experimental feature, and different agent implementations may support it to varying degrees.
The instructions section in detail
The Markdown content after the metadata section is the skill's instruction part. There are no format restrictions here; you can write anything you need.
Recommended to include the following:
- Step-by-step instructions
- Input/output examples
- Handling of common edge cases
# Skill Name
## Feature Description
简要描述这个技能做什么。
## Operation Steps
1. 第一步:执行某个操作
2. 第二步:执行另一个操作
3. 第三步:完成最终操作
## 示例
### 输入示例
描述输入是什么...
### 输出示例
描述输出是什么...
## Notes
- 注意点 1
- 注意点 2
Note: once a skill is activated, the entire SKILL.md file is loaded into the context. It's recommended to keep the main instructions under 500 lines and 5000 tokens. Move detailed reference materials to separate files.