creating-skills
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSkill Creator
Skill Creator
This skill provides guidance for creating effective skills.
本Skill为创建有效的Agent Skills提供指导。
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能提供的能力
- Specialized workflows - Multi-step procedures for specific domains
- Tool integrations - Instructions for working with specific file formats or APIs
- Domain expertise - Company-specific knowledge, schemas, business logic
- Bundled resources - Scripts, references, and assets for complex and repetitive tasks
- 专业工作流 - 针对特定领域的多步骤流程
- 工具集成 - 与特定文件格式或API协作的操作指南
- 领域专业知识 - 企业专属知识、数据模型、业务逻辑
- 捆绑资源 - 用于复杂和重复任务的脚本、参考资料及资源文件
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.
上下文窗口是公共资源。Skill需要与Claude所需的其他所有内容共享上下文窗口:系统提示词、对话历史、其他Skill的元数据以及用户的实际请求。
默认假设:Claude已经非常智能。 仅添加Claude尚不具备的上下文信息。对每一条信息都要提出质疑:「Claude真的需要这个解释吗?」以及「这段内容的令牌成本是否合理?」
优先使用简洁示例,而非冗长的解释。
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的工作比作探索路径:两侧是悬崖的狭窄桥梁需要明确的护栏(低自由度),而开阔的场地则允许多种路线(高自由度)。
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/ - 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.md (required)
SKILL.md(必填)
Every SKILL.md consists of:
- Frontmatter (YAML): Contains and
namefields. These are the only fields that Claude reads to determine when the skill gets used, thus it is very important to be clear and comprehensive in describing what the skill is, and when it should be used.description - Body (Markdown): Instructions and guidance for using the skill. Only loaded AFTER the skill triggers (if at all).
每个SKILL.md都包含:
- Frontmatter(YAML格式):包含和
name字段。Claude仅通过这两个字段判断何时触发该Skill,因此清晰、全面地描述Skill的用途及触发场景至关重要。description - 正文(Markdown格式):使用Skill的操作指南。仅在Skill触发后才会被加载(按需加载)。
Bundled Resources (optional)
捆绑资源(可选)
Scripts (scripts/
)
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: for PDF rotation tasks
scripts/rotate_pdf.py - 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 - 优势:令牌使用高效、结果确定,无需加载到上下文即可执行
- 注意:Claude可能仍需读取脚本以进行补丁或环境特定调整
References (references/
)
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: for financial schemas,
references/finance.mdfor API specificationsreferences/api_docs.md - 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
文档和参考资料,可按需加载到上下文以指导Claude的处理流程和思考。
- 适用场景:Claude在工作中需要参考的文档
- 示例:用于财务模型的、用于API规范的
references/finance.mdreferences/api_docs.md - 优势:保持SKILL.md简洁,仅在Claude判定需要时加载
- 最佳实践:如果文件较大(>10000字),在SKILL.md中添加grep搜索模式
Assets (assets/
)
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: for brand assets,
assets/logo.pngfor PowerPoint templatesassets/slides.pptx - Benefits: Separates output resources from documentation, enables Claude to use files without loading them into context
无需加载到上下文,而是用于Claude生成最终输出的文件。
- 适用场景:Skill需要用于最终输出的文件时
- 示例:品牌资源、PowerPoint模板
assets/logo.pngassets/slides.pptx - 优势:将输出资源与文档分离,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
The skill should only contain the information needed for an AI agent to do the job at hand.
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:
- Metadata (name + description) - Always in context (~100 tokens)
- SKILL.md body - When skill triggers (<5000 tokens)
- Bundled resources - As needed by Claude (unlimited because scripts can be executed without reading into context window)
Keep SKILL.md body under 500 lines. Split content into separate files when approaching this limit.
Key principle: When a skill supports multiple variations, keep only the core workflow in SKILL.md. Move variant-specific details into separate reference files.
Skill采用三级加载系统以高效管理上下文:
- 元数据(名称+描述) - 始终在上下文中(约100令牌)
- SKILL.md正文 - Skill触发时加载(<5000令牌)
- 捆绑资源 - 由Claude按需加载(无限制,因为脚本可在不读取到上下文窗口的情况下执行)
保持SKILL.md正文在500行以内。接近该限制时,将内容拆分到单独文件中。
核心原则:当Skill支持多种变体时,仅在SKILL.md中保留核心工作流。将变体特定的细节移至单独的参考文件中。
Skill Creation Process
Skill创建流程
Skill creation involves these steps:
- Understand the skill with concrete examples
- Plan reusable skill contents (scripts, references, assets)
- Initialize the skill (run init_skill.py)
- Edit the skill (implement resources and write SKILL.md)
- Package the skill (run package_skill.py)
- Iterate based on real usage
Skill创建包含以下步骤:
- 通过具体示例明确Skill的用途
- 规划可复用的Skill内容(脚本、参考资料、资源文件)
- 初始化Skill(运行init_skill.py)
- 编辑Skill(实现资源并编写SKILL.md)
- 打包Skill(运行package_skill.py)
- 根据实际使用情况迭代优化
Step 1: Understanding the Skill with Concrete Examples
步骤1:通过具体示例明确Skill的用途
To create an effective skill, clearly understand concrete examples of how the skill will be used. For example, when building an image-editor skill, relevant questions include:
- "What functionality should the image-editor skill support?"
- "Can you give some examples of how this skill would be used?"
- "What would a user say that should trigger this skill?"
Conclude this step when there is a clear sense of the functionality the skill should support.
要创建有效的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:
- Considering how to execute on the example from scratch
- Identifying what scripts, references, and assets would be helpful when executing these workflows repeatedly
Example: When building a skill to handle queries like "Help me rotate this PDF," the analysis shows:
pdf-editor- Rotating a PDF requires re-writing the same code each time
- A script would be helpful to store in the skill
scripts/rotate_pdf.py
要将具体示例转化为有效的Skill,需对每个示例进行分析:
- 思考如何从零开始完成示例中的任务
- 识别重复执行这些工作流时需要的脚本、参考资料和资源文件
示例:创建Skill以处理「帮我旋转这个PDF」这类请求时,分析结果如下:
pdf-editor- 旋转PDF需要重复编写相同的代码
- 在Skill中存储脚本会很有帮助
scripts/rotate_pdf.py
Step 3: Initializing the Skill
步骤3:初始化Skill
When creating a new skill from scratch, always run the script:
init_skill.pybash
python3 scripts/init_skill.py <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/, andreferences/assets/
从零开始创建新Skill时,请务必运行脚本:
init_skill.pybash
python3 scripts/init_skill.py <skill-name> --path <output-directory>该脚本会:
- 在指定路径创建Skill目录
- 生成带有正确Frontmatter和待办占位符的SKILL.md模板
- 创建示例资源目录:、
scripts/和references/assets/
Step 4: Edit the Skill
步骤4:编辑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.
请记住,Skill是为其他Claude实例创建的。需包含对Claude有帮助且非显而易见的信息。
Frontmatter
Frontmatter
Write the YAML frontmatter with and :
namedescription- : The skill name (gerund form preferred:
name,deploying-*,creating-*)fetching-* - : This is the primary triggering mechanism for your skill
description
CRITICAL: Description = When to Use, NOT What It Does
The description should ONLY describe triggering conditions. Do NOT summarize the skill's process or workflow in the description.
Why this matters: When a description summarizes the skill's workflow, Claude may follow the description instead of reading the full skill content. A description saying "dispatches subagent per task with code review" caused Claude to do ONE review, even though the skill body specified TWO reviews. When changed to just triggering conditions, Claude correctly read and followed the full skill.
yaml
undefined编写包含和的YAML Frontmatter:
namedescription- :Skill名称(首选动名词形式:
name、deploying-*、creating-*)fetching-* - :这是Skill的主要触发机制
description
关键注意事项:描述应说明触发场景,而非功能内容
描述应仅说明触发条件。请勿在描述中总结Skill的流程或工作流。
原因:当描述中总结了Skill的工作流时,Claude可能会直接遵循描述内容,而非读取完整的Skill内容。例如,某描述为「执行计划时使用——为每个任务分配子Agent并进行代码审查」的Skill,Claude仅执行了一次审查,而Skill正文中明确要求进行两次审查。当描述修改为仅包含触发条件后,Claude正确读取并遵循了完整的Skill内容。
yaml
undefinedBAD: Summarizes workflow - Claude may follow this instead of reading skill
错误示例:总结工作流 - Claude可能会直接遵循描述而非读取Skill正文
description: Use when executing plans - dispatches subagent per task with code review
description: Use when executing plans - dispatches subagent per task with code review
BAD: Too much process detail
错误示例:包含过多流程细节
description: Use for TDD - write test first, watch it fail, write minimal code
description: Use for TDD - write test first, watch it fail, write minimal code
GOOD: Just triggering conditions
正确示例:仅包含触发条件
description: Use when executing implementation plans with independent tasks
description: Use when executing implementation plans with independent tasks
GOOD: Triggering conditions with exclusion
正确示例:包含触发条件和排除场景
description: |
Use when users need to create new documents or work with tracked changes.
NOT when converting between formats (use converting-documents skill).
**Description checklist:**
- Start with "Use when..." to focus on triggering conditions
- Include symptoms, situations, contexts that signal the skill applies
- Add "NOT when [exclusion]" if collision with other skills possible
- NEVER summarize the skill's process or workflow
- Max 1024 charactersdescription: |
Use when users need to create new documents or work with tracked changes.
NOT when converting between formats (use converting-documents skill).
**描述检查清单:**
- 以「Use when...」开头,聚焦触发条件
- 包含表明Skill适用的症状、场景、上下文
- 若可能与其他Skill冲突,添加「NOT when [排除场景]」
- 切勿总结Skill的流程或工作流
- 最大长度1024字符Body
正文
Write instructions for using the skill and its bundled resources.
编写使用Skill及其捆绑资源的操作指南。
Step 5: Packaging a Skill
步骤5:打包Skill
Once development is complete, package the skill:
bash
python3 scripts/package_skill.py <path/to/skill-folder>The packaging script will:
- Validate the skill automatically
- Package the skill if validation passes, creating a .skill file
开发完成后,打包Skill:
bash
python3 scripts/package_skill.py <path/to/skill-folder>打包脚本会:
- 自动验证Skill的有效性
- 打包Skill(验证通过时),生成.skill文件
Step 6: Iterate
步骤6:迭代优化
After testing the skill, users may request improvements. Iteration workflow:
- Use the skill on real tasks
- Notice struggles or inefficiencies
- Identify how SKILL.md or bundled resources should be updated
- Implement changes and test again
测试Skill后,用户可能会提出改进需求。迭代流程如下:
- 在实际任务中使用Skill
- 发现使用中的问题或低效点
- 确定应如何更新SKILL.md或捆绑资源
- 实施更改并再次测试
Verification
验证
Run:
python3 scripts/verify.pyExpected:
✓ creating-skills validTo validate another skill:
bash
python3 scripts/verify.py /path/to/skill-folder运行以下命令:
bash
python3 scripts/verify.py预期输出:
✓ creating-skills valid验证其他Skill:
bash
python3 scripts/verify.py /path/to/skill-folderIf Verification Fails
验证失败时的处理
- Run diagnostic:
python3 scripts/verify.py /path/to/skill --verbose - Check: YAML frontmatter, name format, description trigger
- Fix: Ensure "Use when" is in description, name is gerund form
- Stop and report if still failing - do not proceed with downstream steps
- 运行诊断命令:
python3 scripts/verify.py /path/to/skill --verbose - 检查:YAML Frontmatter、名称格式、描述触发条件
- 修复:确保描述中包含「Use when」,名称为动名词形式
- 若仍失败,请停止操作并上报 - 不要继续后续步骤
References
参考资料
See references/design-patterns.md for workflow patterns and MCP output discipline guidelines.
请查看references/design-patterns.md获取工作流模式和MCP输出规范指南。