skill-creator
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese<!--
Adapted from skill-creator implementations by Anthropic and OpenAI:
https://github.com/anthropics/claude-plugins-official
https://github.com/openai/codex-plugins-official
-->
<!--
改编自Anthropic和OpenAI的skill-creator实现:
https://github.com/anthropics/claude-plugins-official
https://github.com/openai/codex-plugins-official
-->
Create a New Skill
创建新的Agent Skill
Guide the user through creating a new agent skill following the Agent Skills specification. Follow each step in order.
指导用户遵循Agent Skills规范创建新的Agent技能,请按顺序执行每个步骤。
Step 1: Understand the Skill
步骤1:明确Skill需求
Gather requirements before writing anything.
Ask the user:
- What should this skill do? (one sentence)
- When should an agent use it? (trigger phrases)
- What tools does the skill need? (Read, Grep, Glob, Bash, Task, WebFetch, etc.)
- Where should the skill live? (which plugin or directory)
Determine the skill name:
- Lowercase alphanumeric with hyphens, 1-64 characters
- Descriptive and unique among existing skills
- Check the target skills directory to avoid name collisions
Choose a complexity tier:
| Tier | Structure | Use When |
|---|---|---|
| Simple | | Self-contained instructions under ~200 lines |
| With references | | Domain knowledge that agents load conditionally |
| With scripts | | Workflow automation needing Python scripts |
| Full | All of the above | Complex skills with automation and domain knowledge |
Read for guidance on keeping skills focused and concise.
${CLAUDE_SKILL_ROOT}/references/design-principles.md在开始编写前先收集需求。
询问用户:
- 这个Skill应该实现什么功能?(一句话描述)
- Agent应在何时使用该Skill?(触发短语)
- 该Skill需要用到哪些工具?(Read、Grep、Glob、Bash、Task、WebFetch等)
- 该Skill应存放于何处?(哪个插件或目录)
确定Skill名称:
- 全小写字母数字加连字符,长度1-64字符
- 描述性强且与现有Skill不重复
- 检查目标技能目录避免重名
选择复杂度层级:
| 层级 | 结构 | 使用场景 |
|---|---|---|
| 简单型 | 仅包含 | 内容不超过200行的独立指令型Skill |
| 带参考资料型 | | 需要Agent根据上下文加载领域知识的Skill |
| 带脚本型 | | 需要Python脚本实现工作流自动化的Skill |
| 完整型 | 包含以上所有结构 | 兼具自动化能力和领域知识的复杂Skill |
阅读以获取Skill聚焦性和简洁性的指导建议。
${CLAUDE_SKILL_ROOT}/references/design-principles.mdStep 2: Study Existing Skills
步骤2:参考现有Skill
Before writing, study 1-2 existing skills that match the chosen tier. Look for skills in the target repository or plugin to understand local conventions.
Read for concrete examples of each tier.
${CLAUDE_SKILL_ROOT}/references/skill-patterns.mdAlso read (or ) at the repository root for repo-specific conventions that the skill should follow.
CLAUDE.mdAGENTS.md在开始编写前,研究1-2个与所选层级匹配的现有Skill。查看目标仓库或插件中的Skill,了解本地约定。
阅读获取各层级Skill的具体示例。
${CLAUDE_SKILL_ROOT}/references/skill-patterns.md同时阅读仓库根目录下的(或),了解Skill需遵循的仓库特定约定。
CLAUDE.mdAGENTS.mdStep 3: Write the SKILL.md
步骤3:编写SKILL.md
Create .
<skill-directory>/<name>/SKILL.md创建文件。
<skill-directory>/<name>/SKILL.mdFrontmatter
前置元数据(Frontmatter)
The YAML frontmatter must be the first thing in the file. No comments or blank lines before .
---yaml
---
name: <skill-name>
description: <what it does>. Use when <trigger phrases>. <key capabilities>.
---Required fields:
- — must match the directory name exactly
name - — up to 1024 chars; include trigger keywords that help agents match user intent
description
Optional fields:
- — override model (
model,sonnet,opus); omit to use the user's defaulthaiku - — space-delimited list (e.g.,
allowed-tools); omit to allow all toolsRead Grep Glob Bash Task - — license name or path (add when vendoring external content)
license
YAML前置元数据必须是文件的第一部分。之前不能有注释或空行。
---yaml
---
name: <skill-name>
description: <功能描述>. Use when <触发短语>. <核心能力>.
---必填字段:
- — 必须与目录名称完全一致
name - — 最多1024字符;需包含帮助Agent匹配用户意图的触发关键词
description
可选字段:
- — 覆盖默认模型(
model、sonnet、opus);省略则使用用户默认模型haiku - — 空格分隔的工具列表(例如:
allowed-tools);省略则允许使用所有工具Read Grep Glob Bash Task - — 许可证名称或路径(引入外部内容时添加)
license
Body Guidelines
正文编写规范
Write the body in imperative voice — these are instructions, not documentation.
| Do | Don't |
|---|---|
| "Read the file and extract..." | "This skill reads the file and extracts..." |
| "Report only HIGH confidence findings" | "The agent should report only HIGH confidence findings" |
| "Ask the user which option to use" | "You may want to ask the user..." |
Structure:
- Start with a one-line summary of what the skill does
- Organize steps with headings
## Step N: Title - Use tables for decision logic and mappings
- Include concrete examples of expected output
- End with validation criteria or exit conditions
Size limits:
- Keep SKILL.md under 500 lines
- If approaching the limit, move reference material to files
references/ - Load reference files conditionally based on context (not all at once)
正文使用祈使语气——这些是指令,而非文档。
| 正确示例 | 错误示例 |
|---|---|
| "读取文件并提取..." | "此Skill会读取文件并提取..." |
| "仅报告高置信度的结果" | "Agent应仅报告高置信度的结果" |
| "询问用户要使用哪个选项" | "你可能需要询问用户..." |
结构:
- 开头用一句话总结Skill的功能
- 使用的格式组织步骤
## 步骤N:标题 - 用表格呈现决策逻辑和映射关系
- 包含预期输出的具体示例
- 结尾添加验证标准或退出条件
篇幅限制:
- 保持SKILL.md在500行以内
- 若接近行数限制,将参考资料移至目录下的文件
references/ - 根据上下文按需加载参考文件(而非一次性全部加载)
Attribution
来源说明
If the skill is based on or adapted from external sources, add an HTML comment after the frontmatter closing :
---markdown
---
name: example
description: ...
---
<!--
Based on [Original Name] by [Author/Org]:
https://github.com/example/original-source
-->如果Skill基于或改编自外部资源,在前置元数据的闭合之后添加HTML注释:
---markdown
---
name: example
description: ...
---
<!--
Based on [Original Name] by [Author/Org]:
https://github.com/example/original-source
-->Step 4: Create Supporting Files
步骤4:创建配套文件
References (references/
)
references/参考资料目录(references/
)
references/Use for domain knowledge the agent loads conditionally.
<name>/
├── SKILL.md
└── references/
├── topic-a.md
└── topic-b.mdReference from SKILL.md with:
markdown
Read `${CLAUDE_SKILL_ROOT}/references/topic-a.md` for details on [topic].Keep each reference file focused on one topic. Use markdown with tables and code blocks.
用于存放Agent需按需加载的领域知识。
<name>/
├── SKILL.md
└── references/
├── topic-a.md
└── topic-b.md在SKILL.md中通过以下方式引用:
markdown
Read `${CLAUDE_SKILL_ROOT}/references/topic-a.md` for details on [topic].每个参考文件聚焦一个主题。使用Markdown格式,可包含表格和代码块。
Scripts (scripts/
)
scripts/脚本目录(scripts/
)
scripts/Use for workflow automation that benefits from structured Python.
<name>/
├── SKILL.md
└── scripts/
└── do_thing.pyScript requirements:
- Always use to execute:
uv runuv run ${CLAUDE_SKILL_ROOT}/scripts/do_thing.py - Add PEP 723 inline metadata for dependencies:
python
undefined用于通过结构化Python代码实现工作流自动化。
<name>/
├── SKILL.md
└── scripts/
└── do_thing.py脚本要求:
- 始终使用执行:
uv runuv run ${CLAUDE_SKILL_ROOT}/scripts/do_thing.py - 添加PEP 723内联元数据声明依赖:
python
undefined/// script
/// script
requires-python = ">=3.12"
requires-python = ">=3.12"
dependencies = ["requests"]
dependencies = ["requests"]
///
///
- Output structured JSON for agent consumption
- Run from the **repository root**, not the skill directory
- Document the script's interface in SKILL.md (arguments, output format)
- 输出结构化JSON供Agent使用
- 从**仓库根目录**执行,而非Skill目录
- 在SKILL.md中记录脚本的接口(参数、输出格式)Assets (assets/
)
assets/资源目录(assets/
)
assets/Use for static files the skill references (templates, configs, etc.).
用于存放Skill引用的静态文件(模板、配置文件等)。
LICENSE
LICENSE文件
Include a LICENSE file in the skill directory when vendoring content with specific licensing requirements.
当引入有特定许可证要求的外部内容时,在Skill目录中添加LICENSE文件。
Step 5: Register the Skill
步骤5:注册Skill
Registration steps vary by repository. Check the repository's or for specific instructions.
CLAUDE.mdREADME.md- Verify directory-name match — confirm the directory name matches the field in SKILL.md frontmatter exactly
name - Update documentation — add the skill to any skills index or table in README.md
- Update permissions — if the repo has , add
.claude/settings.jsonto theSkill(<plugin>:<name>)arraypermissions.allow - Check CLAUDE.md — read the repository's for any additional registration steps specific to that project
CLAUDE.md
注册步骤因仓库而异。查看仓库的或获取具体说明。
CLAUDE.mdREADME.md- 验证目录名称匹配——确认目录名称与SKILL.md前置元数据中的字段完全一致
name - 更新文档——将该Skill添加到README.md中的技能索引或表格
- 更新权限——如果仓库包含,将
.claude/settings.json添加到Skill(<plugin>:<name>)数组permissions.allow - 检查CLAUDE.md——阅读仓库的,完成该项目特有的任何额外注册步骤
CLAUDE.md
Step 6: Verify
步骤6:验证Skill
Run through this checklist before finishing:
完成前请逐一核对以下检查清单:
Frontmatter
前置元数据检查
- matches directory name
name - is under 1024 characters
description - includes trigger keywords
description - No content before the opening
---
- 与目录名称匹配
name - 长度不超过1024字符
description - 包含触发关键词
description - 开头之前无任何内容
---
Content
正文内容检查
- SKILL.md is under 500 lines
- Written in imperative voice
- Steps are numbered and clear
- Examples of expected output included
- Reference files loaded conditionally (not unconditionally)
- SKILL.md不超过500行
- 使用祈使语气
- 步骤编号清晰
- 包含预期输出的示例
- 参考文件按需加载(而非强制加载)
Registration
注册检查
- Directory name matches frontmatter
name - Skill added to repo documentation (README or equivalent)
- Permissions updated (if applicable)
- Any repo-specific registration steps completed (check CLAUDE.md)
- 目录名称与前置元数据匹配
name - Skill已添加到仓库文档(README或等效文件)
- 权限已更新(如适用)
- 已完成所有仓库特定的注册步骤(查看CLAUDE.md)
Scripts (if applicable)
脚本检查(如适用)
- Uses
uv run ${CLAUDE_SKILL_ROOT}/scripts/... - Has PEP 723 inline metadata
- Outputs structured JSON
- Documented in SKILL.md
Report any issues found and fix them before completing.
- 使用执行
uv run ${CLAUDE_SKILL_ROOT}/scripts/... - 包含PEP 723内联元数据
- 输出结构化JSON
- 在SKILL.md中已记录脚本信息
报告发现的所有问题并修复后再完成整个流程。