Skill Writer
Write well-structured, effective SKILL.md files for the ClawdHub registry. Covers the skill format specification, frontmatter schema, content patterns, example quality, and common anti-patterns.
When to Use
- - Creating a new skill from scratch
- Structuring technical content as an agent skill
- Writing frontmatter that the registry indexes correctly
- Choosing section organization for different skill types
- Reviewing your own skill before publishing
The SKILL.md Format
A skill is a single Markdown file with YAML frontmatter. The agent loads it on demand and follows its instructions.
CODEBLOCK0
Frontmatter Schema
name (required)
The skill's slug identifier. Must match what you publish with.
CODEBLOCK1
Rules:
- - Lowercase, hyphenated:
csv-pipeline, INLINECODE2 - No spaces, no underscores
- Keep it short and descriptive (1-3 words)
- Check for slug collisions before publishing: INLINECODE3
description (required)
The single most important field. This is what:
- 1. The registry indexes for semantic search (vector embeddings)
- The agent reads to decide whether to activate the skill
- Users see when browsing search results
CODEBLOCK2
Pattern for effective descriptions:
CODEBLOCK3
metadata (required)
JSON object with the clawdbot schema:
CODEBLOCK4
Fields:
- -
emoji: Single emoji displayed in registry listings requires.anyBins: Array of CLI tools the skill needs (at least one must be available)os: Array of supported platforms: "linux", "darwin" (macOS), "win32" (Windows)
Choose requires.anyBins carefully:
CODEBLOCK5
Content Structure
The "When to Use" Section
Always include this immediately after the title paragraph. It tells the agent (and the user) the specific scenarios where this skill applies.
CODEBLOCK6
Rules:
- - 4-8 bullet points
- Each bullet is a concrete scenario, not an abstract concept
- Start with a verb or gerund: "Automating...", "Debugging...", "Converting..."
- Don't repeat the description field verbatim
Main Content Sections
Organize by task, not by concept. The agent needs to find the right command for a specific situation.
CODEBLOCK7
Code Blocks
Every section should have at least one code block. Skills without code blocks are opinions, not tools.
INLINECODE14
Code block best practices:
- - Always specify the language (
bash, python, javascript, yaml, sql, etc.) - Show the output in a comment below the command
- Use realistic values, not
foo/bar (use myapp, api-server, real IP formats) - Include the most common case first, then variations
- Add inline comments for non-obvious flags or arguments
Multi-Language Coverage
If a skill applies across languages, use consistent section structure:
CODEBLOCK10 bash
echo -n "Hello" | sha256sum
### JavaScript
javascript
const crypto = require('crypto');
crypto.createHash('sha256').update('Hello').digest('hex');
### Python
python
import hashlib
hashlib.sha256(b"Hello").hexdigest()
CODEBLOCK13
Order: Bash first (most universal), then by popularity for the topic.
The "Tips" Section
End every skill with a Tips section. These are the distilled wisdom — the things that save hours of debugging.
CODEBLOCK14
Rules:
- - 5-10 bullets
- Each tip is a standalone insight (no dependencies on other tips)
- Prioritize gotchas and non-obvious behavior over basic advice
- No "always use best practices" platitudes
Skill Types and Templates
CLI Tool Reference
For skills about a specific tool or command family.
CODEBLOCK15
Language/Framework Reference
For skills about patterns in a specific language or framework.
CODEBLOCK16
Workflow/Process Guide
For skills about multi-step processes.
CODEBLOCK17
Anti-Patterns
Too abstract
CODEBLOCK18 bash
Bash: exit on any error
set -euo pipefail
Trap for cleanup on exit
trap 'rm -f "$TMPFILE"' EXIT
CODEBLOCK19
Too narrow
CODEBLOCK20
Wall of text without examples
If any section goes more than 10 lines without a code block, it's too text-heavy. Break it up with examples.
Missing cross-references
If your skill mentions another tool or concept that has its own skill, note it:
CODEBLOCK21
Outdated commands
Verify every command works on current tool versions. Common traps:
- - Docker Compose:
docker-compose (v1) vs. docker compose (v2) - Python:
pip vs. pip3, python vs. INLINECODE29 - Node.js: CommonJS (
require) vs. ESM (import)
Size Guidelines
| Metric | Target | Too Short | Too Long |
|---|
| Total lines | 300-550 | < 150 | > 700 |
| Sections |
5-10 | < 3 | > 15 |
| Code blocks | 15-40 | < 8 | > 60 |
| Tips | 5-10 | < 3 | > 15 |
A skill under 150 lines probably lacks examples. A skill over 700 lines should be split into two skills.
Publishing Checklist
Before publishing, verify:
- 1. Frontmatter is valid YAML — test by pasting into a YAML validator
- Description starts with what the skill does — not "This skill..." or "A skill for..."
- Every section has at least one code block — no text-only sections in the main content
- Commands actually work — test in a clean environment
- No placeholder values left — search for
TODO, FIXME, example.com used as real URLs - Slug is available —
npx molthub@latest search "your-slug" returns no exact match requires.anyBins lists real dependencies — tools the skill's commands actually invoke- Tips section exists — with 5+ actionable, non-obvious bullets
Publishing
CODEBLOCK22
Tips
- - The
description field is your skill's search ranking. Spend more time on it than any single content section. Include the specific verbs and nouns users would search for. - Lead with the most common use case. If 80% of users need "how to encode Base64", put that before "how to convert between MessagePack and CBOR."
- Every code example should be copy-pasteable. If it needs setup that isn't shown, add the setup.
- Write for the agent, not the human. The agent needs unambiguous instructions it can follow step by step. Avoid "you might want to consider" — say "do X when Y."
- Test your skill by asking an agent to use it on a real task. If the agent can't follow the instructions to produce a correct result, the skill needs work.
- Prefer
bash code blocks for commands, even in language-specific skills. The agent often operates via shell, and bash blocks signal "run this." - Don't duplicate what
--help already provides. Focus on patterns, combinations, and the non-obvious things that --help doesn't teach. - Version your skills semantically: patch for typo fixes, minor for new sections, major for restructures. The registry tracks version history.
技能编写
为ClawdHub注册表编写结构清晰、高效的SKILL.md文件。涵盖技能格式规范、前置元数据模式、内容模式、示例质量以及常见反模式。
何时使用
- - 从零开始创建新技能
- 将技术内容结构化为代理技能
- 编写注册表能正确索引的前置元数据
- 为不同类型的技能选择章节组织方式
- 在发布前审查自己的技能
SKILL.md格式
技能是包含YAML前置元数据的单个Markdown文件。代理按需加载并遵循其指令。
markdown
name: my-skill-slug
description: 何时使用此技能的一句话描述。
metadata: {clawdbot:{emoji:🔧,requires:{anyBins:[tool1,tool2]},os:[linux,darwin,win32]}}
技能标题
此技能涵盖内容的一段摘要。
何时使用
主要内容章节
带示例的子章节
代码块、命令、模式...
提示
前置元数据模式
name(必填)
技能的slug标识符。必须与发布时使用的名称一致。
yaml
name: my-skill
规则:
- - 小写,连字符连接:csv-pipeline、git-workflows
- 无空格,无下划线
- 保持简短且具描述性(1-3个词)
- 发布前检查slug冲突:npx molthub@latest search your-slug
description(必填)
最重要的字段。它用于:
- 1. 注册表进行语义搜索的索引(向量嵌入)
- 代理读取以决定是否激活技能
- 用户在浏览搜索结果时看到
yaml
好:具体的触发条件和范围
description: 为任何项目类型编写Makefile。在设置构建自动化、定义多目标构建、管理任务间依赖、创建项目任务运行器,或为非C项目(Go、Python、Docker、Node.js)使用Make时使用。同时涵盖Just和Task作为现代替代方案。
差:模糊,无触发条件
description: 关于Makefile的技能。
差:过长(在搜索结果中被截断)
description: 此技能涵盖您需要了解的关于Makefile的所有内容,包括变量、目标、先决条件、模式规则、自动变量、伪目标、条件逻辑、多目录构建、包含文件、静默执行,并且还涵盖Just和Task作为Go、Python、Docker或Node.js等项目的现代替代方案...
有效描述的格式:
[功能描述]。当[触发条件1]、[触发条件2]、[触发条件3]时使用。同时涵盖[相关主题]。
metadata(必填)
包含clawdbot模式的JSON对象:
yaml
metadata: {clawdbot:{emoji:🔧,requires:{anyBins:[make,just]},os:[linux,darwin,win32]}}
字段:
- - emoji:在注册表列表中显示的单个表情符号
- requires.anyBins:技能所需的CLI工具数组(至少有一个可用)
- os:支持的平台数组:linux、darwin(macOS)、win32(Windows)
谨慎选择requires.anyBins:
yaml
好:列出技能命令实际使用的工具
requires: {anyBins: [docker, docker-compose]}
差:列出每个系统都有的通用工具
requires: {anyBins: [bash, echo]}
好:适用于通过多个工具工作的技能
requires: {anyBins: [make, just, task]}
内容结构
何时使用章节
始终在标题段落之后立即包含此章节。它告诉代理(和用户)此技能适用的具体场景。
markdown
何时使用
- - 自动化构建、测试、代码检查、部署命令
- 定义任务间的依赖关系(构建前先测试)
- 创建项目级任务运行器
- 用简短目标替代长CLI命令
规则:
- - 4-8个要点
- 每个要点是具体场景,而非抽象概念
- 以动词或动名词开头:自动化...、调试...、转换...
- 不要逐字重复描述字段
主要内容章节
按任务组织,而非按概念。代理需要为特定情况找到正确的命令。
markdown
好:按任务组织
编码与解码
Base64
URL编码
十六进制
差:按抽象概念组织
编码理论
编码类型
高级主题
代码块
每个章节至少应有一个代码块。没有代码块的技能只是观点,而非工具。
markdown
好:具体、可运行的示例
bash
将字符串编码为Base64
echo -n Hello, World! | base64
SGVsbG8sIFdvcmxkIQ==
差:抽象描述
Base64编码使用64个字符的字母表将二进制数据转换为ASCII文本...
代码块最佳实践:
- - 始终指定语言(bash、python、javascript、yaml、sql等)
- 在命令下方的注释中显示输出
- 使用实际值,而非foo/bar(使用myapp、api-server、真实IP格式)
- 先包含最常见的情况,然后是变体
- 为不明显的标志或参数添加内联注释
多语言覆盖
如果技能适用于多种语言,使用一致的章节结构:
markdown
哈希
Bash
bash
echo -n Hello | sha256sum
JavaScript
javascript
const crypto = require(crypto);
crypto.createHash(sha256).update(Hello).digest(hex);
Python
python
import hashlib
hashlib.sha256(bHello).hexdigest()
顺序:Bash优先(最通用),然后按主题流行度排序。
提示章节
每个技能以提示章节结尾。这些是精炼的智慧——能节省数小时调试时间的内容。
markdown
提示
- - Makefile的头号错误:使用空格而非制表符进行缩进。
- SHA-256是完整性检查的标准。MD5可用于去重,但在加密用途上已被破解。
- 如果适用夏令时,切勿在凌晨1:00-3:00之间安排关键cron任务。
规则:
- - 5-10个要点
- 每个提示是独立的见解(不依赖其他提示)
- 优先考虑陷阱和非显而易见的行为,而非基础建议
- 避免始终使用最佳实践的陈词滥调
技能类型与模板
CLI工具参考
适用于特定工具或命令家族的技能。
markdown
name: tool-name
description: [工具功能]。当[场景1]、[场景2]时使用。
metadata: {clawdbot:{emoji:🔧,requires:{anyBins:[tool-name]}}}
工具名称
[一段话:它的功能及使用原因。]
何时使用
快速参考
[最常见的命令及示例]
常见操作
[操作1]
[操作2]
高级模式
[模式1]
故障排除
[常见错误及修复]
提示
语言/框架参考
适用于特定语言或框架中模式的技能。
markdown
name: pattern-name
description: [语言/框架]中的[模式]。当[场景1]、[场景2]时使用。
metadata: {clawdbot:{emoji:📐,requires:{anyBins:[runtime]}}}
模式名称
何时使用
快速参考
[速查表/语法总结]
模式
[模式1 — 带完整示例]
[模式2 — 带完整示例]
跨语言比较(如适用)
反模式
[不该做什么,附解释]
提示
工作流/流程指南
适用于多步骤流程的技能。
markdown
name: workflow-name
description: [工作流描述]。当[场景1]、[场景2]时使用。
metadata: {clawdbot:{emoji:🔄,requires:{anyBins:[tool1,tool2]}}}
工作流名称
何时使用
先决条件
[需要先设置的内容]
分步指南
步骤1:[操作]
步骤2:[操作]
步骤3:[操作]
变体
[不同上下文的变体]
故障排除
提示
反模式
过于抽象