Complete guide for creating skills compatible with clawhub registry and optimized for AI agent usage.
Skill description must be in English, unless context requires otherwise (examples, comments, etc. may use other languages when appropriate).
description in frontmatter: English only# Run initializer
./scripts/init-skill.sh my-skill
# Or manually create structure
mkdir -p my-skill/{references,scripts,assets}
touch my-skill/SKILL.md my-skill/_meta.json my-skill/LICENSE.txt
Before writing any code, clarify:
Output: Clear understanding of skill scope and triggers.
Choose pattern based on complexity:
| Complexity | Structure | When to Use |
|---|---|---|
| ------------ | ----------- | ------------- |
| Simple | SKILL.md only | <100 lines, single purpose |
| Medium | + references/ | 100-300 lines, some details |
| Complex | + references/ + assets/ | >300 lines, multi-domain |
Decide on resources:
Output: Directory structure and resource list.
# Create directory
mkdir -p my-skill/{references,scripts,assets}
# Create required files
touch my-skill/SKILL.md
touch my-skill/_meta.json
touch my-skill/LICENSE.txt
Required files for clawhub:
my-skill/
├── SKILL.md # Instructions and metadata (required)
├── _meta.json # Registry metadata (required)
├── LICENSE.txt # License file (required)
├── references/ # Optional: detailed documentation
├── scripts/ # Optional: automation scripts
└── assets/ # Optional: templates, resources
---
name: skill-name
description: What it does. Use when: (1) trigger-1, (2) trigger-2, (3) trigger-3.
---
Critical rules:
name must match directory namedescription is ONLY trigger mechanism — include all "when to use" heredescription must be in Englishname and description are required in frontmatter# Skill Title
Brief purpose (1-2 sentences).
## Quick Start
**Linux/Mac:**
command --option
**Windows CMD:**
command --option
**PowerShell:**
command --option
## When to Use
- Situation 1: What to do
- Situation 2: What to do
- Situation 3: What to do
## Workflow
1. **Step one**: Description
2. **Step two**: Description
3. **Step three**: Description
## Resources
- `references/advanced.md` - For complex cases
- `references/examples.md` - Usage examples
- `assets/template.txt` - Starting template
Writing guidelines:
{
"name": "skill-name",
"version": "1.0.0",
"description": "Short description for registry listing",
"requires": {
"env": ["ENV_VAR_1", "ENV_VAR_2"],
"credentials": ["credential_name"]
},
"tags": ["tag1", "tag2", "latest"]
}
Fields explained:
name: Must match directory and SKILL.md frontmatterversion: Semver (X.Y.Z), check registry before settingdescription: For registry listing, must be in Englishrequires.env: Environment variables neededrequires.credentials: Credentials neededtags: Include "latest" for discoverabilityChoose license (MIT recommended):
MIT License
Copyright (c) 2025 [Author]
Permission is hereby granted...
Create files in references/:
# Reference Title
Detailed documentation here.
## Section
Content...
Guidelines:
# Check structure
./scripts/validate.sh my-skill
# Or manual checks:
# - SKILL.md exists and has frontmatter
# - _meta.json is valid JSON
# - LICENSE.txt exists
# - No README.md, CHANGELOG.md
# - Line count < 300
# - References linked correctly
Validation checklist:
name in frontmatter and _meta.jsondescription in English, includes "Use when:" triggersTrigger test:
Workflow test:
Resource test:
Edge case test:
If tests reveal issues:
Iterate cycle: Phase 8 → Phase 9 → Phase 10 (loop) → Phase 11
Before publishing, verify current registry version:
# Check current registry version
clawhub inspect skill-name --json | grep version
# Ensure new version follows semver:
# 1.0.0 → 1.0.1 (patch: bug fixes)
# 1.0.0 → 1.1.0 (minor: new features)
# 1.0.0 → 2.0.0 (major: breaking changes)
# Never downgrade! (1.1.0 → 1.0.2 is wrong)
Update _meta.json with correct version:
{
"version": "1.0.1"
}
# Create .skill package for distribution
./scripts/package-skill.sh my-skill ./dist
# Output: dist/my-skill.skill
# Validates structure before packaging
Package contains:
cd my-skill
# Publish to clawhub
clawhub publish . --version 1.0.1 --changelog "Description of changes"
# Verify publication
clawhub inspect skill-name
After publish:
clawhub install skill-nameInstructions and metadata:
Registry metadata:
{
"name": "skill-name",
"version": "1.0.0",
"description": "Registry listing description in English",
"requires": {
"env": [],
"credentials": []
},
"tags": ["latest"]
}
License file (MIT, Apache-2.0, etc.)
references/skill-structure.md - Directory structure patternsreferences/agent-first-design.md - Designing for AI vs humansreferences/token-optimization.md - Minimizing context usagereferences/cross-platform.md - Platform-aware scriptsreferences/validation-checklist.md - Pre-publish checksreferences/versioning.md - Semver best practicesSkills used by AI agents, not humans:
Level 1: Metadata (name + description) → Always loaded
Level 2: SKILL.md body → On trigger
Level 3: Resources (references/, assets/) → On demand
| Component | Target | Max |
|---|---|---|
| ----------- | -------- | ----- |
| Metadata | 50 words | 100 words |
| SKILL.md | 200 lines | 300 lines |
| References | 3K words | 5K words |
| Total | 5K tokens | 10K tokens |
Instead of script:
## Commands
**Linux/Mac:**
command --option
**Windows CMD:**
command --option
**PowerShell:**
command --option
Agent chooses appropriate variant based on detected platform.
Required in English:
description in SKILL.md frontmatterdescription in _meta.jsonMay use other languages:
scripts/init-skill.sh - Initialize new skill structurescripts/package-skill.sh - Package skill for distributionscripts/validate.sh - Validate skill structure❌ Don't:
✅ Do:
共 1 个版本