Create, improve, and maintain OpenClaw AgentSkills. This guide covers the full lifecycle from pattern extraction through testing.
OpenClaw skills are not just simple prompt files. Skills designed for OpenClaw's architecture — 3-layer loading (description → body → references), sub-agent context injection, Phase 0 analysis — significantly improve agent quality. This skill systematizes those design principles and provides validated examples across 5 types (pipeline, single-task, tool integration, code generation, document conversion).
filename.ko.md, filename.ja.md, filename.zh.mdtext
skill-name/
├── SKILL.md # Required. Frontmatter + instructions.
├── references/ # Optional. Loaded on demand by the agent.
│ ├── output-format.md # Output specifications
│ └── subagent-prompt-templates.md # Sub-agent prompt templates
├── scripts/ # Optional. Executable code (Python/Bash/etc.)
│ ├── extract_epub.py
│ └── extract_pdf.py
├── assets/ # Optional. Files used in output, not loaded into context.
│ └── template.html
└── examples/ # Optional. Example files for reference.
DO NOT create: README.md, CHANGELOG.md, INSTALLATION_GUIDE.md, QUICK_REFERENCE.md, LICENSE, or similar auxiliary documentation.
yaml
---
name: skill-name
description: >
What this skill does and when it should trigger.
Include keywords in multiple languages.
Keywords: keyword1, keyword2, 키워드1, 키워드2.
---
name: lowercase, hyphens only. Under 64 chars. Prefer short, verb-led names.
description: This is the primary triggering mechanism. OpenClaw reads this to decide when to load the skill. Include:
OpenClaw loads skills in three layers:
Implication: Every word in description is always costing tokens. Be concise. Every word in SKILL.md costs tokens when the skill triggers. Keep it lean.
Before writing anything, analyze examples of the agent performing the task well without a skill.
Ask:
This analysis becomes the Style Guide. This is the most important step. A skill that only specifies format but not style produces dry, mediocre results.
If sub-agents or previous skill versions produced bad results, identify exactly what went wrong:
SymptomLikely CauseOutput is dry/blandMissing style guide — no "what to preserve" rulesFlow is disconnectedChunks processed independently — missing Phase 0 context injectionLots of duplicationMissing merge/restructure instructionsInconsistent styleNo style rules in sub-agent promptsSub-agent ignores instructionsSub-agent prompt lacks context from Phase 0
Every failure maps to a specific instruction to add to the skill.
Write the Style Guide before the workflow. The workflow is "what order" — the Style Guide is "how to judge."
markdown
## Style Guide
### Essence
- What is the core of this task? (e.g., "Summarization is restructuring, not compression.")
- What perspective should the agent take?
### Preservation Criteria (NEVER discard)
- Specific examples with "why"
### Compression Criteria (what to reduce)
- Specific examples with "why"
### Style Rules
- Tone, sentence length, formatting conventions
- Rules specific to this context
Build the workflow around the Style Guide:
markdown
## Workflow
### Phase 0: [Analysis Step] (★ Most Important)
What to analyze before starting, and where that information gets used.
### Phase 1~N: [Execution Steps]
Each step's specific instructions.
### Phase N+1: [Validation Step]
How to verify the output meets quality standards.
Key principles:
If SKILL.md approaches 500 lines, split:
Content typeWhere to put itOutput structure/specificationsreferences/output-format.mdSub-agent prompt templatesreferences/subagent-prompt-templates.mdDomain knowledge (APIs, schemas)references/domain.mdExamplesreferences/examples.md
Always link references from SKILL.md with a description of when to read them.
Sub-agents are the #1 source of skill quality degradation. The root cause is always the same: the sub-agent lacks context that the main agent has.
Always include in sub-agent prompts:
Don't copy templates verbatim. Use [ ] placeholders filled from Phase 0:
markdown
Sub-agent prompt template (fill `[ ]` from Phase 0 results):
## Context
[Overall structure from Phase 0]
[This chunk's position in the whole]
## Preserve (this chunk only)
[Specific items from Phase 0]
## Instructions
[Depth/format/style rules]
---
[Chunk text]
---
If Phase 0 didn't produce [ ] values, the template can't be filled. The sub-agent becomes a context-free "text compressor." This is why Phase 0 is mandatory.
When multiple depth levels exist (e.g., 1x and 5x), use sequential dependency:
text
depth=1x: Analyze → Chunk → Summarize → Merge → summary.md
depth=5x: Analyze → Chunk → Summarize → Merge → summary.md
→ Use summary.md as skeleton → Expand → summary_5x.md
Why sequential? The simpler output provides structure for the complex one. Starting with the complex version means each chunk is independently summarized, losing overall flow.
When merging multiple chunk results:
Workspace ( ~/.openclaw/workspace/skills/)Bundled ( /app/skills/)PersistenceSurvives container restartsReset on container restartScopeUser-specific, project-specificShared, system-wideWhen to useCustom workflows, domain knowledgeUniversal tools (weather, discord, etc.)Source of truthThis directory for new custom skillsReference only, don't modify
Always create custom skills in workspace. Never modify bundled skills.
For any skill, check:
Triggering
description clearly explains when to trigger?Style Guide
Workflow
Sub-agent Integration
[ ] placeholders filled from Phase 0?File Organization
Anti-PatternProblemFixFormat-only, no styleDry, mediocre outputAdd Style GuideSub-agent without contextDisconnected chunksAdd Phase 0 + context injectionSimple concatenationDuplication, no flowAdd restructure instructionsArbitrary chunk boundariesContent cut mid-section"Cut only at section/chapter boundaries"Parallel depth generationInconsistent structuresSequential pipeline (simple → complex)Template used verbatimContext-free instructionsFill [ ] from Phase 0 results"When to use" in bodyNever read (body loads after trigger)Move to description
references/openclaw-vs-codex.md — Differences from the bundled Codex skill-creator and porting checklistexamples/summarize.md — Validation example: summarize skill (sub-agent pipeline type)examples/changelog.md — Validation example: changelog skill (doc conversion type)examples/scaffold.md — Validation example: scaffold skill (code generation type)examples/screenshot-capture.md — Validation example: screenshot-capture skill (tool integration type)examples/unit-converter.md — Validation example: unit-converter skill (single-task type)examples/skill-audit.md — Validation example: skill-audit (meta validation tool)