skill-development

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Skill Development for Claude Code Plugins

Claude Code插件的Skill开发指南

This skill provides guidance for creating effective skills for Claude Code plugins.
本Skill为Claude Code插件创建高效Skill提供指导。

About Skills

关于Skill

Skills are modular, self-contained packages that extend Claude's capabilities by providing specialized knowledge, workflows, and tools. Think of them as "onboarding guides" for specific domains or tasks—they transform Claude from a general-purpose agent into a specialized agent equipped with procedural knowledge that no model can fully possess.
Skill是模块化、独立的包,通过提供专业知识、工作流和工具来扩展Claude的能力。可以将其视为特定领域或任务的「入门指南」——它们将Claude从通用型Agent转变为具备过程知识的专用Agent,而这些过程知识是任何模型都无法完全拥有的。

What Skills Provide

Skill能提供什么

  1. Specialized workflows - Multi-step procedures for specific domains
  2. Tool integrations - Instructions for working with specific file formats or APIs
  3. Domain expertise - Company-specific knowledge, schemas, business logic
  4. Bundled resources - Scripts, references, and assets for complex and repetitive tasks
  1. 专业工作流 - 特定领域的多步骤流程
  2. 工具集成 - 处理特定文件格式或API的说明
  3. 领域专业知识 - 公司特定知识、模式、业务逻辑
  4. 捆绑资源 - 用于复杂重复任务的脚本、参考资料和资产

Anatomy of a Skill

Skill的结构

Every skill consists of a required SKILL.md file and optional bundled resources:
skill-name/
├── SKILL.md (required)
│   ├── YAML frontmatter metadata (required)
│   │   ├── name: (required)
│   │   └── description: (required)
│   └── Markdown instructions (required)
└── Bundled Resources (optional)
    ├── scripts/          - Executable code (Python/Bash/etc.)
    ├── references/       - Documentation intended to be loaded into context as needed
    └── assets/           - Files used in output (templates, icons, fonts, etc.)
每个Skill都包含一个必填的SKILL.md文件和可选的捆绑资源:
skill-name/
├── SKILL.md (required)
│   ├── YAML frontmatter metadata (required)
│   │   ├── name: (required)
│   │   └── description: (required)
│   └── Markdown instructions (required)
└── Bundled Resources (optional)
    ├── scripts/          - 可执行代码(Python/Bash等)
    ├── references/       - 可根据需要加载到上下文的文档
    └── assets/           - 输出中使用的文件(模板、图标、字体等)

SKILL.md (required)

SKILL.md(必填)

Metadata Quality: The
name
and
description
in YAML frontmatter determine when Claude will use the skill. Be specific about what the skill does and when to use it. Use the third-person (e.g. "This skill should be used when..." instead of "Use this skill when...").
元数据质量:YAML前置元数据中的
name
description
决定了Claude何时使用该Skill。请明确说明Skill的功能和适用场景。使用第三人称(例如:「当...时应使用本Skill」而非「当...时使用本Skill」)。

Bundled Resources (optional)

捆绑资源(可选)

Scripts (
scripts/
)
脚本(
scripts/
Executable code (Python/Bash/etc.) for tasks that require deterministic reliability or are repeatedly rewritten.
  • When to include: When the same code is being rewritten repeatedly or deterministic reliability is needed
  • Example:
    scripts/rotate_pdf.py
    for PDF rotation tasks
  • Benefits: Token efficient, deterministic, may be executed without loading into context
  • Note: Scripts may still need to be read by Claude for patching or environment-specific adjustments
用于需要确定性可靠性或重复编写的任务的可执行代码(Python/Bash等)。
  • 何时包含:当同一代码需要重复编写或需要确定性可靠性时
  • 示例:用于PDF旋转任务的
    scripts/rotate_pdf.py
    脚本
  • 优势:高效使用Token,确定性强,无需加载到上下文即可执行
  • 注意:Claude可能仍需要读取脚本以进行补丁或环境特定调整
References (
references/
)
参考资料(
references/
Documentation and reference material intended to be loaded as needed into context to inform Claude's process and thinking.
  • When to include: For documentation that Claude should reference while working
  • Examples:
    references/finance.md
    for financial schemas,
    references/mnda.md
    for company NDA template,
    references/policies.md
    for company policies,
    references/api_docs.md
    for API specifications
  • Use cases: Database schemas, API documentation, domain knowledge, company policies, detailed workflow guides
  • Benefits: Keeps SKILL.md lean, loaded only when Claude determines it's needed
  • Best practice: If files are large (>10k words), include grep search patterns in SKILL.md
  • Avoid duplication: Information should live in either SKILL.md or references files, not both. Prefer references files for detailed information unless it's truly core to the skill—this keeps SKILL.md lean while making information discoverable without hogging the context window. Keep only essential procedural instructions and workflow guidance in SKILL.md; move detailed reference material, schemas, and examples to references files.
旨在根据需要加载到上下文的文档和参考资料,为Claude的处理和思考提供信息。
  • 何时包含:当Claude在工作中需要参考文档时
  • 示例:用于财务模式的
    references/finance.md
    、用于公司NDA模板的
    references/mnda.md
    、用于公司政策的
    references/policies.md
    、用于API规范的
    references/api_docs.md
  • 使用场景:数据库模式、API文档、领域知识、公司政策、详细工作流指南
  • 优势:保持SKILL.md简洁,仅在Claude确定需要时加载
  • 最佳实践:如果文件较大(>10000字),在SKILL.md中包含grep搜索模式
  • 避免重复:信息应仅存在于SKILL.md或参考文件中,不可同时存在。除非内容是Skill的核心,否则优先将详细信息放在参考文件中——这样可以保持SKILL.md简洁,同时让信息可被发现且不占用上下文窗口。仅在SKILL.md中保留必要的过程说明和工作流指导;将详细参考资料、模式和示例移至参考文件。
Assets (
assets/
)
资产(
assets/
Files not intended to be loaded into context, but rather used within the output Claude produces.
  • When to include: When the skill needs files that will be used in the final output
  • Examples:
    assets/logo.png
    for brand assets,
    assets/slides.pptx
    for PowerPoint templates,
    assets/frontend-template/
    for HTML/React boilerplate,
    assets/font.ttf
    for typography
  • Use cases: Templates, images, icons, boilerplate code, fonts, sample documents that get copied or modified
  • Benefits: Separates output resources from documentation, enables Claude to use files without loading them into context
不打算加载到上下文,而是用于Claude生成的输出中的文件。
  • 何时包含:当Skill需要在最终输出中使用文件时
  • 示例:用于品牌资产的
    assets/logo.png
    、用于PowerPoint模板的
    assets/slides.pptx
    、用于HTML/React模板的
    assets/frontend-template/
    、用于排版的
    assets/font.ttf
  • 使用场景:模板、图片、图标、样板代码、字体、可复制或修改的示例文档
  • 优势:将输出资源与文档分离,使Claude无需加载到上下文即可使用文件

Progressive Disclosure Design Principle

渐进式披露设计原则

Skills use a three-level loading system to manage context efficiently:
  1. Metadata (name + description) - Always in context (~100 words)
  2. SKILL.md body - When skill triggers (<5k words)
  3. Bundled resources - As needed by Claude (Unlimited*)
*Unlimited because scripts can be executed without reading into context window.
Skill采用三级加载系统来高效管理上下文:
  1. 元数据(名称+描述) - 始终在上下文中(约100字)
  2. SKILL.md主体 - 当Skill触发时(<5000字)
  3. 捆绑资源 - 根据Claude的需要加载(无限制*)
*无限制是因为脚本可以在不读取到上下文窗口的情况下执行。

Skill Creation Process

Skill创建流程

To create a skill, follow the "Skill Creation Process" in order, skipping steps only if there is a clear reason why they are not applicable.
要创建Skill,请按「Skill创建流程」的顺序操作,仅在有明确理由说明步骤不适用时才可跳过。

Step 1: Understanding the Skill with Concrete Examples

步骤1:通过具体示例理解Skill

Skip this step only when the skill's usage patterns are already clearly understood. It remains valuable even when working with an existing skill.
To create an effective skill, clearly understand concrete examples of how the skill will be used. This understanding can come from either direct user examples or generated examples that are validated with user feedback.
For example, when building an image-editor skill, relevant questions include:
  • "What functionality should the image-editor skill support? Editing, rotating, anything else?"
  • "Can you give some examples of how this skill would be used?"
  • "I can imagine users asking for things like 'Remove the red-eye from this image' or 'Rotate this image'. Are there other ways you imagine this skill being used?"
  • "What would a user say that should trigger this skill?"
To avoid overwhelming users, avoid asking too many questions in a single message. Start with the most important questions and follow up as needed for better effectiveness.
Conclude this step when there is a clear sense of the functionality the skill should support.
仅当Skill的使用模式已明确理解时才可跳过此步骤。即使处理现有Skill,此步骤仍有价值。
要创建有效的Skill,需明确理解Skill的具体使用示例。这种理解可以来自直接的用户示例,也可以来自经用户反馈验证的生成示例。
例如,在构建图像编辑器Skill时,相关问题包括:
  • 「图像编辑器Skill应支持哪些功能?编辑、旋转,还是其他?」
  • 「你能举一些该Skill的使用示例吗?」
  • 「我可以想象用户会要求诸如「去除这张图片的红眼」或「旋转这张图片」之类的操作。你认为用户还会以其他方式使用该Skill吗?」
  • 「用户说什么应该触发这个Skill?」
为避免给用户造成负担,请勿在一条消息中提出过多问题。从最重要的问题开始,根据需要跟进以获得更好的效果。
当明确了解Skill应支持的功能时,结束此步骤。

Step 2: Planning the Reusable Skill Contents

步骤2:规划可复用的Skill内容

To turn concrete examples into an effective skill, analyze each example by:
  1. Considering how to execute on the example from scratch
  2. Identifying what scripts, references, and assets would be helpful when executing these workflows repeatedly
Example: When building a
pdf-editor
skill to handle queries like "Help me rotate this PDF," the analysis shows:
  1. Rotating a PDF requires re-writing the same code each time
  2. A
    scripts/rotate_pdf.py
    script would be helpful to store in the skill
Example: When designing a
frontend-webapp-builder
skill for queries like "Build me a todo app" or "Build me a dashboard to track my steps," the analysis shows:
  1. Writing a frontend webapp requires the same boilerplate HTML/React each time
  2. An
    assets/hello-world/
    template containing the boilerplate HTML/React project files would be helpful to store in the skill
Example: When building a
big-query
skill to handle queries like "How many users have logged in today?" the analysis shows:
  1. Querying BigQuery requires re-discovering the table schemas and relationships each time
  2. A
    references/schema.md
    file documenting the table schemas would be helpful to store in the skill
For Claude Code plugins: When building a hooks skill, the analysis shows:
  1. Developers repeatedly need to validate hooks.json and test hook scripts
  2. scripts/validate-hook-schema.sh
    and
    scripts/test-hook.sh
    utilities would be helpful
  3. references/patterns.md
    for detailed hook patterns to avoid bloating SKILL.md
To establish the skill's contents, analyze each concrete example to create a list of the reusable resources to include: scripts, references, and assets.
要将具体示例转化为有效的Skill,请通过以下方式分析每个示例:
  1. 考虑如何从头开始执行示例
  2. 确定在重复执行这些工作流时,哪些脚本、参考资料和资产会有帮助
示例:当构建
pdf-editor
Skill来处理诸如「帮我旋转这个PDF」的查询时,分析表明:
  1. 旋转PDF需要每次重写相同的代码
  2. 在Skill中存储
    scripts/rotate_pdf.py
    脚本会很有帮助
示例:当为诸如「帮我构建一个待办事项应用」或「帮我构建一个跟踪步数的仪表板」的查询设计
frontend-webapp-builder
Skill时,分析表明:
  1. 编写前端Web应用每次都需要相同的HTML/React样板代码
  2. 在Skill中存储包含HTML/React项目样板文件的
    assets/hello-world/
    模板会很有帮助
示例:当构建
big-query
Skill来处理诸如「今天有多少用户登录?」的查询时,分析表明:
  1. 查询BigQuery需要每次重新发现表模式和关系
  2. 在Skill中存储记录表模式的
    references/schema.md
    文件会很有帮助
针对Claude Code插件:在构建钩子Skill时,分析表明:
  1. 开发人员反复需要验证hooks.json并测试钩子脚本
  2. scripts/validate-hook-schema.sh
    scripts/test-hook.sh
    工具会很有帮助
  3. references/patterns.md
    用于详细的钩子模式,避免SKILL.md过于臃肿
要确定Skill的内容,请分析每个具体示例,创建要包含的可复用资源列表:脚本、参考资料和资产。

Step 3: Create Skill Structure

步骤3:创建Skill结构

For Claude Code plugins, create the skill directory structure:
bash
mkdir -p plugin-name/skills/skill-name/{references,examples,scripts}
touch plugin-name/skills/skill-name/SKILL.md
Note: Unlike the generic skill-creator which uses
init_skill.py
, plugin skills are created directly in the plugin's
skills/
directory with a simpler manual structure.
对于Claude Code插件,请创建如下Skill目录结构:
bash
mkdir -p plugin-name/skills/skill-name/{references,examples,scripts}
touch plugin-name/skills/skill-name/SKILL.md
注意:与使用
init_skill.py
的通用Skill创建工具不同,插件Skill直接在插件的
skills/
目录中创建,结构更简单。

Step 4: Edit the Skill

步骤4:编辑Skill

When editing the (newly-created or existing) skill, remember that the skill is being created for another instance of Claude to use. Focus on including information that would be beneficial and non-obvious to Claude. Consider what procedural knowledge, domain-specific details, or reusable assets would help another Claude instance execute these tasks more effectively.
在编辑(新创建或现有)Skill时,请记住该Skill是为另一个Claude实例使用而创建的。重点包含对Claude有益且非显而易见的信息。考虑哪些过程知识、领域特定细节或可复用资产能帮助另一个Claude实例更有效地执行这些任务。

Start with Reusable Skill Contents

从可复用Skill内容开始

To begin implementation, start with the reusable resources identified above:
scripts/
,
references/
, and
assets/
files. Note that this step may require user input. For example, when implementing a
brand-guidelines
skill, the user may need to provide brand assets or templates to store in
assets/
, or documentation to store in
references/
.
Also, delete any example files and directories not needed for the skill. Create only the directories you actually need (references/, examples/, scripts/).
要开始实现,请从上述确定的可复用资源开始:
scripts/
references/
assets/
文件。请注意,此步骤可能需要用户输入。例如,在构建
brand-guidelines
Skill时,用户可能需要提供要存储在
assets/
中的品牌资产或模板,或要存储在
references/
中的文档。
此外,请删除Skill不需要的任何示例文件和目录。仅创建实际需要的目录(references/、examples/、scripts/)。

Update SKILL.md

更新SKILL.md

Writing Style: Write the entire skill using imperative/infinitive form (verb-first instructions), not second person. Use objective, instructional language (e.g., "To accomplish X, do Y" rather than "You should do X" or "If you need to do X"). This maintains consistency and clarity for AI consumption.
Description (Frontmatter): Use third-person format with specific trigger phrases. Max 300 characters:
yaml
---
name: skill-name
description: This skill should be used when the user asks to "specific phrase 1", "specific phrase 2", "specific phrase 3". Include exact phrases users would say that should trigger this skill. Be concrete and specific.
version: 0.1.0
---
Good description examples:
yaml
description: This skill should be used when the user asks to "create a hook", "add a PreToolUse hook", "validate tool use", "implement prompt-based hooks", or mentions hook events (PreToolUse, PostToolUse, Stop).
Bad description examples:
yaml
description: Use this skill when working with hooks.  # Wrong person, vague
description: Load when user needs hook help.  # Not third person
description: Provides hook guidance.  # No trigger phrases
To complete SKILL.md body, answer the following questions:
  1. What is the purpose of the skill, in a few sentences?
  2. When should the skill be used? (Include this in frontmatter description with specific triggers)
  3. In practice, how should Claude use the skill? All reusable skill contents developed above should be referenced so that Claude knows how to use them.
Keep SKILL.md lean: Target 1,500-2,000 words for the body. Move detailed content to references/:
  • Detailed patterns →
    references/patterns.md
  • Advanced techniques →
    references/advanced.md
  • Migration guides →
    references/migration.md
  • API references →
    references/api-reference.md
Reference resources in SKILL.md:
markdown
undefined
写作风格:整个Skill使用命令式/不定式形式(动词开头的指令),而非第二人称。使用客观的说明性语言(例如:「要完成X,请执行Y」而非「你应该执行X」或「如果你需要执行X」)。这样可以保持AI消费的一致性和清晰度。
描述(前置元数据):使用第三人称格式,包含特定触发短语。最多300个字符:
yaml
---
name: skill-name
description: This skill should be used when the user asks to "specific phrase 1", "specific phrase 2", "specific phrase 3". Include exact phrases users would say that should trigger this skill. Be concrete and specific.
---
好的描述示例
yaml
description: This skill should be used when the user asks to "create a hook", "add a PreToolUse hook", "validate tool use", "implement prompt-based hooks", or mentions hook events (PreToolUse, PostToolUse, Stop).
差的描述示例
yaml
description: Use this skill when working with hooks.  # 人称错误,表述模糊
description: Load when user needs hook help.  # 非第三人称
description: Provides hook guidance.  # 无触发短语
要完成SKILL.md主体,请回答以下问题:
  1. Skill的目的是什么?用几句话说明。
  2. 何时应使用该Skill?(在前置元数据描述中包含此内容,并附上具体触发词)
  3. 在实践中,Claude应如何使用该Skill?上述开发的所有可复用Skill内容都应被引用,以便Claude知道如何使用它们。
保持SKILL.md简洁:主体目标为1500-2000字。将详细内容移至references/:
  • 详细模式 →
    references/patterns.md
  • 高级技术 →
    references/advanced.md
  • 迁移指南 →
    references/migration.md
  • API参考 →
    references/api-reference.md
在SKILL.md中引用资源
markdown
undefined

Additional Resources

其他资源

Reference Files

参考文件

For detailed patterns and techniques, consult:
  • references/patterns.md
    - Common patterns
  • references/advanced.md
    - Advanced use cases
有关详细模式和技术,请参阅:
  • references/patterns.md
    - 常见模式
  • references/advanced.md
    - 高级用例

Example Files

示例文件

Working examples in
examples/
:
  • example-script.sh
    - Working example
undefined
examples/
中的工作示例:
  • example-script.sh
    - 工作示例
undefined

Step 5: Validate and Test

步骤5:验证和测试

For plugin skills, validation is different from generic skills:
  1. Check structure: Skill directory in
    plugin-name/skills/skill-name/
  2. Validate SKILL.md: Has frontmatter with name and description
  3. Check trigger phrases: Description includes specific user queries
  4. Verify writing style: Body uses imperative/infinitive form, not second person
  5. Test progressive disclosure: SKILL.md is lean (~1,500-2,000 words), detailed content in references/
  6. Check references: All referenced files exist
  7. Validate examples: Examples are complete and correct
  8. Test scripts: Scripts are executable and work correctly
Use the skill-reviewer agent:
Ask: "Review my skill and check if it follows best practices"
The skill-reviewer agent will check description quality, content organization, and progressive disclosure.
插件Skill的验证与通用Skill不同
  1. 检查结构:Skill目录位于
    plugin-name/skills/skill-name/
  2. 验证SKILL.md:包含带有name和description的前置元数据
  3. 检查触发短语:描述中包含特定用户查询
  4. 验证写作风格:主体使用命令式/不定式形式,而非第二人称
  5. 测试渐进式披露:SKILL.md简洁(约1500-2000字),详细内容在references/中
  6. 检查引用:所有引用的文件均存在
  7. 验证示例:示例完整且正确
  8. 测试脚本:脚本可执行且工作正常
使用skill-reviewer agent
Ask: "Review my skill and check if it follows best practices"
skill-reviewer agent将检查描述质量、内容组织和渐进式披露情况。

Step 6: Iterate

步骤6:迭代

After testing the skill, users may request improvements. Often this happens right after using the skill, with fresh context of how the skill performed.
Iteration workflow:
  1. Use the skill on real tasks
  2. Notice struggles or inefficiencies
  3. Identify how SKILL.md or bundled resources should be updated
  4. Implement changes and test again
Common improvements:
  • Strengthen trigger phrases in description
  • Move long sections from SKILL.md to references/
  • Add missing examples or scripts
  • Clarify ambiguous instructions
  • Add edge case handling
测试Skill后,用户可能会要求改进。通常这会在使用Skill后立即发生,此时用户对Skill的表现有清晰的上下文。
迭代工作流
  1. 在实际任务中使用Skill
  2. 注意遇到的困难或低效之处
  3. 确定应如何更新SKILL.md或捆绑资源
  4. 实施更改并再次测试
常见改进点
  • 强化描述中的触发短语
  • 将SKILL.md中的长段内容移至references/
  • 添加缺失的示例或脚本
  • 明确模糊的说明
  • 添加边缘情况处理

Plugin-Specific Considerations

插件特定注意事项

Skill Location in Plugins

Skill在插件中的位置

Plugin skills live in the plugin's
skills/
directory:
my-plugin/
├── .claude-plugin/
│   └── plugin.json
├── commands/
├── agents/
└── skills/
    └── my-skill/
        ├── SKILL.md
        ├── references/
        ├── examples/
        └── scripts/
插件Skill位于插件的
skills/
目录中:
my-plugin/
├── .claude-plugin/
│   └── plugin.json
├── commands/
├── agents/
└── skills/
    └── my-skill/
        ├── SKILL.md
        ├── references/
        ├── examples/
        └── scripts/

Auto-Discovery

自动发现

Claude Code automatically discovers skills:
  • Scans
    skills/
    directory
  • Finds subdirectories containing
    SKILL.md
  • Loads skill metadata (name + description) always
  • Loads SKILL.md body when skill triggers
  • Loads references/examples when needed
Claude Code会自动发现Skill:
  • 扫描
    skills/
    目录
  • 查找包含
    SKILL.md
    的子目录
  • 始终加载Skill元数据(名称+描述)
  • 当Skill触发时加载SKILL.md主体
  • 根据需要加载参考资料/示例

No Packaging Needed

无需打包

Plugin skills are distributed as part of the plugin, not as separate ZIP files. Users get skills when they install the plugin.
插件Skill作为插件的一部分分发,而非单独的ZIP文件。用户安装插件时即可获得Skill。

Testing in Plugins

在插件中测试

Test skills by installing plugin locally:
bash
undefined
通过本地安装插件来测试Skill:
bash
undefined

Test with --plugin-dir

使用--plugin-dir测试

cc --plugin-dir /path/to/plugin
cc --plugin-dir /path/to/plugin

Ask questions that should trigger the skill

提出应触发Skill的问题

Verify skill loads correctly

验证Skill是否正确加载

undefined
undefined

Examples from Plugin-Dev

Plugin-Dev中的示例

Study the skills in this plugin as examples of best practices:
hook-development skill:
  • Excellent trigger phrases: "create a hook", "add a PreToolUse hook", etc.
  • Lean SKILL.md (1,651 words)
  • 3 references/ files for detailed content
  • 3 examples/ of working hooks
  • 3 scripts/ utilities
agent-development skill:
  • Strong triggers: "create an agent", "agent frontmatter", etc.
  • Focused SKILL.md (1,438 words)
  • References include the AI generation prompt from Claude Code
  • Complete agent examples
plugin-settings skill:
  • Specific triggers: "plugin settings", ".local.md files", "YAML frontmatter"
  • References show real implementations (multi-agent-swarm, ralph-wiggum)
  • Working parsing scripts
Each demonstrates progressive disclosure and strong triggering.
研究此插件中的Skill,作为最佳实践的示例:
hook-development skill
  • 出色的触发短语:「create a hook」「add a PreToolUse hook」等
  • 简洁的SKILL.md(1651字)
  • 3个references/文件用于详细内容
  • 3个examples/工作钩子示例
  • 3个scripts/工具
agent-development skill
  • 明确的触发词:「create an agent」「agent frontmatter」等
  • 聚焦的SKILL.md(1438字)
  • 参考资料包含Claude Code的AI生成提示
  • 完整的Agent示例
plugin-settings skill
  • 特定触发词:「plugin settings」「.local.md files」「YAML frontmatter」
  • 参考资料展示了实际实现(multi-agent-swarm, ralph-wiggum)
  • 可用的解析脚本
每个示例都展示了渐进式披露和有效的触发机制。

Progressive Disclosure in Practice

渐进式披露的实践

What Goes in SKILL.md

SKILL.md中应包含的内容

Include (always loaded when skill triggers):
  • Core concepts and overview
  • Essential procedures and workflows
  • Quick reference tables
  • Pointers to references/examples/scripts
  • Most common use cases
Keep under 3,000 words, ideally 1,500-2,000 words
包含(Skill触发时始终加载)
  • 核心概念和概述
  • 必要的过程和工作流
  • 快速参考表
  • 指向参考资料/示例/脚本的指针
  • 最常见的使用场景
保持在3000字以内,理想为1500-2000字

What Goes in references/

应移至references/的内容

Move to references/ (loaded as needed):
  • Detailed patterns and advanced techniques
  • Comprehensive API documentation
  • Migration guides
  • Edge cases and troubleshooting
  • Extensive examples and walkthroughs
Each reference file can be large (2,000-5,000+ words)
移至references/(根据需要加载)
  • 详细模式和高级技术
  • 全面的API文档
  • 迁移指南
  • 边缘情况和故障排除
  • 大量示例和演练
每个参考文件可以很大(2000-5000+字)

What Goes in examples/

应移至examples/的内容

Working code examples:
  • Complete, runnable scripts
  • Configuration files
  • Template files
  • Real-world usage examples
Users can copy and adapt these directly
工作代码示例
  • 完整、可运行的脚本
  • 配置文件
  • 模板文件
  • 实际使用示例
用户可以直接复制和调整这些示例

What Goes in scripts/

应移至scripts/的内容

Utility scripts:
  • Validation tools
  • Testing helpers
  • Parsing utilities
  • Automation scripts
Should be executable and documented
工具脚本
  • 验证工具
  • 测试助手
  • 解析工具
  • 自动化脚本
应可执行且有文档说明

Writing Style Requirements

写作风格要求

Imperative/Infinitive Form

命令式/不定式形式

Write using verb-first instructions, not second person:
Correct (imperative):
To create a hook, define the event type.
Configure the MCP server with authentication.
Validate settings before use.
Incorrect (second person):
You should create a hook by defining the event type.
You need to configure the MCP server.
You must validate settings before use.
使用动词开头的指令,而非第二人称:
正确(命令式)
要创建钩子,请定义事件类型。
使用身份验证配置MCP服务器。
使用前验证设置。
错误(第二人称)
你应该通过定义事件类型来创建钩子。
你需要配置MCP服务器。
你必须在使用前验证设置。

Third-Person in Description

描述使用第三人称

The frontmatter description must use third person:
Correct:
yaml
description: This skill should be used when the user asks to "create X", "configure Y"...
Incorrect:
yaml
description: Use this skill when you want to create X...
description: Load this skill when user asks...
前置元数据描述必须使用第三人称:
正确
yaml
description: This skill should be used when the user asks to "create X", "configure Y"...
错误
yaml
description: Use this skill when you want to create X...
description: Load this skill when user asks...

Objective, Instructional Language

客观的说明性语言

Focus on what to do, not who should do it:
Correct:
Parse the frontmatter using sed.
Extract fields with grep.
Validate values before use.
Incorrect:
You can parse the frontmatter...
Claude should extract fields...
The user might validate values...
专注于要做什么,而非谁应该做:
正确
使用sed解析前置元数据。
使用grep提取字段。
使用前验证值。
错误
你可以解析前置元数据...
Claude应该提取字段...
用户可能会验证值...

Validation Checklist

验证清单

Before finalizing a skill:
Structure:
  • SKILL.md file exists with valid YAML frontmatter
  • Frontmatter has
    name
    and
    description
    fields
  • Markdown body is present and substantial
  • Referenced files actually exist
Description Quality:
  • Uses third person ("This skill should be used when...")
  • Includes specific trigger phrases users would say
  • Lists concrete scenarios ("create X", "configure Y")
  • Not vague or generic
  • Description is max 300 characters
Content Quality:
  • SKILL.md body uses imperative/infinitive form
  • Body is focused and lean (1,500-2,000 words ideal, <5k max)
  • Detailed content moved to references/
  • Examples are complete and working
  • Scripts are executable and documented
Progressive Disclosure:
  • Core concepts in SKILL.md
  • Detailed docs in references/
  • Working code in examples/
  • Utilities in scripts/
  • SKILL.md references these resources
Testing:
  • Skill triggers on expected user queries
  • Content is helpful for intended tasks
  • No duplicated information across files
  • References load when needed
最终确定Skill前:
结构
  • 存在SKILL.md文件,且包含有效的YAML前置元数据
  • 前置元数据包含
    name
    description
    字段
  • 存在Markdown主体且内容充实
  • 引用的文件实际存在
描述质量
  • 使用第三人称(「当...时应使用本Skill」)
  • 包含用户会说的特定触发短语
  • 列出具体场景(「创建X」「配置Y」)
  • 表述不模糊或通用
  • 描述最多300个字符
内容质量
  • SKILL.md主体使用命令式/不定式形式
  • 主体聚焦且简洁(理想1500-2000字,最多<5000字)
  • 详细内容已移至references/
  • 示例完整且可运行
  • 脚本可执行且有文档说明
渐进式披露
  • 核心概念在SKILL.md中
  • 详细文档在references/
  • 工作代码在examples/
  • 工具在scripts/
  • SKILL.md引用了这些资源
测试
  • Skill在预期用户查询时触发
  • 内容对预期任务有帮助
  • 文件间无重复信息
  • 参考资料在需要时加载

Common Mistakes to Avoid

应避免的常见错误

Mistake 1: Weak Trigger Description

错误1:触发描述薄弱

Bad:
yaml
description: Provides guidance for working with hooks.
Why bad: Vague, no specific trigger phrases, not third person
Good:
yaml
description: This skill should be used when the user asks to "create a hook", "add a PreToolUse hook", "validate tool use", or mentions hook events. Provides comprehensive hooks API guidance.
Why good: Third person, specific phrases, concrete scenarios
yaml
description: Provides guidance for working with hooks.
原因:表述模糊,无特定触发短语,非第三人称
yaml
description: This skill should be used when the user asks to "create a hook", "add a PreToolUse hook", "validate tool use", or mentions hook events. Provides comprehensive hooks API guidance.
原因:第三人称,特定短语,具体场景

Mistake 2: Too Much in SKILL.md

错误2:SKILL.md内容过多

Bad:
skill-name/
└── SKILL.md  (8,000 words - everything in one file)
Why bad: Bloats context when skill loads, detailed content always loaded
Good:
skill-name/
├── SKILL.md  (1,800 words - core essentials)
└── references/
    ├── patterns.md (2,500 words)
    └── advanced.md (3,700 words)
Why good: Progressive disclosure, detailed content loaded only when needed
skill-name/
└── SKILL.md  (8000字 - 所有内容在一个文件中)
原因:Skill加载时会膨胀上下文,详细内容始终被加载
skill-name/
├── SKILL.md  (1800字 - 核心要点)
└── references/
    ├── patterns.md (2500字)
    └── advanced.md (3700字)
原因:渐进式披露,仅在需要时加载详细内容

Mistake 3: Second Person Writing

错误3:使用第二人称写作

Bad:
markdown
You should start by reading the configuration file.
You need to validate the input.
You can use the grep tool to search.
Why bad: Second person, not imperative form
Good:
markdown
Start by reading the configuration file.
Validate the input before processing.
Use the grep tool to search for patterns.
Why good: Imperative form, direct instructions
markdown
你应该先阅读配置文件。
你需要验证输入。
你可以使用grep工具进行搜索。
原因:第二人称,非命令式形式
markdown
先阅读配置文件。
处理前验证输入。
使用grep工具搜索模式。
原因:命令式形式,直接指令

Mistake 4: Missing Resource References

错误4:未引用资源

Bad:
markdown
undefined
markdown
undefined

SKILL.md

SKILL.md

[Core content]
[No mention of references/ or examples/]

**Why bad:** Claude doesn't know references exist
[核心内容]
[未提及references/或examples/]

**原因**:Claude不知道参考资料存在

Mistake 5: Incorrect Name Metadata Format

错误5:名称元数据格式错误

Bad:
yaml
name: Skill Name
Why bad: Name should be lowercase with hyphens
Good:
yaml
name: skill-name
yaml
name: Skill Name
原因:名称应使用小写连字符格式
yaml
name: skill-name

Additional Resources

其他资源

Reference Files

参考文件

  • references/patterns.md
    - Detailed patterns
  • references/advanced.md
    - Advanced techniques
  • references/patterns.md
    - 详细模式
  • references/advanced.md
    - 高级技术

Examples

示例

  • examples/script.sh
    - Working example

**Why good:** Claude knows where to find additional information
  • examples/script.sh
    - 工作示例

**原因**:Claude知道在哪里找到额外信息

Quick Reference

快速参考

Minimal Skill

最小Skill


skill-name/
└── SKILL.md
Good for: Simple knowledge, no complex resources needed

skill-name/
└── SKILL.md
适用场景:简单知识,无需复杂资源

Standard Skill (Recommended)

标准Skill(推荐)


skill-name/
├── SKILL.md
├── references/
│ └── detailed-guide.md
└── examples/
└── working-example.sh
Good for: Most plugin skills with detailed documentation

skill-name/
├── SKILL.md
├── references/
│ └── detailed-guide.md
└── examples/
└── working-example.sh
适用场景:大多数带有详细文档的插件Skill

Complete Skill

完整Skill


skill-name/
├── SKILL.md
├── references/
│ ├── patterns.md
│ └── advanced.md
├── examples/
│ ├── example1.sh
│ └── example2.json
└── scripts/
└── validate.sh
Good for: Complex domains with validation utilities

skill-name/
├── SKILL.md
├── references/
│ ├── patterns.md
│ └── advanced.md
├── examples/
│ ├── example1.sh
│ └── example2.json
└── scripts/
└── validate.sh
适用场景:带有验证工具的复杂领域

Best Practices Summary

最佳实践总结

DO:
  • Use third-person in description ("This skill should be used when...")
  • Include specific trigger phrases ("create X", "configure Y")
  • Keep SKILL.md lean (1,500-2,000 words)
  • Use progressive disclosure (move details to references/)
  • Write in imperative/infinitive form
  • Reference supporting files clearly
  • Provide working examples
  • Create utility scripts for common operations
  • Study plugin-dev's skills as templates
DON'T:
  • Use second person anywhere
  • Have vague trigger conditions
  • Put everything in SKILL.md (>3,000 words without references/)
  • Write in second person ("You should...")
  • Leave resources unreferenced
  • Include broken or incomplete examples
  • Skip validation
应做
  • 描述使用第三人称(「当...时应使用本Skill」)
  • 包含特定触发短语(「创建X」「配置Y」)
  • 保持SKILL.md简洁(1500-2000字)
  • 使用渐进式披露(将详细内容移至references/)
  • 使用命令式/不定式形式写作
  • 明确引用支持文件
  • 提供可运行示例
  • 为常见操作创建工具脚本
  • 以plugin-dev的Skill为模板进行学习
不应做
  • 任何地方使用第二人称
  • 触发条件模糊
  • 所有内容都放在SKILL.md中(>3000字且无references/)
  • 使用第二人称写作(「你应该...」)
  • 资源未被引用
  • 包含损坏或不完整的示例
  • 跳过验证

Additional Resources

其他资源

Study These Skills

学习这些Skill

Plugin-dev's skills demonstrate best practices:
  • ../hook-development/
    - Progressive disclosure, utilities
  • ../agent-development/
    - AI-assisted creation, references
  • ../mcp-integration/
    - Comprehensive references
  • ../plugin-settings/
    - Real-world examples
  • ../command-development/
    - Clear critical concepts
  • ../plugin-structure/
    - Good organization
Plugin-dev的Skill展示了最佳实践:
  • ../hook-development/
    - 渐进式披露、工具
  • ../agent-development/
    - AI辅助创建、参考资料
  • ../mcp-integration/
    - 全面参考资料
  • ../plugin-settings/
    - 实际示例
  • ../command-development/
    - 明确的关键概念
  • ../plugin-structure/
    - 良好的组织

Reference Files

参考文件

For complete skill-creator methodology:
  • references/skill-creator-original.md
    - Full original skill-creator content
完整的Skill创建方法:
  • references/skill-creator-original.md
    - 完整的原始Skill创建工具内容

Implementation Workflow

实现工作流

To create a skill for your plugin:
  1. Understand use cases: Identify concrete examples of skill usage
  2. Plan resources: Determine what scripts/references/examples needed
  3. Create structure:
    mkdir -p skills/skill-name/{references,examples,scripts}
  4. Write SKILL.md:
    • Frontmatter with third-person description and trigger phrases
    • Lean body (1,500-2,000 words) in imperative form
    • Reference supporting files
  5. Add resources: Create references/, examples/, scripts/ as needed
  6. Validate: Check description, writing style, organization
  7. Test: Verify skill loads on expected triggers
  8. Iterate: Improve based on usage
Focus on strong trigger descriptions, progressive disclosure, and imperative writing style for effective skills that load when needed and provide targeted guidance.
undefined
要为你的插件创建Skill:
  1. 理解使用场景:确定Skill使用的具体示例
  2. 规划资源:确定需要哪些脚本/参考资料/示例
  3. 创建结构
    mkdir -p skills/skill-name/{references,examples,scripts}
  4. 编写SKILL.md
    • 包含第三人称描述和触发短语的前置元数据
    • 命令式形式的简洁主体(1500-2000字)
    • 引用支持文件
  5. 添加资源:根据需要创建references/、examples/、scripts/
  6. 验证:检查描述、写作风格、组织
  7. 测试:验证Skill在预期触发时加载
  8. 迭代:根据使用情况改进
专注于明确的触发描述、渐进式披露和命令式写作风格,以创建在需要时加载并提供针对性指导的有效Skill。