前言
Openclaw 本身的skill里面自带了一个SKILL.md 的解释,但是是英文的,于是乎做一个中文的理解 + 翻译。
正文(Skill 创建文档(中文版))
这份文档是 skill-creator 的中文说明,面向仓库维护和后续创建新 skill 的工作流程。
说明:
这是一份本地辅助文档,方便中文阅读和协作。
distributable skill 的最小必需内容仍然是
SKILL.md,以及按需存在的scripts/references/assets/。
1. Skill 是什么
Skill 是一个自包含的目录,用来把某一类任务的流程、工具使用方式、领域知识和可复用资源打包给另一个 Codex 使用。它不是普通说明文档,而是给代理执行任务时看的操作规范。
Skill 的价值主要来自四类内容:
专项流程:把复杂任务拆成可重复执行的步骤。
工具集成:告诉代理如何使用特定脚本、文件格式或 API。
领域知识:沉淀 schema、业务规则、术语和判断标准。
可复用资源:把脚本、模板、参考资料等放进目录,减少重复劳动。
2. 最小目录结构
标准结构如下:
skill-name/
├── SKILL.md
├── scripts/ # 可选
├── references/ # 可选
└── assets/ # 可选规则:
SKILL.md必须存在。scripts/references/assets/只在确实需要时创建。不要默认创建 README、CHANGELOG、QUICK_REFERENCE 之类的辅助文件。
3. 编码与换行规范(对于部分Windows系统电脑)
这是当前仓库必须遵守的额外约定,因为你的 Windows 环境存在 GBK 默认编码问题。
统一规则:
所有文本文件使用
UTF-8编码。所有文本文件优先使用
LF换行。脚本里读写文本时显式指定编码,不依赖系统默认编码。
当前目录中的脚本已经按这个方向调整:
scripts/init_skill.py生成的新文本文件会使用UTF-8 + LF。scripts/quick_validate.py会按UTF-8读取SKILL.md,并兼容UTF-8 BOM。
实践建议:
新建 skill 时,正文尽量保持纯 UTF-8 文本。
文件名默认优先使用 ASCII,除非确实需要中文文件名。
如果某个工具可能按系统默认编码读文件,要优先修成显式
encoding="utf-8"。
4. SKILL.md 的职责
SKILL.md 由两部分组成:
YAML frontmatter
Markdown 正文
4.1 Frontmatter
核心字段是:
---
name: my-skill
description: Explain what the skill does and when it should be used.
---字段要求:
name:skill 名称。description:不仅写“这个 skill 做什么”,还要写“什么情况下应该触发这个 skill”。
本地脚本里的实际情况:
quick_validate.py目前允许name、description、license、allowed-tools、metadata。但
SKILL.md主文档里仍然建议把 frontmatter 收敛到最核心的name + description。
后续默认做法:
如果没有特别需求,优先只写
name和description。
4.2 正文
正文负责说明:
skill 的核心工作方式
该读哪些参考文件
该执行哪些脚本
在什么条件下切换不同流程
正文不应该做的事:
重复 frontmatter 里本该承担的触发条件
堆砌所有长篇资料
写成面向终端用户的营销文案
5. 三类可选资源怎么用
5.1 scripts/
适合放:
反复会重写的代码
对稳定性要求高的操作
可以直接执行的自动化脚本
典型场景:
文件转换
数据清洗
批量生成
API 调用封装
原则:
加进来的脚本要真的跑过。
如果只是一次性逻辑,不一定要沉淀成脚本。
5.2 references/
适合放:
详细 API 文档
schema
复杂流程说明
领域规范
只在特定场景才需要的长文说明
原则:
SKILL.md只保留总流程和入口说明。详细内容移到
references/,并在SKILL.md里明确写出“什么时候去读哪一个 reference 文件”。
5.3 assets/
适合放:
模板
字体
图片
样板工程
需要被复制或直接产出给用户的文件
原则:
assets/是给输出使用的,不是给上下文加载用的。
6. Skill 设计原则
6.1 保持精简
默认假设 Codex 已经足够聪明,不需要把常识写得很长。只保留对任务真正有帮助、且模型不一定稳定掌握的内容。
6.2 让自由度和任务风险匹配
不同 skill 需要不同约束强度:
高自由度:适合开放式文本指导。
中自由度:适合伪代码、参数化脚本、推荐模式。
低自由度:适合脆弱流程、固定顺序、容错空间小的任务。
6.3 渐进加载
推荐分三层:
name + descriptionSKILL.md正文按需加载
scripts/references/assets/
设计目标:
让主文件足够短,便于触发后快速理解。
把大块内容拆到按需文件,避免浪费上下文。
7. 推荐正文组织方式
可以根据 skill 类型选择结构:
7.1 Workflow-Based
适合有明确步骤的任务,例如:
读文件
判断类型
进入不同处理分支
产出结果
7.2 Task-Based
适合工具集型 skill,例如:
合并
拆分
提取
转换
7.3 Reference/Guidelines
适合规范型 skill,例如:
品牌规范
代码规范
输出格式要求
7.4 Capabilities-Based
适合多能力协同的 skill,例如:
产品管理
运维助手
复杂平台操作
8. 命名规则
Skill 名称规则:
只用小写字母、数字、连字符
不超过 64 个字符
不以连字符开头或结尾
不出现连续连字符
推荐:
名称尽量短
尽量体现动作或用途
必要时按工具命名空间区分,例如
gh-address-comments
目录名必须和 skill 名完全一致。
9. 标准创建流程
9.1 第 1 步:先搞清楚使用场景
要先明确:
这个 skill 解决什么问题
用户会怎么提需求
哪些说法应该触发它
哪些任务不属于它
9.2 第 2 步:提炼可复用内容
针对典型任务,判断哪些内容应该沉淀:
需要反复执行的代码,放进
scripts/容易反复查找的资料,放进
references/要复用的模板和素材,放进
assets/
9.3 第 3 步:初始化 skill
使用当前目录的初始化脚本:
python scripts/init_skill.py <skill-name> --path <output-directory>带资源目录:
python scripts/init_skill.py <skill-name> --path <output-directory> --resources scripts,references,assets带示例文件:
python scripts/init_skill.py <skill-name> --path <output-directory> --resources scripts,references --examples脚本会做这些事:
规范化 skill 名
创建 skill 目录
生成模板
SKILL.md按需创建资源目录
可选写入示例文件
当前已知实现细节:
生成的文本文件会用
UTF-8 + LF
9.4 第 4 步:补完内容
完成初始化后,继续做:
把
SKILL.md里的 TODO 改成真实内容增加真正需要的脚本、参考文件、模板文件
删除无用示例文件
写作原则:
用祈使句或操作式语言
多写“怎么做”,少写空泛概念
如果细节很长,拆到
references/
9.5 第 5 步:校验
执行:
python scripts/quick_validate.py <skill-directory>当前校验器主要检查:
SKILL.md是否存在YAML frontmatter 格式是否正确
name是否符合命名规则description是否为合法字符串
注意:
当前校验器偏“基础检查”,并不会完全评估正文质量。
它更像是结构门槛,不是完整质量评审。
9.6 第 6 步:打包
执行:
python scripts/package_skill.py <path/to/skill-folder>或者指定输出目录:
python scripts/package_skill.py <path/to/skill-folder> ./dist行为说明:
先调用校验器
校验通过后,把整个 skill 目录打成
.skill打包时会保留顶层 skill 文件夹结构
9.7 第 7 步:真实任务中迭代
推荐迭代方式:
1. 让 skill 先处理真实任务
2. 观察它卡在哪里、重复问什么、哪些地方理解不稳定
3. 再反向改 SKILL.md 或资源文件
10. (其他)当前本地 skill-creator 的已知特点
10.1 本地文档与系统版本有差异
系统内置的 skill-creator 和你仓库里的 skill-creator 不完全一致,例如:
系统版本提到
agents/openai.yaml本地版本主要围绕
SKILL.mdscripts/references/assets/
后续如果你让我在这个仓库里创建 skill,我会优先以本地版本为准。
10.2 license.txt 不是创建必需项
当前 license.txt 没有被初始化脚本和打包脚本直接引用,所以它不是最小创建骨架的一部分。
10.3 当前 validator 原先有 GBK 风险
之前的 quick_validate.py 使用系统默认编码读取 SKILL.md,在 Windows GBK 环境里会因为非 GBK 字符直接报错。
这个问题现在已经被规避:
改为显式按 UTF-8 读取
并兼容 UTF-8 BOM
读取后统一换行符,避免 CRLF/LF 差异影响 frontmatter 检查
11. (其他)后续我们创建新 skill 的默认约定
除非你明确指定别的规则,我后续会默认这样做:
所有文本文件使用
UTF-8所有文本文件优先使用
LFskill 文件名默认优先用 ASCII
frontmatter 默认只写
name和description只创建真正需要的
scripts/references/assets/长说明拆到
references/,不把SKILL.md写得过长新增脚本会先跑通,再交付
如果你下一步要我正式创建某个新 skill,只要给我这四项信息就够了:
skill 目标
典型触发语句
是否需要
scripts/references/assets/是否需要最终打包成
.skill
正文(SKILL.md英文原版)
---
name: skill-creator
description: Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
---This skill provides guidance for creating effective skills.
About Skills
Skills are modular, self-contained packages that extend Codex's capabilities by providing
specialized knowledge, workflows, and tools. Think of them as "onboarding guides" for specific
domains or tasks—they transform Codex from a general-purpose agent into a specialized agent
equipped with procedural knowledge that no model can fully possess.
What Skills Provide
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
Core Principles
Concise is Key
The context window is a public good. Skills share the context window with everything else Codex needs: system prompt, conversation history, other Skills' metadata, and the actual user request.
Default assumption: Codex is already very smart. Only add context Codex doesn't already have. Challenge each piece of information: "Does Codex really need this explanation?" and "Does this paragraph justify its token cost?"
Prefer concise examples over verbose explanations.
Text Encoding and Line Endings
Use UTF-8 for all text files in the skill and prefer LF line endings.
When reading or writing skill files in scripts, set the encoding explicitly instead of relying on the host OS default. This avoids Windows locale issues such as GBK decode failures during validation or initialization.
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 Codex as exploring a path: a narrow bridge with cliffs needs specific guardrails (low freedom), while an open field allows many routes (high freedom).
Anatomy of a 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.md (required)
Every SKILL.md consists of:
Frontmatter (YAML): Contains
nameanddescriptionfields. These are the only fields that Codex 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.Body (Markdown): Instructions and guidance for using the skill. Only loaded AFTER the skill triggers (if at all).
Bundled Resources (optional)
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.pyfor PDF rotation tasksBenefits: Token efficient, deterministic, may be executed without loading into context
Note: Scripts may still need to be read by Codex for patching or environment-specific adjustments
References references/)
Documentation and reference material intended to be loaded as needed into context to inform Codex's process and thinking.
When to include: For documentation that Codex should reference while working
Examples:
references/finance.mdfor financial schemas,references/mnda.mdfor company NDA template,references/policies.mdfor company policies,references/api_docs.mdfor API specificationsUse cases: Database schemas, API documentation, domain knowledge, company policies, detailed workflow guides
Benefits: Keeps SKILL.md lean, loaded only when Codex 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.
Assets assets/)
Files not intended to be loaded into context, but rather used within the output Codex produces.
When to include: When the skill needs files that will be used in the final output
Examples:
assets/logo.pngfor brand assets,assets/slides.pptxfor PowerPoint templates,assets/frontend-template/for HTML/React boilerplate,assets/font.ttffor typographyUse cases: Templates, images, icons, boilerplate code, fonts, sample documents that get copied or modified
Benefits: Separates output resources from documentation, enables Codex to use files without loading them into context
What to Not Include in a 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 auxiliary 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.
Progressive Disclosure Design Principle
Skills use a three-level loading system to manage context efficiently:
Metadata (name + description) - Always in context (~100 words)
SKILL.md body - When skill triggers (<5k words)
Bundled resources - As needed by Codex (Unlimited because scripts can be executed without reading into context window)
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
# PDF Processing
## Quick start
Extract text with pdfplumber:
[code example]
## Advanced features
- Form filling: See [FORMS.md](FORMS.md) for complete guide
- API reference: See [REFERENCE.md](REFERENCE.md) for all methods
- Examples: See [EXAMPLES.md](EXAMPLES.md) for common patternsCodex 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, Codex 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, Codex only reads aws.md.
Pattern 3: Conditional details
Show basic content, link to advanced content:
# DOCX Processing
## Creating documents
Use docx-js for new documents. See [DOCX-JS.md](DOCX-JS.md).
## Editing documents
For simple edits, modify the XML directly.
For tracked changes: See [REDLINING.md](REDLINING.md)
For OOXML details: See [OOXML.md](OOXML.md)Codex 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 Codex can see the full scope when previewing.
Skill Creation Process
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
Follow these steps in order, skipping only if there is a clear reason why they are not applicable.
Skill Naming
Use lowercase letters, digits, and hyphens only; normalize user-provided titles to hyphen-case (e.g., "Plan Mode" ->
plan-mode).When generating names, generate a name under 64 characters (letters, digits, hyphens).
Prefer short, verb-led phrases that describe the action.
Namespace by tool when it improves clarity or triggering (e.g.,
gh-address-comments,linear-address-issue).
Name the skill folder exactly after the skill name.
Step 1: Understanding the Skill with Concrete Examples
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.
Step 2: Planning the Reusable Skill Contents
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 pdf-editor skill to handle queries like "Help me rotate this PDF," the analysis shows:
Rotating a PDF requires re-writing the same code each time
A
scripts/rotate_pdf.pyscript 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:
Writing a frontend webapp requires the same boilerplate HTML/React each time
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:
Querying BigQuery requires re-discovering the table schemas and relationships each time
A
references/schema.mdfile 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.
Step 3: Initializing the 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.py 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:
scripts/init_skill.py <skill-name> --path <output-directory> [--resources scripts,references,assets] [--examples]Examples:
scripts/init_skill.py my-skill --path skills/public
scripts/init_skill.py my-skill --path skills/public --resources scripts,references
scripts/init_skill.py my-skill --path skills/public --resources scripts --examplesThe script:
Creates the skill directory at the specified path
Generates a SKILL.md template with proper frontmatter and TODO placeholders
Optionally creates resource directories based on
--resourcesOptionally adds example files when
--examplesis set
After initialization, customize the SKILL.md and add resources as needed. If you used --examples, replace or delete placeholder files.
Step 4: Edit the Skill
When editing the (newly-generated or existing) skill, remember that the skill is being created for another instance of Codex to use. Include information that would be beneficial and non-obvious to Codex. Consider what procedural knowledge, domain-specific details, or reusable assets would help another Codex instance execute these tasks more effectively.
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.
Start with Reusable Skill Contents
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.
If you used --examples, delete any placeholder files that are not needed for the skill. Only create resource directories that are actually required.
Update SKILL.md
Writing Guidelines: Always use imperative/infinitive form.
Frontmatter
Write the YAML frontmatter with name and description:
name: The skill namedescription: This is the primary triggering mechanism for your skill, and helps Codex understand when to use the skill.Include both what the Skill does and specific triggers/contexts for when to use it.
Include all "when to use" information here - Not in the body. The body is only loaded after triggering, so "When to Use This Skill" sections in the body are not helpful to Codex.
Example description for a
docxskill: "Comprehensive document creation, editing, and analysis with support for tracked changes, comments, formatting preservation, and text extraction. Use when Codex needs to work with professional documents (.docx files) for: (1) Creating new documents, (2) Modifying or editing content, (3) Working with tracked changes, (4) Adding comments, or any other document tasks"
Do not include any other fields in YAML frontmatter.
Body
Write instructions for using the skill and its bundled resources.
Step 5: Packaging a 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:
scripts/package_skill.py <path/to/skill-folder>Optional output directory specification:
scripts/package_skill.py <path/to/skill-folder> ./distThe packaging script will:
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
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.
Step 6: Iterate
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:
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
总结
就是,酱紫,的喵~!
参考
[1] Openclaw 自带的skill-creator
[2] CodeX 5.4
[3] 自己