skill-creator

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Skill Creator

Skill创建指南

This skill provides guidance for creating effective skills.
本Skill为创建高效的Skill提供指导。

About Skills

关于Skill

Skills are modular, self-contained packages that extend OpenHands's capabilities by providing specialized knowledge, workflows, and tools. Think of them as "onboarding guides" for specific domains or tasks—they transform OpenHands from a general-purpose agent into a specialized agent equipped with procedural knowledge that no model can fully possess.
Skill是模块化、自包含的包,通过提供专业知识、工作流和工具来扩展OpenHands的能力。你可以把它们看作特定领域或任务的「入门指南」——它们能将通用型Agent转变为具备专业流程知识的专用OpenHands 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. 领域知识:企业专属知识、数据 schema、业务逻辑
  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/          - 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(必填)

Metadata Quality: The
name
and
description
in YAML frontmatter determine when OpenHands 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
决定了OpenHands何时会调用该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 OpenHands for patching or environment-specific adjustments
用于需要确定性可靠性或者会被反复编写的任务的可执行代码(Python/Bash等)。
  • 适用场景:相同代码会被反复编写,或者需要确定性执行结果时
  • 示例:用于PDF旋转任务的
    scripts/rotate_pdf.py
  • 优势:节省Token、执行结果确定,无需加载到上下文即可执行
  • 注意:OpenHands可能仍需要读取脚本内容进行补丁修改或适配特定环境
References (
references/
)
参考资料(
references/
Documentation and reference material intended to be loaded as needed into context to inform OpenHands's process and thinking.
  • When to include: For documentation that OpenHands 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 OpenHands 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.
会按需加载到上下文中,为OpenHands的处理流程和决策提供参考的文档和资料。
  • 适用场景:OpenHands工作过程中需要参考的文档
  • 示例:记录金融schema的
    references/finance.md
    、企业NDA模板
    references/mnda.md
    、企业政策文档
    references/policies.md
    、API规范
    references/api_docs.md
  • 使用场景:数据库schema、API文档、领域知识、企业政策、详细工作流指南
  • 优势:保持SKILL.md简洁,仅在OpenHands判断需要时才加载
  • 最佳实践:如果文件较大(超过1万字),请在SKILL.md中添加grep搜索规则
  • 避免内容重复:信息要么放在SKILL.md中,要么放在参考文件中,不要同时存在。详细内容优先放在参考文件中,除非是Skill的核心内容——这样既能保持SKILL.md精简,又能让信息可被检索,同时不会占用上下文窗口。SKILL.md中仅保留必要的流程说明和工作流指导,将详细参考资料、schema、示例迁移到参考文件中。
Assets (
assets/
)
资产(
assets/
Files not intended to be loaded into context, but rather used within the output OpenHands 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 OpenHands to use files without loading them into context
不会加载到上下文,而是用于OpenHands输出产物的文件。
  • 适用场景:Skill生成最终输出时需要用到的文件
  • 示例:品牌资产
    assets/logo.png
    、PowerPoint模板
    assets/slides.pptx
    、HTML/React样板代码
    assets/frontend-template/
    、字体文件
    assets/font.ttf
  • 使用场景:模板、图片、图标、样板代码、字体、可复制或修改的示例文档
  • 优势:将输出资源和文档分离,OpenHands无需将其加载到上下文即可使用

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 OpenHands (Unlimited*)
*Unlimited because scripts can be executed without reading into context window.
Skill采用三级加载系统来高效管理上下文:
  1. 元数据(名称+描述):始终保留在上下文中(约100字)
  2. SKILL.md正文:Skill被触发时加载(少于5000字)
  3. 捆绑资源:OpenHands按需加载(无数量限制*)
*无限制是因为脚本无需读取到上下文窗口即可执行。

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需要支持的功能范围后,即可结束本步骤。

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」这类请求的
pdf-editor
Skill时,分析可得:
  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每次都需要重新梳理表schema和关联关系
  2. 可以在Skill中存储记录表schema的
    references/schema.md
    文件
通过分析每个具体示例,梳理出需要包含的可复用资源清单:脚本、参考资料、资产,即可确定Skill的内容组成。

Step 3: Create Skill Structure

步骤3:创建Skill结构

Create the skill directory structure:
bash
mkdir -p skill-name/{references,scripts,assets}
touch skill-name/SKILL.md
Alternatively, use the
init_skill.py
script to generate a template:
bash
scripts/init_skill.py <skill-name> --path <output-directory>
The script creates a skill directory with SKILL.md template and example resource directories.
创建Skill目录结构:
bash
mkdir -p skill-name/{references,scripts,assets}
touch skill-name/SKILL.md
也可以使用
init_skill.py
脚本生成模板:
bash
scripts/init_skill.py <skill-name> --path <output-directory>
该脚本会创建包含SKILL.md模板和示例资源目录的Skill文件夹。

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 OpenHands to use. Focus on including information that would be beneficial and non-obvious to OpenHands. Consider what procedural knowledge, domain-specific details, or reusable assets would help another OpenHands instance execute these tasks more effectively.
编辑(新创建或已有的)Skill时,请记住你创建的Skill是给其他OpenHands实例使用的。重点加入对OpenHands有价值、且不会默认知晓的信息。思考哪些流程知识、领域专属细节或者可复用资产能帮助其他OpenHands实例更高效地完成相关任务。

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/, scripts/, assets/).
实现时,先从上面确定的可复用资源开始:
scripts/
references/
assets/
文件。注意本步骤可能需要用户输入,例如实现
brand-guidelines
Skill时,用户可能需要提供存储在
assets/
中的品牌资产或模板,或者存储在
references/
中的文档。
同时,删除Skill不需要的所有示例文件和目录,仅创建你实际需要的目录(references/、scripts/、assets/)。

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:
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.
---
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 OpenHands use the skill? All reusable skill contents developed above should be referenced so that OpenHands 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读取。
描述(前置元数据):使用第三人称格式,包含明确的触发短语:
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. 实际使用中,OpenHands应该怎么使用这个Skill?要提及上面开发的所有可复用Skill内容,让OpenHands知道如何使用它们。
保持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:验证与测试

  1. Check structure: Skill directory contains SKILL.md
  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 scripts: Scripts are executable and work correctly
Use the validation script to check basic requirements:
bash
scripts/quick_validate.py <path/to/skill-folder>
  1. 检查结构:Skill目录包含SKILL.md
  2. 验证SKILL.md:包含带名称和描述的前置元数据
  3. 检查触发短语:描述中包含具体的用户查询内容
  4. 验证写作风格:正文使用祈使/不定式形式,未使用第二人称
  5. 测试渐进式披露:SKILL.md精简(约1500-2000字),详细内容存放在references/中
  6. 检查引用:所有引用的文件都真实存在
  7. 验证脚本:脚本可执行且运行正常
使用验证脚本检查基础要求:
bash
scripts/quick_validate.py <path/to/skill-folder>

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/中
  • 补充缺失的示例或脚本
  • 明确模糊的指令
  • 增加边界场景处理逻辑

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 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.
使用动词开头的指令,不要使用第二人称:
正确(祈使形式):
To create a hook, define the event type.
Configure the MCP server with authentication.
Validate settings before use.
错误(第二人称):
You should create a hook by defining the event type.
You need to configure the MCP server.
You must validate settings before use.

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...
OpenHands should extract fields...
The user might validate values...
重点说明要做什么,而不是谁来做:
正确:
Parse the frontmatter using sed.
Extract fields with grep.
Validate values before use.
错误:
You can parse the frontmatter...
OpenHands should extract fields...
The user might validate values...

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
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/
  • 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」)
  • 描述不模糊、不笼统
内容质量:
  • SKILL.md正文使用祈使/不定式形式
  • 正文内容聚焦且精简(理想长度1500-2000字,最多不超过5000字)
  • 详细内容已迁移到references/中
  • 示例完整可运行
  • 脚本可执行且有配套文档
渐进式披露:
  • 核心概念放在SKILL.md中
  • 详细文档放在references/中
  • 工具脚本放在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:** OpenHands doesn't know references exist

✅ **Good:**
```markdown
[核心内容]
[未提及references/或examples/]

**问题:** OpenHands不知道存在相关参考资源

✅ **正确示例:**
```markdown

SKILL.md

SKILL.md

[Core content]
[核心内容]

Additional Resources

额外资源

Reference Files

参考文件

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

Scripts

脚本

  • scripts/validate.sh
    - Validation utility

**Why good:** OpenHands knows where to find additional information
  • scripts/validate.sh
    - 验证工具

**优势:** OpenHands知道去哪里获取额外信息

Quick Reference

速查指南

Minimal Skill

最简Skill

skill-name/
└── SKILL.md
Good for: Simple knowledge, no complex resources needed
skill-name/
└── SKILL.md
适用场景:简单知识类Skill,无需复杂资源

Standard Skill (Recommended)

标准Skill(推荐)

skill-name/
├── SKILL.md
├── references/
│   └── detailed-guide.md
└── scripts/
    └── helper.py
Good for: Most skills with detailed documentation
skill-name/
├── SKILL.md
├── references/
│   └── detailed-guide.md
└── scripts/
    └── helper.py
适用场景:大多数需要详细文档的Skill

Complete Skill

完整Skill

skill-name/
├── SKILL.md
├── references/
│   ├── patterns.md
│   └── advanced.md
├── scripts/
│   └── validate.sh
└── assets/
    └── template.txt
Good for: Complex domains with validation utilities
skill-name/
├── SKILL.md
├── references/
│   ├── patterns.md
│   └── advanced.md
├── scripts/
│   └── validate.sh
└── assets/
    └── template.txt
适用场景:需要验证工具的复杂领域Skill

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
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/)
  • 使用祈使/不定式形式写作
  • 清晰引用配套文件
  • 提供可运行的示例
  • 为通用操作创建工具脚本
禁止做法:
  • 任何位置使用第二人称
  • 触发条件模糊
  • 所有内容都放在SKILL.md中(超过3000字且未使用references/)
  • 使用第二人称写作(「你应该……」)
  • 未引用资源文件
  • 包含错误或不完整的示例
  • 跳过验证步骤

Additional Resources

额外资源

Reference Files

参考文件

For detailed patterns and techniques, consult:
  • references/workflows.md
    - Sequential workflows and conditional logic patterns
  • references/output-patterns.md
    - Template and example patterns for specific output formats
如需了解详细模式和技巧,请参考:
  • references/workflows.md
    - 顺序工作流和条件逻辑模式
  • references/output-patterns.md
    - 特定输出格式的模板和示例模式

Implementation Workflow

实现工作流

To create a skill:
  1. Understand use cases: Identify concrete examples of skill usage
  2. Plan resources: Determine what scripts/references/assets needed
  3. Create structure:
    mkdir -p skill-name/{references,scripts,assets}
  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/, scripts/, assets/ 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.
创建Skill的步骤:
  1. 理解使用场景:确定Skill使用的具体示例
  2. 规划资源:确定需要的脚本/参考资料/资产
  3. 创建结构:执行
    mkdir -p skill-name/{references,scripts,assets}
  4. 编写SKILL.md
    • 前置元数据包含第三人称描述和触发短语
    • 精简正文(1500-2000字)使用祈使形式写作
    • 引用配套文件
  5. 添加资源:按需创建references/、scripts/、assets/目录
  6. 验证:检查描述、写作风格、组织结构
  7. 测试:验证符合预期的触发词可以加载Skill
  8. 迭代:根据使用反馈优化
聚焦优质触发描述、渐进式披露和祈使式写作风格,即可创建出能在需要时触发、提供针对性指导的高效Skill。