skill-creator

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Skill Creator

Skill创建工具

This skill provides guidance for creating effective skills.
Official Documentation: https://code.claude.com/docs/llms.txt Fetch the complete documentation index to discover all available pages.
本技能为创建有效的Skills提供指导。
官方文档https://code.claude.com/docs/llms.txt 获取完整文档索引以探索所有可用页面。

About Skills

关于Skills

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.
Skills是模块化、独立的软件包,通过提供专业知识、工作流和工具来扩展Claude的能力。可以将其视为特定领域或任务的“入门指南”——它们将Claude从通用Agent转变为具备过程知识的专业Agent,而这些过程知识是任何模型都无法完全拥有的。

What Skills Provide

Skills提供的能力

  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. 捆绑资源 - 用于复杂重复任务的脚本、参考资料和资产

Core Principles

核心原则

Concise is Key

简洁至上

The context window is a public good. Skills share the context window with everything else Claude needs: system prompt, conversation history, other Skills' metadata, and the actual user request.
Default assumption: Claude is already very smart. Only add context Claude doesn't already have. Challenge each piece of information: "Does Claude really need this explanation?" and "Does this paragraph justify its token cost?"
Prefer concise examples over verbose explanations.
上下文窗口是公共资源。Skills需要与Claude所需的其他所有内容共享上下文窗口:系统提示词、对话历史、其他Skills的元数据以及实际用户请求。
默认假设:Claude已经非常智能。 仅添加Claude尚不具备的上下文信息。对每一条信息都要提出质疑:“Claude真的需要这个解释吗?”以及“这段内容是否值得其占用的token成本?”
优先使用简洁的示例而非冗长的解释。

Set Appropriate Degrees of Freedom

设置适当的自由度

Match the level of specificity to the task's fragility and variability:
High freedom (text-based instructions): Use when multiple approaches are valid, decisions depend on context, or heuristics guide the approach.
Medium freedom (pseudocode or scripts with parameters): Use when a preferred pattern exists, some variation is acceptable, or configuration affects behavior.
Low freedom (specific scripts, few parameters): Use when operations are fragile and error-prone, consistency is critical, or a specific sequence must be followed.
Think of Claude as exploring a path: a narrow bridge with cliffs needs specific guardrails (low freedom), while an open field allows many routes (high freedom).
将内容的具体程度与任务的脆弱性和可变性相匹配:
高自由度(基于文本的指令):当存在多种有效方法、决策依赖于上下文,或需要启发式方法指导时使用。
中等自由度(带参数的伪代码或脚本):当存在首选模式、允许一定程度的变化,或配置会影响行为时使用。
低自由度(特定脚本,少量参数):当操作脆弱且容易出错、一致性至关重要,或必须遵循特定顺序时使用。
可以将Claude视为在探索路径:悬崖边的狭窄桥梁需要特定的护栏(低自由度),而开阔的田野则允许多种路线(高自由度)。

Where Skills Live

Skills的存储位置

LocationPathApplies to
EnterpriseManaged settingsAll users in organization
Personal
~/.claude/skills/<skill-name>/SKILL.md
All your projects
Project
.claude/skills/<skill-name>/SKILL.md
This project only
Plugin
<plugin>/skills/<skill-name>/SKILL.md
Where plugin is enabled
Higher-priority locations win when skills share the same name: enterprise > personal > project.
Nested discovery: When working with files in subdirectories, Claude Code automatically discovers skills from nested
.claude/skills/
directories (supports monorepos).
位置路径适用范围
企业级托管设置组织内所有用户
个人版
~/.claude/skills/<skill-name>/SKILL.md
你的所有项目
项目级
.claude/skills/<skill-name>/SKILL.md
仅当前项目
插件版
<plugin>/skills/<skill-name>/SKILL.md
插件启用的位置
当多个Skills同名时,优先级更高的位置会覆盖其他:企业级 > 个人版 > 项目级。
嵌套发现:处理子目录中的文件时,Claude Code会自动发现嵌套
.claude/skills/
目录中的Skills(支持单体仓库)。

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
│   │   ├── name: (optional, defaults to directory name)
│   │   └── description: (recommended)
│   └── 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 (必填)
│   ├── YAML前置元数据
│   │   ├── name: (可选,默认使用目录名称)
│   │   └── description: (推荐填写)
│   └── Markdown指令 (必填)
└── 捆绑资源 (可选)
    ├── scripts/          - 可执行代码(Python/Bash等)
    ├── references/       - 可根据需要加载到上下文的文档
    └── assets/           - 输出中使用的文件(模板、图标、字体等)

SKILL.md (required)

SKILL.md (必填)

Every SKILL.md consists of:
  • Frontmatter (YAML): Configuration fields like
    name
    ,
    description
    ,
    context
    ,
    agent
    ,
    allowed-tools
    , etc. The
    description
    field is most important - Claude uses it to decide when to load the skill automatically.
  • Body (Markdown): Instructions and guidance for using the skill. Only loaded AFTER the skill triggers (if at all).
每个SKILL.md包含:
  • 前置元数据(YAML):配置字段如
    name
    description
    context
    agent
    allowed-tools
    等。
    description
    字段最为重要——Claude会根据它来决定何时自动加载该技能。
  • 正文(Markdown):使用该技能的指令和指南。仅在技能触发后才会加载(如果需要的话)。

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等)。
  • 何时包含:当相同代码需要重复编写,或需要确定性可靠性时
  • 示例
    scripts/rotate_pdf.py
    用于PDF旋转任务
  • 优势: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
    用于财务架构、
    references/mnda.md
    用于公司NDA模板、
    references/policies.md
    用于公司政策、
    references/api_docs.md
    用于API规范
  • 使用场景:数据库架构、API文档、领域知识、公司政策、详细工作流指南
  • 优势:保持SKILL.md简洁,仅在Claude确定需要时才加载
  • 最佳实践:如果文件较大(>10000字),在SKILL.md中包含grep搜索模式
  • 避免重复:信息应仅存在于SKILL.md或参考文件中,不要重复。除非是技能的核心内容,否则优先将详细信息放在参考文件中——这样可以保持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生成的输出中的文件。
  • 何时包含:当技能需要在最终输出中使用文件时
  • 示例
    assets/logo.png
    用于品牌资产、
    assets/slides.pptx
    用于PowerPoint模板、
    assets/frontend-template/
    用于HTML/React样板代码、
    assets/font.ttf
    用于字体
  • 使用场景:模板、图片、图标、样板代码、字体、可复制或修改的示例文档
  • 优势:将输出资源与文档分离,使Claude无需加载到上下文即可使用文件

What to Not Include in a Skill

Skill中不应包含的内容

A skill should only contain essential files that directly support its functionality. Do NOT create extraneous documentation or auxiliary files, including:
  • README.md
  • INSTALLATION_GUIDE.md
  • QUICK_REFERENCE.md
  • CHANGELOG.md
  • etc.
The skill should only contain the information needed for an AI agent to do the job at hand. It should not contain auxilary context about the process that went into creating it, setup and testing procedures, user-facing documentation, etc. Creating additional documentation files just adds clutter and confusion.
Skill应仅包含直接支持其功能的必要文件。请勿创建无关的文档或辅助文件,包括:
  • README.md
  • INSTALLATION_GUIDE.md
  • QUICK_REFERENCE.md
  • CHANGELOG.md
  • 等等
Skill应仅包含AI Agent完成工作所需的信息。不应包含关于创建过程、设置和测试流程、面向用户的文档等辅助上下文。创建额外的文档文件只会增加混乱和混淆。

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 because scripts can be executed without reading into context window)
Skills使用三级加载系统来高效管理上下文:
  1. 元数据(名称+描述) - 始终在上下文中(约100词)
  2. SKILL.md正文 - 技能触发时加载(<5000词)
  3. 捆绑资源 - 根据Claude的需要加载(无限制,因为脚本可以在不读取到上下文窗口的情况下执行)

Progressive Disclosure Patterns

渐进式披露模式

Keep SKILL.md body to the essentials and under 500 lines to minimize context bloat. Split content into separate files when approaching this limit. When splitting out content into other files, it is very important to reference them from SKILL.md and describe clearly when to read them, to ensure the reader of the skill knows they exist and when to use them.
Key principle: When a skill supports multiple variations, frameworks, or options, keep only the core workflow and selection guidance in SKILL.md. Move variant-specific details (patterns, examples, configuration) into separate reference files.
Pattern 1: High-level guide with references
markdown
undefined
将SKILL.md正文控制在必要内容范围内,且不超过500行,以最小化上下文膨胀。当接近此限制时,将内容拆分为单独的文件。将内容拆分到其他文件时,非常重要的一点是要在SKILL.md中引用它们,并清楚描述何时读取它们,以确保Skill的使用者知道它们的存在和使用时机。
核心原则:当一个Skill支持多种变体、框架或选项时,仅在SKILL.md中保留核心工作流和选择指南。将变体特定的细节(模式、示例、配置)移至单独的参考文件中。
模式1:带参考资料的高级指南
markdown
undefined

PDF Processing

PDF处理

Quick start

快速开始

Extract text with pdfplumber: [code example]
使用pdfplumber提取文本: [代码示例]

Advanced features

高级功能

  • Form filling: See FORMS.md for complete guide
  • API reference: See REFERENCE.md for all methods
  • Examples: See EXAMPLES.md for common patterns

Claude loads FORMS.md, REFERENCE.md, or EXAMPLES.md only when needed.

**Pattern 2: Domain-specific organization**

For Skills with multiple domains, organize content by domain to avoid loading irrelevant context:
bigquery-skill/ ├── SKILL.md (overview and navigation) └── reference/ ├── finance.md (revenue, billing metrics) ├── sales.md (opportunities, pipeline) ├── product.md (API usage, features) └── marketing.md (campaigns, attribution)

When a user asks about sales metrics, Claude only reads sales.md.

Similarly, for skills supporting multiple frameworks or variants, organize by variant:
cloud-deploy/ ├── SKILL.md (workflow + provider selection) └── references/ ├── aws.md (AWS deployment patterns) ├── gcp.md (GCP deployment patterns) └── azure.md (Azure deployment patterns)

When the user chooses AWS, Claude only reads aws.md.

**Pattern 3: Conditional details**

Show basic content, link to advanced content:

```markdown
  • 表单填充:完整指南请参见FORMS.md
  • API参考:所有方法请参见REFERENCE.md
  • 示例:常见模式请参见EXAMPLES.md

Claude仅在需要时才加载FORMS.md、REFERENCE.md或EXAMPLES.md。

**模式2:按领域组织**

对于涉及多个领域的Skills,按领域组织内容以避免加载无关上下文:
bigquery-skill/ ├── SKILL.md (概述和导航) └── reference/ ├── finance.md (收入、计费指标) ├── sales.md (商机、销售管道) ├── product.md (API使用、功能) └── marketing.md (营销活动、归因)

当用户询问销售指标时,Claude仅读取sales.md。

类似地,对于支持多种框架或变体的Skills,按变体组织:
cloud-deploy/ ├── SKILL.md (工作流+供应商选择) └── references/ ├── aws.md (AWS部署模式) ├── gcp.md (GCP部署模式) └── azure.md (Azure部署模式)

当用户选择AWS时,Claude仅读取aws.md。

**模式3:条件式详情**

显示基础内容,链接到高级内容:

```markdown

DOCX Processing

DOCX处理

Creating documents

创建文档

Use docx-js for new documents. See DOCX-JS.md.
使用docx-js创建新文档。请参见DOCX-JS.md

Editing documents

编辑文档

For simple edits, modify the XML directly.
For tracked changes: See REDLINING.md For OOXML details: See OOXML.md

Claude reads REDLINING.md or OOXML.md only when the user needs those features.

**Important guidelines:**

- **Avoid deeply nested references** - Keep references one level deep from SKILL.md. All reference files should link directly from SKILL.md.
- **Structure longer reference files** - For files longer than 100 lines, include a table of contents at the top so Claude can see the full scope when previewing.
对于简单编辑,直接修改XML即可。
对于修订跟踪:请参见REDLINING.md 对于OOXML详情:请参见OOXML.md

Claude仅在用户需要这些功能时才读取REDLINING.md或OOXML.md。

**重要指南**:

- **避免深度嵌套参考** - 参考文件应仅从SKILL.md一级链接。所有参考文件都应直接从SKILL.md链接。
- **结构化较长的参考文件** - 对于超过100行的文件,在顶部添加目录,以便Claude预览时能看到完整范围。

Skill Creation Process

Skill创建流程

Skill creation involves these steps:
  1. Understand the skill with concrete examples
  2. Plan reusable skill contents (scripts, references, assets)
  3. Initialize the skill (run init-skill.ts)
  4. Edit the skill (implement resources and write SKILL.md)
  5. Package the skill (run package-skill.ts)
  6. Iterate based on real usage
Follow these steps in order, skipping only if there is a clear reason why they are not applicable.
Skill创建包含以下步骤:
  1. 通过具体示例理解Skill的用途
  2. 规划可重用的Skill内容(脚本、参考资料、资产)
  3. 初始化Skill(运行init-skill.ts)
  4. 编辑Skill(实现资源并编写SKILL.md)
  5. 打包Skill(运行package-skill.ts)
  6. 根据实际使用情况迭代优化
按顺序执行这些步骤,仅当有明确理由不适用时才跳过。

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
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
    文件会很有帮助
要确定Skill的内容,需分析每个具体示例,创建要包含的可重用资源列表:脚本、参考资料和资产。

Step 3: Initializing the Skill

步骤3:初始化Skill

At this point, it is time to actually create the skill.
Skip this step only if the skill being developed already exists, and iteration or packaging is needed. In this case, continue to the next step.
When creating a new skill from scratch, always run the
init-skill.ts
script. The script conveniently generates a new template skill directory that automatically includes everything a skill requires, making the skill creation process much more efficient and reliable.
Usage:
bash
bun scripts/init-skill.ts <skill-name> --path <output-directory>
The script:
  • Creates the skill directory at the specified path
  • Generates a SKILL.md template with proper frontmatter and TODO placeholders
  • Creates example resource directories:
    scripts/
    ,
    references/
    , and
    assets/
  • Adds example files in each directory that can be customized or deleted
After initialization, customize or remove the generated SKILL.md and example files as needed.
此时可以实际创建Skill了。
仅当正在开发的Skill已存在,且需要迭代或打包时才跳过此步骤。在这种情况下,继续下一步。
从头开始创建新Skill时,始终运行
init-skill.ts
脚本。该脚本会方便地生成一个新的模板Skill目录,自动包含Skill所需的所有内容,使Skill创建过程更加高效和可靠。
用法:
bash
bun scripts/init-skill.ts <skill-name> --path <output-directory>
该脚本会:
  • 在指定路径创建Skill目录
  • 生成带有正确前置元数据和TODO占位符的SKILL.md模板
  • 创建示例资源目录:
    scripts/
    references/
    assets/
  • 在每个目录中添加可自定义或删除的示例文件
初始化后,根据需要自定义或删除生成的SKILL.md和示例文件。

Step 4: Edit the Skill

步骤4:编辑Skill

When editing the (newly-generated or existing) skill, remember that the skill is being created for another instance of Claude to use. Include 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实例更有效地执行这些任务。

Learn Proven Design Patterns

学习经过验证的设计模式

Consult these helpful guides based on your skill's needs:
  • Multi-step processes: See references/workflows.md for sequential workflows and conditional logic
  • Specific output formats or quality standards: See references/output-patterns.md for template and example patterns
These files contain established best practices for effective skill design.
根据Skill的需求,参考以下有用的指南:
  • 多步骤流程:请参见references/workflows.md了解顺序工作流和条件逻辑
  • 特定输出格式或质量标准:请参见references/output-patterns.md了解模板和示例模式
这些文件包含有效Skill设计的既定最佳实践。

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/
.
Added scripts must be tested by actually running them to ensure there are no bugs and that the output matches what is expected. If there are many similar scripts, only a representative sample needs to be tested to ensure confidence that they all work while balancing time to completion.
Any example files and directories not needed for the skill should be deleted. The initialization script creates example files in
scripts/
,
references/
, and
assets/
to demonstrate structure, but most skills won't need all of them.
开始实现时,先处理上面确定的可重用资源:
scripts/
references/
assets/
文件。请注意此步骤可能需要用户输入。例如,构建
brand-guidelines
Skill时,用户可能需要提供品牌资产或模板以存储在
assets/
中,或提供文档以存储在
references/
中。
添加的脚本必须通过实际运行进行测试,以确保没有错误且输出符合预期。如果有许多类似的脚本,只需测试代表性样本即可,在确保所有脚本正常工作的同时平衡完成时间。
删除Skill不需要的任何示例文件和目录。初始化脚本会在
scripts/
references/
assets/
中创建示例文件以展示结构,但大多数Skill不需要所有这些文件。

Update SKILL.md

更新SKILL.md

Writing Guidelines: Always use imperative/infinitive form.
编写指南:始终使用命令式/不定式形式。
Frontmatter
前置元数据
Write the YAML frontmatter. All fields are optional except
description
which is recommended.
Core fields:
  • name
    : Display name (lowercase letters, numbers, hyphens, max 64 chars). If omitted, uses directory name.
  • description
    : What the skill does and when to use it. Claude uses this to decide when to load the skill automatically.
    • Example: "Explains code with diagrams and analogies. Use when explaining how code works or when user asks 'how does this work?'"
Invocation control:
  • disable-model-invocation: true
    - Only user can invoke (prevents Claude auto-loading). Use for workflows with side effects like
    /deploy
    .
  • user-invocable: false
    - Only Claude can invoke. Use for background knowledge that isn't actionable as a command.
  • argument-hint
    : Hint shown during autocomplete. Example:
    [issue-number]
    or
    [filename]
Execution control:
  • allowed-tools
    : Tools Claude can use without asking permission when skill is active.
  • model
    : Model to use when skill is active.
  • context: fork
    - Run in a forked subagent context (isolated, no conversation history).
  • agent
    : Which subagent type to use when
    context: fork
    is set (e.g.,
    Explore
    ,
    Plan
    ,
    general-purpose
    , or custom agent).
  • hooks
    : Hooks scoped to this skill's lifecycle.
String substitutions (in skill content):
  • $ARGUMENTS
    - All arguments passed when invoking the skill
  • ${CLAUDE_SESSION_ID}
    - Current session ID
Dynamic context injection: Prefix a shell command with exclamation mark and wrap in backticks to run it before the skill content is sent to Claude. The output replaces the placeholder.
Syntax: exclamation + backtick + command + backtick (e.g., for "gh pr diff")
Subagent execution example:
yaml
---
name: deep-research
description: Research a topic thoroughly
context: fork
agent: Explore
---

Research $ARGUMENTS thoroughly:
1. Find relevant files using Glob and Grep
2. Read and analyze the code
3. Summarize findings with file references
See official documentation: https://code.claude.com/docs/llms.txt
编写YAML前置元数据。除
description
(推荐填写)外,所有字段都是可选的。
核心字段
  • name
    :显示名称(小写字母、数字、连字符,最多64个字符)。如果省略,使用目录名称。
  • description
    :Skill的功能和使用时机。Claude使用此字段来决定何时自动加载该Skill。
    • 示例:“使用图表和类比解释代码。当解释代码工作原理或用户询问‘这是如何工作的?’时使用。”
调用控制
  • disable-model-invocation: true
    - 仅用户可调用(防止Claude自动加载)。用于有副作用的工作流,如
    /deploy
  • user-invocable: false
    - 仅Claude可调用。用于无法作为命令执行的背景知识。
  • argument-hint
    :自动完成时显示的提示。示例:
    [issue-number]
    [filename]
执行控制
  • allowed-tools
    :Skill激活时Claude无需询问即可使用的工具。
  • model
    :Skill激活时使用的模型。
  • context: fork
    - 在分叉的子Agent上下文中运行(隔离,无对话历史)。
  • agent
    :设置
    context: fork
    时使用的子Agent类型(例如
    Explore
    Plan
    general-purpose
    或自定义Agent)。
  • hooks
    :仅限于此Skill生命周期的钩子。
字符串替换(在Skill内容中)
  • $ARGUMENTS
    - 调用Skill时传递的所有参数
  • ${CLAUDE_SESSION_ID}
    - 当前会话ID
动态上下文注入: 在shell命令前添加感叹号并用反引号括起来,可在Skill内容发送给Claude之前运行该命令。输出将替换占位符。
语法:感叹号+反引号+命令+反引号(例如
!gh pr diff
子Agent执行示例
yaml
---
name: deep-research
description: 深入研究一个主题
context: fork
agent: Explore
---

深入研究$ARGUMENTS:
1. 使用Glob和Grep查找相关文件
2. 读取并分析代码
3. 结合文件引用总结发现
Body
正文
Write instructions for using the skill and its bundled resources.
编写使用Skill及其捆绑资源的指令。

Step 5: Packaging a Skill

步骤5:打包Skill

Once development of the skill is complete, it must be packaged into a distributable .skill file that gets shared with the user. The packaging process automatically validates the skill first to ensure it meets all requirements:
bash
bun scripts/package-skill.ts <path/to/skill-folder>
Optional output directory specification:
bash
bun scripts/package-skill.ts <path/to/skill-folder> ./dist
The packaging script will:
  1. Validate the skill automatically, checking:
    • YAML frontmatter format and required fields
    • Skill naming conventions and directory structure
    • Description completeness and quality
    • File organization and resource references
  2. Package the skill if validation passes, creating a .skill file named after the skill (e.g.,
    my-skill.skill
    ) that includes all files and maintains the proper directory structure for distribution. The .skill file is a zip file with a .skill extension.
If validation fails, the script will report the errors and exit without creating a package. Fix any validation errors and run the packaging command again.
Skill开发完成后,必须将其打包为可分发的.skill文件以与用户共享。打包过程会先自动验证Skill,确保其符合所有要求:
bash
bun scripts/package-skill.ts <path/to/skill-folder>
可选的输出目录指定:
bash
bun scripts/package-skill.ts <path/to/skill-folder> ./dist
打包脚本会:
  1. 验证:自动验证Skill,检查:
    • YAML前置元数据格式和必填字段
    • Skill命名约定和目录结构
    • 描述的完整性和质量
    • 文件组织和资源引用
  2. 打包:如果验证通过,创建以Skill命名的.skill文件(例如
    my-skill.skill
    ),包含所有文件并保持正确的目录结构以便分发。.skill文件是扩展名为.skill的zip文件。
如果验证失败,脚本会报告错误并退出,不创建包。修复所有验证错误后,重新运行打包命令。

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
测试Skill后,用户可能会要求改进。通常这会在使用Skill后立即发生,此时用户对Skill的表现有清晰的上下文认知。
迭代工作流
  1. 在实际任务中使用Skill
  2. 注意遇到的困难或低效之处
  3. 确定应如何更新SKILL.md或捆绑资源
  4. 实施更改并再次测试

Reference Guides

参考指南

For deeper topics and advanced patterns, see:
  • references/xml-tag-guide.md - Complete guide to XML tags and structure (required/conditional tags, nesting, naming conventions)
  • references/progressive-disclosure-patterns.md - Advanced strategies for organizing content across multiple files
  • references/prompting-integration.md - How to integrate expert prompting techniques into skills
  • references/real-world-examples.md - Complete examples of well-structured skills (simple, standard, complex)
  • references/script-patterns.md - Executable code patterns, error handling, script templates
  • references/output-patterns.md - Template and example patterns for consistent output
  • references/workflows.md - Sequential and conditional workflow patterns
如需深入了解相关主题和高级模式,请参见:
  • references/xml-tag-guide.md - XML标签和结构完整指南(必填/条件标签、嵌套、命名约定)
  • references/progressive-disclosure-patterns.md - 跨多个文件组织内容的高级策略
  • references/prompting-integration.md - 如何将专家提示词技术集成到Skills中
  • references/real-world-examples.md - 结构良好的Skill完整示例(简单、标准、复杂)
  • references/script-patterns.md - 可执行代码模式、错误处理、脚本模板
  • references/output-patterns.md - 用于一致输出的模板和示例模式
  • references/workflows.md - 顺序和条件工作流模式