skill-standardization
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSkill Standardization
技能标准化
When to use this skill
何时使用该技能
- Creating a new SKILL.md file from scratch
- Auditing existing skills for Agent Skills specification compliance
- Converting legacy skill formats (non-standard headings, frontmatter) to standard
- Improving skill descriptions to trigger more reliably on relevant prompts
- Adding evaluation test cases () to a skill
evals/evals.json - Batch-validating all skills in a directory for consistency
- 从零创建新的SKILL.md文件
- 审核现有技能是否符合Agent Skills规范
- 将旧版技能格式(非标准标题、frontmatter)转换为标准结构
- 优化技能描述,使其在相关提示下的触发更可靠
- 为技能添加评估测试用例()
evals/evals.json - 批量校验目录下所有技能的一致性
Agent Skills Specification Reference
Agent Skills规范参考
Frontmatter fields
Frontmatter字段
| Field | Required | Constraints |
|---|---|---|
| Yes | 1–64 chars, lowercase alphanumeric + hyphens, no leading/trailing/consecutive hyphens, must match parent directory name |
| Yes | 1–1024 chars, must describe what skill does AND when to trigger |
| No | Space-delimited list of pre-approved tools |
| No | Max 500 chars, environment requirements |
| No | License name or reference to bundled file |
| No | Arbitrary key-value map for additional fields |
| 字段 | 是否必填 | 约束 |
|---|---|---|
| 是 | 1-64个字符,小写字母+数字+连字符,无首尾/连续连字符,必须与父目录名称一致 |
| 是 | 1-1024个字符,必须说明技能功能以及触发时机 |
| 否 | 预审批工具的空格分隔列表 |
| 否 | 最多500个字符,说明环境要求 |
| 否 | 许可证名称或对绑定许可证文件的引用 |
| 否 | 存储额外字段的任意键值映射 |
Standard directory structure
标准目录结构
skill-name/
├── SKILL.md # Required
├── scripts/ # Optional: executable scripts
├── references/ # Optional: detailed documentation
├── assets/ # Optional: templates, images, data
└── evals/ # Optional: evaluation test cases
└── evals.jsonskill-name/
├── SKILL.md # 必选
├── scripts/ # 可选:可执行脚本
├── references/ # 可选:详细文档
├── assets/ # 可选:模板、图片、数据
└── evals/ # 可选:评估测试用例
└── evals.jsonProgressive disclosure tiers
渐进式披露层级
| Tier | What's loaded | When | Token budget |
|---|---|---|---|
| 1. Catalog | name + description | Session start | ~100 tokens per skill |
| 2. Instructions | Full SKILL.md body | On activation | < 5000 tokens (500 lines max) |
| 3. Resources | scripts/, references/ | When needed | Varies |
| 层级 | 加载内容 | 触发时机 | Token预算 |
|---|---|---|---|
| 1. 目录 | name + description | 会话启动时 | 每个技能约100 tokens |
| 2. 使用说明 | 完整SKILL.md正文 | 技能激活时 | < 5000 tokens(最多500行) |
| 3. 资源 | scripts/、references/ | 需要时 | 不固定 |
Instructions
使用说明
Step 1: Validate an existing skill
步骤1:校验现有技能
Run the validation script on a skill directory:
bash
bash scripts/validate_skill.sh path/to/skill-directoryValidate all skills in a directory:
bash
bash scripts/validate_skill.sh --all .agent-skills/The script checks:
- Required frontmatter fields (,
name)description - format: lowercase, no consecutive hyphens, matches directory name
name - length: 1–1024 characters
description - format: space-delimited (not YAML list)
allowed-tools - Recommended sections present
- File length: warns if over 500 lines
在技能目录下运行校验脚本:
bash
bash scripts/validate_skill.sh path/to/skill-directory校验某个目录下的所有技能:
bash
bash scripts/validate_skill.sh --all .agent-skills/脚本会校验以下内容:
- 必选frontmatter字段(、
name)是否存在description - 格式:小写、无连续连字符、与目录名一致
name - 长度:1-1024个字符
description - 格式:空格分隔(而非YAML列表)
allowed-tools - 推荐章节是否存在
- 文件长度:超过500行时给出警告
Step 2: Write an effective description
步骤2:编写有效的描述
The field determines when a skill triggers. A weak description means the skill never activates; an over-broad one triggers at wrong times.
descriptionTemplate:
yaml
description: >
[What the skill does — list specific operations.]
Use when [trigger conditions]. Even if the user doesn't explicitly
mention [domain keyword] — also triggers on: [synonym list].Principles (from agentskills.io):
- Imperative phrasing — "Use this skill when..." not "This skill does..."
- User intent, not implementation — describe what the user wants to achieve
- Be explicit about edge cases — "even if they don't say X"
- List trigger keywords — synonyms, related terms the user might type
- Stay under 1024 characters — descriptions grow during editing; watch the limit
Before / After:
yaml
undefineddescription模板:
yaml
description: >
[技能功能——列出具体操作]
Use when [触发条件]. Even if the user doesn't explicitly
mention [领域关键词] — also triggers on: [同义词列表].原则(来源:agentskills.io):
- 祈使句式 — 用"Use this skill when..."而非"This skill does..."
- 聚焦用户意图,而非实现逻辑 — 描述用户想要达成的目标
- 明确说明边缘场景 — 比如"即使用户没有提到X"
- 列出触发关键词 — 用户可能输入的同义词、相关术语
- 保持在1024字符以内 — 编辑过程中描述内容会增加,注意长度限制
优化前后对比:
yaml
undefinedBefore (weak — never triggers)
优化前(效果差——永远不会触发)
description: Helps with PDFs.
description: Helps with PDFs.
After (optimized — reliable triggering)
优化后(效果好——触发可靠)
description: >
Extract text and tables from PDF files, fill forms, merge and split documents.
Use when the user needs to work with PDF files, even if they don't explicitly
say 'PDF' — triggers on: fill form, extract text from document, merge files,
read scanned pages.
undefineddescription: >
Extract text and tables from PDF files, fill forms, merge and split documents.
Use when the user needs to work with PDF files, even if they don't explicitly
say 'PDF' — triggers on: fill form, extract text from document, merge files,
read scanned pages.
undefinedStep 3: Create a new SKILL.md
步骤3:创建新的SKILL.md
Use this template as the starting point:
markdown
---
name: skill-name
description: >
[What it does and specific operations it handles.]
Use when [trigger conditions]. Triggers on: [keyword list].
allowed-tools: Bash Read Write Edit Glob Grep
metadata:
tags: tag1, tag2, tag3
version: "1.0"
---使用以下模板作为起点:
markdown
---
name: skill-name
description: >
[技能功能和支持的具体操作]
Use when [触发条件]. Triggers on: [关键词列表].
allowed-tools: Bash Read Write Edit Glob Grep
metadata:
tags: tag1, tag2, tag3
version: "1.0"
---Skill Title
技能标题
When to use this skill
何时使用该技能
- Scenario 1
- Scenario 2
- 场景1
- 场景2
Instructions
使用说明
Step 1: [Action]
步骤1:[操作]
Content...
内容...
Step 2: [Action]
步骤2:[操作]
Content...
内容...
Examples
示例
Example 1: [Scenario]
示例1:[场景]
Input: ...
Output: ...
输入:...
输出:...
Best practices
最佳实践
- Practice 1
- Practice 2
- 实践1
- 实践2
References
参考链接
- Link
undefined- 链接
undefinedStep 4: Convert legacy section headings
步骤4:转换旧版章节标题
| Legacy heading | Standard heading |
|---|---|
| |
| |
| |
| |
| |
| |
| 旧版标题 | 标准标题 |
|---|---|
| |
| |
| |
| |
| |
| |
Step 5: Add evaluation test cases
步骤5:添加评估测试用例
Create with 2–5 realistic test prompts:
evals/evals.jsonjson
{
"skill_name": "your-skill-name",
"evals": [
{
"id": 1,
"prompt": "Realistic user message that should trigger this skill",
"expected_output": "Description of what success looks like",
"assertions": [
"Specific verifiable claim (file exists, count is correct, format is valid)",
"Another specific claim"
]
}
]
}Good assertions are verifiable: file exists, JSON is valid, chart has 3 bars. Avoid vague assertions like "output is good."
创建文件,包含2-5个真实测试提示:
evals/evals.jsonjson
{
"skill_name": "your-skill-name",
"evals": [
{
"id": 1,
"prompt": "应当触发该技能的真实用户消息",
"expected_output": "成功执行的结果描述",
"assertions": [
"可验证的具体断言(文件存在、计数正确、格式有效)",
"另一个具体断言"
]
}
]
}优秀的断言是可验证的:文件存在、JSON有效、图表有3个条形。避免使用模糊断言,比如"输出效果好"。
Available scripts
可用脚本
- — Validates a SKILL.md against the Agent Skills spec
scripts/validate_skill.sh
- — 按照Agent Skills规范校验SKILL.md文件
scripts/validate_skill.sh
Examples
示例
Example 1: Validate a skill directory
示例1:校验单个技能目录
bash
bash scripts/validate_skill.sh .agent-skills/my-skill/Output:
Validating: .agent-skills/my-skill/SKILL.md
✓ Required field: name = 'my-skill'
✓ Required field: description present
✗ Description length: 1087 chars (max 1024)
✓ Name format: valid lowercase
✗ Name/directory mismatch: name='myskill' vs dir='my-skill'
✓ Recommended section: When to use this skill
✓ Recommended section: Instructions
⚠ Missing recommended section: Examples
✓ File length: 234 lines (OK)
Issues: 2 errors, 1 warningbash
bash scripts/validate_skill.sh .agent-skills/my-skill/输出:
Validating: .agent-skills/my-skill/SKILL.md
✓ Required field: name = 'my-skill'
✓ Required field: description present
✗ Description length: 1087 chars (max 1024)
✓ Name format: valid lowercase
✗ Name/directory mismatch: name='myskill' vs dir='my-skill'
✓ Recommended section: When to use this skill
✓ Recommended section: Instructions
⚠ Missing recommended section: Examples
✓ File length: 234 lines (OK)
Issues: 2 errors, 1 warningExample 2: Batch validate all skills
示例2:批量校验所有技能
bash
bash scripts/validate_skill.sh --all .agent-skills/bash
bash scripts/validate_skill.sh --all .agent-skills/Example 3: Fix common frontmatter issues
示例3:修复常见的frontmatter问题
yaml
undefinedyaml
undefinedWRONG — tags inside metadata is non-standard for some validators
错误 — 部分校验器不支持metadata内的tags列表写法
metadata:
tags: [tag1, tag2] # list syntax
platforms: Claude # non-spec field
metadata:
tags: [tag1, tag2] # 列表语法
platforms: Claude # 非规范字段
CORRECT — per Agent Skills spec
正确 — 符合Agent Skills规范
metadata:
tags: tag1, tag2 # string value
allowed-tools: Bash Read Write # space-delimited, not a YAML list
undefinedmetadata:
tags: tag1, tag2 # 字符串值
allowed-tools: Bash Read Write # 空格分隔,而非YAML列表
undefinedBest practices
最佳实践
- Description quality first — weak descriptions mean the skill never activates; improve it before anything else
- Keep SKILL.md under 500 lines — move detailed reference docs to
references/ - Pin script versions — use not just
uvx ruff@0.8.0to ensure reproducibilityruff - No interactive prompts in scripts — agents run in non-interactive shells; use inputs, never TTY prompts
--flag - Structured output from scripts — prefer JSON/CSV over free-form text; send data to stdout, diagnostics to stderr
- Add evals before publishing — at least 2–3 test cases covering core and edge cases
- 描述质量优先 — 描述过差会导致技能永远无法激活,这是优先级最高的优化项
- 保持SKILL.md不超过500行 — 将详细参考文档移动到目录下
references/ - 固定脚本版本 — 使用而非仅
uvx ruff@0.8.0,确保可复现性ruff - 脚本中不要使用交互式提示 — Agent运行在非交互式shell中,使用参数输入,永远不要使用TTY提示
--flag - 脚本输出结构化内容 — 优先使用JSON/CSV而非自由格式文本;数据输出到stdout,诊断信息输出到stderr
- 发布前添加评估用例 — 至少包含2-3个覆盖核心场景和边缘场景的测试用例