Skill Builder
A meta-skill for creating and optimizing OpenClaw skills following official best practices. Guides you through a structured workflow from intent to publish-ready skill.
Workflow
1. Understand intent
Determine the mode:
| Mode | Trigger |
|---|
| Create | User wants a new skill |
| Optimize |
User wants to improve or review an existing skill |
If creating: Ask the user for 2-3 concrete usage examples (what would they say to trigger this skill, what should happen). These examples drive the description and workflow design.
If optimizing: Read the existing SKILL.md and note its current structure before proceeding.
2. Scaffold the directory
Create the skill directory under ~/workspace/skills/:
CODEBLOCK0
Naming rules:
- - Lowercase, hyphens only (no underscores, no spaces)
- Max 64 characters
- Verb-led when possible (e.g.,
workout-track, skill-builder) - Folder name must match the
name field in frontmatter
3. Write the SKILL.md
The SKILL.md is the core file — it contains the agent's instructions for executing the skill.
Frontmatter (YAML)
Three fields:
CODEBLOCK1
- -
name: Must match folder name exactly description: Primary trigger mechanism. Include "Use when..." to help the agent decide when to activate. Be specific to avoid overlap with other skillsmetadata: Declare runtime dependencies. Load {baseDir}/references/frontmatter-spec.md for the full reference if needed
Body structure
Write the body following these rules:
- 1. Opening line: One sentence explaining what the skill does
## Workflow: Numbered H3 steps (### 1. Step name) — imperative form- Tables for structured data (fields to extract, flags, mappings)
- Code blocks with exact commands — use
exec tool JSON format:
{
"tool": "exec",
"command": "<shell command here>"
}
- 5.
## Examples: Table with realistic input/output pairs (minimum 3 rows) - Error handling section: What to do when things fail — always present, never retry silently
Key rules
- - Keep SKILL.md under 500 lines — move detailed docs to INLINECODE13
- Use
{baseDir} for paths within the skill directory (e.g., {baseDir}/scripts/run.sh) - No hardcoded secrets — read from env vars,
.env, or openclaw.json via INLINECODE18 - Imperative form throughout ("Extract the URL", not "The URL is extracted")
- Confirmation before state changes — show a summary and ask before writing to DB, sending messages, etc.
4. Write the README.md
User-facing documentation with these sections:
CODEBLOCK3
5. Quality check
Load {baseDir}/references/checklist.md and validate every item:
- - [ ] Frontmatter has
name + INLINECODE21 - [ ]
name matches folder name - [ ] Description includes "Use when..." trigger phrases
- [ ] No hardcoded secrets or API keys
- [ ]
{baseDir} used for all internal paths - [ ] Metadata declares runtime dependencies (
requires.bins, requires.env) - [ ] Error handling section is present
- [ ] Examples section with at least 3 rows
- [ ] SKILL.md is under 500 lines
- [ ] README.md present for published skills
- [ ] Confirmation step before any state-changing operation
Report the results as a checklist to the user, noting any failures.
6. Optimize (existing skills only)
When reviewing an existing skill:
- 1. Read the current SKILL.md
- Run the quality check from Step 5
- List each issue found with a concrete fix
- Ask the user which fixes to apply
- Apply approved fixes
Do not rewrite an entire SKILL.md — make targeted, minimal edits.
Examples
| User says | Mode | Action |
|---|
| "I want to create a skill that tracks my reading list" | Create | Scaffold reading-track/, gather examples, write SKILL.md + README.md |
| "Can you review my sm-saver skill?" |
Optimize | Read
sm-saver/SKILL.md, run checklist, report issues |
| "Build a skill for checking server status" | Create | Scaffold
server-check/, gather examples, write SKILL.md + README.md |
| "Improve the reminder skill for ClawHub" | Optimize | Read
reminder/SKILL.md, run checklist, add README.md if missing |
技能构建器
一种用于遵循官方最佳实践创建和优化OpenClaw技能的元技能。引导您完成从意图到可发布技能的结构化工作流程。
工作流程
1. 理解意图
确定模式:
用户想要改进或审查现有技能 |
如果是创建:向用户询问2-3个具体的使用示例(他们会说什么来触发这个技能,应该发生什么)。这些示例驱动描述和工作流程设计。
如果是优化:在继续之前,阅读现有的SKILL.md并记录其当前结构。
2. 搭建目录结构
在~/workspace/skills/下创建技能目录:
<技能名称>/
├── SKILL.md (必需 — 代理指令)
├── README.md (推荐用于已发布技能)
├── scripts/ (如果需要确定性代码)
└── references/ (如果需要按需加载大型文档)
命名规则:
- - 小写,仅使用连字符(无下划线,无空格)
- 最多64个字符
- 尽可能以动词开头(例如,workout-track、skill-builder)
- 文件夹名称必须与frontmatter中的name字段匹配
3. 编写SKILL.md
SKILL.md是核心文件 — 它包含代理执行技能的指令。
Frontmatter(YAML)
三个字段:
yaml
name: <技能名称>
description: <功能描述>。当<触发上下文>时使用。
metadata: {openclaw:{requires:{bins:[列表,的,二进制文件]}}}
- - name:必须与文件夹名称完全匹配
- description:主要触发机制。包含当...时使用以帮助代理决定何时激活。要具体以避免与其他技能重叠
- metadata:声明运行时依赖。如果需要完整参考,加载{baseDir}/references/frontmatter-spec.md
主体结构
按照以下规则编写主体:
- 1. 开头行:用一句话解释技能的功能
- ## 工作流程:编号的H3步骤(### 1. 步骤名称)— 使用祈使句
- 表格用于结构化数据(要提取的字段、标志、映射)
- 代码块包含精确命令 — 使用exec工具JSON格式:
json
{
tool: exec,
command:
}
- 5. ## 示例:包含真实输入/输出对的表格(至少3行)
- 错误处理部分:当事情失败时该怎么做 — 始终存在,从不静默重试
关键规则
- - 保持SKILL.md在500行以内 — 将详细文档移至references/
- 使用{baseDir}表示技能目录内的路径(例如,{baseDir}/scripts/run.sh)
- 无硬编码密钥 — 从环境变量、.env或通过jq从openclaw.json读取
- 全程使用祈使句(提取URL,而不是URL被提取)
- 状态变更前确认 — 在写入数据库、发送消息等之前显示摘要并询问
4. 编写README.md
面向用户的文档,包含以下部分:
markdown
<技能名称>
<功能描述 — 1-2行>
要求
设置
<逐步设置说明>
用法
<2-3个自然语言示例,展示用户会说什么>
安装
\\\bash
clawhub install <作者>/<技能名称>
\\\
5. 质量检查
加载{baseDir}/references/checklist.md并验证每一项:
- - [ ] Frontmatter包含name + description
- [ ] name与文件夹名称匹配
- [ ] 描述包含当...时使用触发短语
- [ ] 无硬编码密钥或API密钥
- [ ] 所有内部路径使用{baseDir}
- [ ] 元数据声明运行时依赖(requires.bins、requires.env)
- [ ] 存在错误处理部分
- [ ] 示例部分至少包含3行
- [ ] SKILL.md在500行以内
- [ ] 已发布技能存在README.md
- [ ] 任何状态变更操作前有确认步骤
将结果作为清单报告给用户,并注明任何失败项。
6. 优化(仅限现有技能)
审查现有技能时:
- 1. 阅读当前的SKILL.md
- 运行步骤5中的质量检查
- 列出发现的每个问题并提供具体修复方案
- 询问用户应用哪些修复
- 应用批准的修复
不要重写整个SKILL.md — 进行有针对性的最小化编辑。
示例
| 用户说 | 模式 | 操作 |
|---|
| 我想创建一个追踪我阅读列表的技能 | 创建 | 搭建reading-track/目录,收集示例,编写SKILL.md + README.md |
| 你能审查一下我的sm-saver技能吗? |
优化 | 读取sm-saver/SKILL.md,运行检查清单,报告问题 |
| 构建一个检查服务器状态的技能 | 创建 | 搭建server-check/目录,收集示例,编写SKILL.md + README.md |
| 改进ClawHub的提醒技能 | 优化 | 读取reminder/SKILL.md,运行检查清单,如果缺少则添加README.md |