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:
  1. What should this skill do? (one sentence)
  2. When should an agent use it? (trigger phrases)
  3. What tools does the skill need? (Read, Grep, Glob, Bash, Task, WebFetch, etc.)
  4. 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:
TierStructureUse When
Simple
SKILL.md
only
Self-contained instructions under ~200 lines
With references
SKILL.md
+
references/
Domain knowledge that agents load conditionally
With scripts
SKILL.md
+
scripts/
Workflow automation needing Python scripts
FullAll of the aboveComplex skills with automation and domain knowledge
Read
${CLAUDE_SKILL_ROOT}/references/design-principles.md
for guidance on keeping skills focused and concise.
在开始编写前先收集需求。
询问用户:
  1. 这个Skill应该实现什么功能?(一句话描述)
  2. Agent应在何时使用该Skill?(触发短语)
  3. 该Skill需要用到哪些工具?(Read、Grep、Glob、Bash、Task、WebFetch等)
  4. 该Skill应存放于何处?(哪个插件或目录)
确定Skill名称:
  • 全小写字母数字加连字符,长度1-64字符
  • 描述性强且与现有Skill不重复
  • 检查目标技能目录避免重名
选择复杂度层级:
层级结构使用场景
简单型仅包含
SKILL.md
内容不超过200行的独立指令型Skill
带参考资料型
SKILL.md
+
references/
需要Agent根据上下文加载领域知识的Skill
带脚本型
SKILL.md
+
scripts/
需要Python脚本实现工作流自动化的Skill
完整型包含以上所有结构兼具自动化能力和领域知识的复杂Skill
阅读
${CLAUDE_SKILL_ROOT}/references/design-principles.md
以获取Skill聚焦性和简洁性的指导建议。

Step 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
${CLAUDE_SKILL_ROOT}/references/skill-patterns.md
for concrete examples of each tier.
Also read
CLAUDE.md
(or
AGENTS.md
) at the repository root for repo-specific conventions that the skill should follow.
在开始编写前,研究1-2个与所选层级匹配的现有Skill。查看目标仓库或插件中的Skill,了解本地约定。
阅读
${CLAUDE_SKILL_ROOT}/references/skill-patterns.md
获取各层级Skill的具体示例。
同时阅读仓库根目录下的
CLAUDE.md
(或
AGENTS.md
),了解Skill需遵循的仓库特定约定。

Step 3: Write the SKILL.md

步骤3:编写SKILL.md

Create
<skill-directory>/<name>/SKILL.md
.
创建
<skill-directory>/<name>/SKILL.md
文件。

Frontmatter

前置元数据(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:
  • name
    — must match the directory name exactly
  • description
    — up to 1024 chars; include trigger keywords that help agents match user intent
Optional fields:
  • model
    — override model (
    sonnet
    ,
    opus
    ,
    haiku
    ); omit to use the user's default
  • allowed-tools
    — space-delimited list (e.g.,
    Read Grep Glob Bash Task
    ); omit to allow all tools
  • license
    — license name or path (add when vendoring external content)
YAML前置元数据必须是文件的第一部分。
---
之前不能有注释或空行。
yaml
---
name: <skill-name>
description: <功能描述>. Use when <触发短语>. <核心能力>.
---
必填字段:
  • name
    — 必须与目录名称完全一致
  • description
    — 最多1024字符;需包含帮助Agent匹配用户意图的触发关键词
可选字段:
  • 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.
DoDon'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:
  1. Start with a one-line summary of what the skill does
  2. Organize steps with
    ## Step N: Title
    headings
  3. Use tables for decision logic and mappings
  4. Include concrete examples of expected output
  5. End with validation criteria or exit conditions
Size limits:
  • Keep SKILL.md under 500 lines
  • If approaching the limit, move reference material to
    references/
    files
  • Load reference files conditionally based on context (not all at once)
正文使用祈使语气——这些是指令,而非文档。
正确示例错误示例
"读取文件并提取...""此Skill会读取文件并提取..."
"仅报告高置信度的结果""Agent应仅报告高置信度的结果"
"询问用户要使用哪个选项""你可能需要询问用户..."
结构:
  1. 开头用一句话总结Skill的功能
  2. 使用
    ## 步骤N:标题
    的格式组织步骤
  3. 用表格呈现决策逻辑和映射关系
  4. 包含预期输出的具体示例
  5. 结尾添加验证标准或退出条件
篇幅限制:
  • 保持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/

Use for domain knowledge the agent loads conditionally.
<name>/
├── SKILL.md
└── references/
    ├── topic-a.md
    └── topic-b.md
Reference 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/

Use for workflow automation that benefits from structured Python.
<name>/
├── SKILL.md
└── scripts/
    └── do_thing.py
Script requirements:
  • Always use
    uv run
    to execute:
    uv 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 run
    执行:
    uv 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/

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
CLAUDE.md
or
README.md
for specific instructions.
  1. Verify directory-name match — confirm the directory name matches the
    name
    field in SKILL.md frontmatter exactly
  2. Update documentation — add the skill to any skills index or table in README.md
  3. Update permissions — if the repo has
    .claude/settings.json
    , add
    Skill(<plugin>:<name>)
    to the
    permissions.allow
    array
  4. Check CLAUDE.md — read the repository's
    CLAUDE.md
    for any additional registration steps specific to that project
注册步骤因仓库而异。查看仓库的
CLAUDE.md
README.md
获取具体说明。
  1. 验证目录名称匹配——确认目录名称与SKILL.md前置元数据中的
    name
    字段完全一致
  2. 更新文档——将该Skill添加到README.md中的技能索引或表格
  3. 更新权限——如果仓库包含
    .claude/settings.json
    ,将
    Skill(<plugin>:<name>)
    添加到
    permissions.allow
    数组
  4. 检查CLAUDE.md——阅读仓库的
    CLAUDE.md
    ,完成该项目特有的任何额外注册步骤

Step 6: Verify

步骤6:验证Skill

Run through this checklist before finishing:
完成前请逐一核对以下检查清单:

Frontmatter

前置元数据检查

  • name
    matches directory name
  • description
    is under 1024 characters
  • description
    includes trigger keywords
  • No content before the opening
    ---
  • name
    与目录名称匹配
  • description
    长度不超过1024字符
  • 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中已记录脚本信息
报告发现的所有问题并修复后再完成整个流程。