agent-skills-spec
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAgent Skills Spec
Agent技能规范
Structural compliance for the agentskills.io specification. For content quality and expertise transfer, use skill-creator-v2 instead.
用于保障agentskills.io规范的结构合规性。如果需要进行内容质量管控和专业知识迁移,请使用skill-creator-v2。
Mental Model
思维模型
A skill is a progressive disclosure pipeline. Each layer has strict constraints:
Layer 1: METADATA (~100 tokens) ← always loaded
name + description in YAML frontmatter
Must be precise enough for activation decisions
Layer 2: INSTRUCTIONS (<5000 tokens recommended) ← loaded on activation
SKILL.md body, <500 lines
Core workflows, decision frameworks, essential examples
Layer 3: RESOURCES (on demand) ← loaded when referenced
references/*.md, scripts/*, assets/*
Deep knowledge, executable code, templatesEvery spec rule serves this pipeline. Name/description enable discovery. Body enables execution. Resources enable depth without cost.
一个技能就是一条渐进式信息披露流水线,每一层都有严格的约束:
Layer 1: METADATA (~100 tokens) ← 始终加载
name + description in YAML frontmatter
Must be precise enough for activation decisions
Layer 2: INSTRUCTIONS (<5000 tokens recommended) ← 激活时加载
SKILL.md body, <500 lines
Core workflows, decision frameworks, essential examples
Layer 3: RESOURCES (on demand) ← 被引用时加载
references/*.md, scripts/*, assets/*
Deep knowledge, executable code, templates所有规范规则都是为这条流水线服务的:名称和描述用于技能发现,正文用于执行逻辑,资源文件则在不增加额外负载的前提下提供深度支持。
Create Workflow
创建工作流
Create a new spec-compliant skill:
- Name: Choose lowercase kebab-case, 1–64 chars
- Directory:
mkdir -p skill-name/references - Frontmatter: Write valid YAML with +
namedescription - Body: Core instructions in imperative mood, <500 lines
- Split: Move detailed content into
references/ - Scripts: Add to if needed (see script guidelines)
scripts/ - Validate: Run or walk through validation checklist
skills-ref validate ./skill-name
Minimal valid skill:
yaml
---
name: my-skill
description: >
Extract text from PDFs and fill forms. Use when working with PDF files
or when the user mentions PDFs, forms, or document extraction.
---创建符合规范的新技能:
- 命名:采用小写短横线命名法,长度1-64字符
- 创建目录:执行
mkdir -p skill-name/references - 填写前置元数据:编写包含和
name字段的有效YAML内容description - 编写正文:使用祈使语气编写核心说明,行数不超过500行
- 内容拆分:将详细内容迁移到目录下
references/ - 添加脚本:如有需要将脚本放到目录下(参考脚本指南)
scripts/ - 验证合规性:执行,或是对照验证清单手动检查
skills-ref validate ./skill-name
最小有效技能示例:
yaml
---
name: my-skill
description: >
Extract text from PDFs and fill forms. Use when working with PDF files
or when the user mentions PDFs, forms, or document extraction.
---My Skill
My Skill
[Instructions here]
undefined[Instructions here]
undefinedAudit Workflow
审计工作流
Audit an existing skill for spec compliance:
- Check frontmatter against hard rules (required fields, character limits, naming)
- Check for disallowed frontmatter fields (see below)
- Verify directory structure (only ,
scripts/,references/allowed)assets/ - Scan for non-standard top-level files (README, LICENSE, CHANGELOG)
- Count SKILL.md body lines (<500)
- Assess description quality (specific triggers? capability + when?)
- Assess progressive disclosure (too much in SKILL.md?)
- Check script interfaces if exists
scripts/ - Report findings with severity + fix recommendations
For the full checklist: see references/validation-checklist.md
审计现有技能的规范合规性:
- 对照硬性规则检查前置元数据(必填字段、字符限制、命名规范)
- 检查是否存在不允许的前置元数据字段(见下文)
- 验证目录结构(仅允许、
scripts/、references/三个子目录)assets/ - 扫描是否存在非标准顶层文件(README、LICENSE、CHANGELOG)
- 统计SKILL.md正文行数(需<500行)
- 评估描述质量(是否有明确触发词?是否说明能力和适用场景?)
- 评估渐进式信息披露合理性(SKILL.md是否包含过多内容?)
- 如果存在目录,检查脚本接口是否合规
scripts/ - 输出审计结果,标注严重级别和修复建议
完整清单请参考:references/validation-checklist.md
Fix Workflow
修复工作流
Remediate common issues. For the complete decision tree with before/after examples: see references/common-fixes.md
Quick reference:
| Issue | Severity | Fix |
|---|---|---|
| Non-spec frontmatter fields | Error | Move to |
| Name/directory mismatch | Error | Rename to match |
| Error | Convert to space-delimited string |
| Interactive prompts in scripts | Error | Replace with CLI flags/stdin |
| SKILL.md >500 lines | Warning | Split into |
| README/LICENSE/CHANGELOG present | Warning | Remove (AI meta-docs) |
Non-standard directories ( | Warning | Rename to |
| Vague description | Warning | Add specific triggers and "Use when..." |
Scripts without | Info | Add usage documentation |
修复常见合规问题。包含前后对比示例的完整决策树请参考:references/common-fixes.md
快速参考:
| 问题 | 严重级别 | 修复方案 |
|---|---|---|
| 不符合规范的前置元数据字段 | 错误 | 移动到 |
| 名称/目录名不匹配 | 错误 | 重命名使其一致 |
| 错误 | 转换为空格分隔的字符串 |
| 脚本中存在交互式提示 | 错误 | 替换为CLI flags/标准输入 |
| SKILL.md行数超过500 | 警告 | 拆分内容到 |
| 存在README/LICENSE/CHANGELOG文件 | 警告 | 删除(属于AI元文档) |
存在非标准目录( | 警告 | 重命名为 |
| 描述模糊 | 警告 | 添加明确的触发词和"Use when..."说明 |
脚本没有 | 提示 | 添加使用文档 |
Frontmatter Rules
前置元数据规则
Required fields
必填字段
| Field | Constraints |
|---|---|
| 1–64 chars. Lowercase alphanumeric + hyphens only. No leading/trailing/consecutive hyphens. Must match parent directory name (after NFKC normalisation). |
| 1–1024 chars. Non-empty. Describe what the skill does AND when to use it. Include specific trigger keywords. |
| 字段 | 约束 |
|---|---|
| 长度1-64字符,仅允许小写字母、数字和短横线,不能有首尾/连续短横线,必须与父目录名称一致(经过NFKC标准化后) |
| 长度1-1024字符,非空,需要说明技能的功能以及适用场景,包含明确的触发关键词 |
Optional fields
可选字段
| Field | Constraints |
|---|---|
| String. License name or reference to bundled file. |
| 1–500 chars. Environment requirements only. Most skills don't need this. |
| Key-value map (string → string). For client-specific properties. |
| Space-delimited string (not YAML array). Experimental. e.g. |
| 字段 | 约束 |
|---|---|
| 字符串,许可证名称或对应绑定文件的引用 |
| 长度1-500字符,仅用于说明环境要求,大部分技能不需要该字段 |
| 键值对映射(字符串→字符串),用于存放客户端自定义属性 |
| 空格分隔的字符串(不是YAML数组),实验性字段,例如 |
Disallowed fields
禁止字段
Any field not in is a validation error. Common offenders:
{name, description, license, compatibility, metadata, allowed-tools}| Found | Fix |
|---|---|
| Move to |
| Move to |
| Move to |
| Remove (use directory convention) |
| Remove (non-spec) |
| Remove (non-spec) |
任何不在中的字段都会触发验证错误,常见违规字段:
{name, description, license, compatibility, metadata, allowed-tools}| 违规字段 | 修复方案 |
|---|---|
| 移动到 |
| 移动到 |
| 移动到 |
| 删除(使用目录约定即可) |
| 删除(非规范字段) |
| 删除(非规范字段) |
Directory Structure
目录结构
skill-name/ # Must match frontmatter name
├── SKILL.md # Required
├── scripts/ # Optional: executable code
├── references/ # Optional: on-demand documentation
└── assets/ # Optional: static resourcesShould not exist at top level:
- ,
README.md,LICENSE— AI meta-docsCHANGELOG.md - ,
package.json, lock files — build artifactstsconfig.json - Bare files other than
.md— move toSKILL.mdreferences/
Non-standard directories (rename):
- →
rules/references/ - →
templates/assets/ - →
examples/references/ - ,
src/,docs/→ remove or restructuretest/
skill-name/ # 必须与前置元数据的name字段一致
├── SKILL.md # 必填
├── scripts/ # 可选:可执行代码
├── references/ # 可选:按需加载的文档
└── assets/ # 可选:静态资源顶层目录不应该存在以下内容:
- 、
README.md、LICENSE—— AI元文档CHANGELOG.md - 、
package.json、依赖锁文件 —— 构建产物tsconfig.json - 除了之外的裸露
SKILL.md文件 —— 移动到.md目录references/
非标准目录需重命名:
- →
rules/references/ - →
templates/assets/ - →
examples/references/ - 、
src/、docs/→ 删除或重构结构test/
Progressive Disclosure
渐进式信息披露
Keep SKILL.md body under 500 lines. When approaching this limit, offload to :
references/| Content type | Move to |
|---|---|
| Detailed examples | |
| API reference tables | |
| Edge cases/gotchas | |
| Installation/setup | |
| Pattern libraries | |
Replace offloaded content with a one-line reference:
markdown
For detailed examples, see [references/examples.md](references/examples.md).Keep references one level deep from SKILL.md. Avoid chains (A → B → C).
保持SKILL.md正文行数在500行以内,接近阈值时将内容迁移到目录:
references/| 内容类型 | 迁移目标 |
|---|---|
| 详细示例 | |
| API参考表 | |
| 边界情况/注意事项 | |
| 安装/配置说明 | |
| 模式库 | |
使用一行引用代替被迁移的内容:
markdown
For detailed examples, see [references/examples.md](references/examples.md).引用文件保持在SKILL.md的一级目录下,避免链式引用(A→B→C)。
Description Quality
描述质量
A description is effective when an agent can answer from it alone:
- "What does this skill do?" (capability)
- "Should I activate it for this task?" (trigger)
| Quality | Pattern | Example |
|---|---|---|
| Poor | Vague noun phrase | "Helps with documents" |
| Fair | Capability only | "Processes PDF files" |
| Good | Capability + trigger | "Extract text from PDFs. Use when working with PDF files." |
| Excellent | Capability + specific triggers + scope | "Extract text and tables from PDFs, fill forms, merge documents. Use when working with PDF files or when the user mentions PDFs, forms, or document extraction." |
好的描述应当可以让Agent仅凭描述就能回答两个问题:
- "这个技能是做什么的?"(能力)
- "当前任务我需要激活这个技能吗?"(触发条件)
| 质量等级 | 模式 | 示例 |
|---|---|---|
| 差 | 模糊的名词短语 | "Helps with documents" |
| 一般 | 仅说明能力 | "Processes PDF files" |
| 良好 | 能力+触发条件 | "Extract text from PDFs. Use when working with PDF files." |
| 优秀 | 能力+明确触发条件+适用范围 | "Extract text and tables from PDFs, fill forms, merge documents. Use when working with PDF files or when the user mentions PDFs, forms, or document extraction." |
Validation
验证
With installed:
skills-refbash
skills-ref validate ./my-skill # structural validation
skills-ref read-properties ./my-skill # dump parsed frontmatterInstall if needed:
bash
uv tool install skills-ref # or: pip install skills-refWithout the tool, walk through references/validation-checklist.md manually.
已安装的情况下:
skills-refbash
skills-ref validate ./my-skill # 结构验证
skills-ref read-properties ./my-skill # 输出解析后的前置元数据需要安装的话执行:
bash
uv tool install skills-ref # 或者: pip install skills-ref没有工具的情况下,手动对照references/validation-checklist.md检查即可。
Script Rules (Summary)
脚本规则(概要)
Full guide: references/script-guidelines.md
Non-negotiable:
- No interactive prompts — agents cannot respond to TTY input
- Support — agents discover script interfaces through help output
--help - Structured output (JSON/CSV) to stdout, diagnostics to stderr
- Meaningful exit codes — document in
--help - Pin dependency versions — reproducibility across environments
- for destructive operations
--dry-run
完整指南:references/script-guidelines.md
硬性要求:
- 禁止交互式提示 —— Agent无法响应TTY输入
- 支持参数 —— Agent通过帮助输出发现脚本接口
--help - 结构化输出(JSON/CSV)输出到stdout,诊断信息输出到stderr
- 有意义的退出码 —— 在中说明
--help - 锁定依赖版本 —— 保障跨环境的可复现性
- 破坏性操作支持参数
--dry-run
References
参考文档
- Validation checklist — exhaustive audit checklist
- Common fixes — decision tree + fix recipes
- Script guidelines — spec-compliant script design
- agentskills.io specification — canonical spec
- 验证清单 —— 完整的审计清单
- 常见修复方案 —— 决策树+修复指南
- 脚本指南 —— 符合规范的脚本设计说明
- agentskills.io官方规范 —— 权威规范