create-claw-skill
Original:🇺🇸 English
Translated
2 scriptsChecked / no sensitive code detected
This skill should be used when the user asks to "create an OpenClaw skill", "make a claw skill", "build a skill for OpenClaw", "write a SKILL.md for openclaw", "add a skill to openclaw", "generate openclaw skill frontmatter", "create a clawhub skill", "port a skill to OpenClaw", "convert a Claude Code skill to claw", "migrate my skill to openclaw", or wants to author a new skill or port an existing Claude Code skill for the pi-coding-agent / OpenClaw ecosystem.
8installs
Sourcegupsammy/claudest
Added on
NPX Install
npx skill4agent add gupsammy/claudest create-claw-skillTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →OpenClaw Skill & Command Generator
Generate well-structured OpenClaw skills or slash commands. Both are SKILL.md files with YAML frontmatter — they share the same structure but differ in how they're triggered and described. OpenClaw uses the AgentSkills spec (pi-coding-agent) with its own frontmatter fields, tool names, and path conventions distinct from Claude Code.
Phase 0: Fetch Current Documentation
Before generating, retrieve the latest OpenClaw skill documentation:
bash
clawdocs get "tools/skills" --no-header -qCapture any frontmatter fields or options not already listed in . If is unavailable, proceed with current references — they are sufficient. If new fields appear, use them and note the update.
{baseDir}/references/frontmatter-options.mdclawdocsPhase 1: Understand Requirements
Parse for type hint. Users are often unclear on OpenClaw-specific conventions. Interview to gather:
$ARGUMENTS- Primary objective — What should this skill do?
- Trigger scenarios — When should it activate? What exact phrases would a user say?
- Inputs/outputs — What does it receive and produce?
- Complexity — Simple, standard, or complex workflow?
- Gating needs — Does it require specific binaries, env vars, or config keys? (drives )
metadata.openclaw.requires.* - Execution needs — Sub-agent delegation via ? Command dispatch (bypass model)?
sessions_spawn
Proceed to Phase 2 when at minimum Objective and Trigger Scenarios are established.
Port Mode
When the user provides an existing Claude Code skill to port (file path or pasted content), skip the interview and apply this translation sequence:
- Read the source skill and all its supporting files (scripts, references, examples)
- Frontmatter — Remove invalid fields (,
model,context,agent,allowed-tools,hooks). Addlicensewithmetadataif scripts need specific binaries. Seerequiresfor valid fields.{baseDir}/references/frontmatter-options.md - Tool names — Apply the translation table from :
{baseDir}/references/claw-patterns.md→Bash,exec→Read,read→Write,write→Edit,edit/Glob→Grep+exec/find,rg→WebSearch,web_search→WebFetch,web_fetch→Task,sessions_spawn→conversational askingAskUserQuestion - Paths — Replace with
$CLAUDE_PLUGIN_ROOT. Remove{baseDir}injection and bang-backtick references.@file - Scripts/references — Copy as-is if they are platform-neutral Python with no Claude Code SDK dependencies. Update any internal tool name references.
- Proceed directly to Phase 2 Step 7 (Validate) with translated content, then Phase 3 (Deliver).
Phase 2: Generate
Apply throughout generation: use imperative voice and terse phrasing because every token in a generated skill body costs budget on every invocation. Prefer instruction over example — state the rule with its reasoning so it generalizes to every input.
Initialize directory first (when creating a new skill directory, not editing an existing file):
bash
python3 {baseDir}/scripts/init_claw_skill.py <name> --path <dir> [--resources scripts,references,assets]Exit 0 = directory scaffolded, proceed to Step 1. Exit 1 = naming collision; ask user whether to overwrite or rename.
Step 1 — Choose type
- Skills: Trigger-rich, third-person description ("This skill should be used when..."); auto-triggered by routing
- Commands: Concise, verb-first description, under 60 chars; user-invoked via menu
/ - Dispatch commands: with
command-dispatch: tool— bypasses model entirely, routes directly to a named tool (rare; for pure pass-through cases)command-tool
Step 2 — Write frontmatter
Read for the full OpenClaw field catalog, description patterns, and the single-line JSON constraint.
{baseDir}/references/frontmatter-options.mdmetadataKey constraint: must be a single-line JSON object on one line. Multi-line YAML mappings under are not valid in OpenClaw.
metadatametadataDescription density rules: Keep descriptions under ~400 characters / ~100 tokens (600 chars / 150 tokens absolute max) — they load every session. Per the OpenClaw cost formula, each skill costs characters in the system prompt; a 10-skill install with verbose descriptions burns significant context on routing metadata alone. Derive trigger phrases from the user's actual words in Phase 1, not paraphrases. See the token budget and trigger derivation principles in .
195 + 97 + field lengths{baseDir}/references/frontmatter-options.mdIntensional over extensional — state the rule with its reasoning rather than listing examples that imply the rule. An intensional rule generalizes to every input the skill will encounter; an extensional list only covers the shapes shown.
Step 3 — Validate description discoverability
Before writing the body, verify the description will route correctly. Mentally generate:
- 3 should-trigger prompts — realistic user messages that should activate this skill. Include at least one naive phrasing from a user who has never heard of the skill.
- 3 should-NOT-trigger prompts — messages in adjacent domains that are close but should not activate. These test whether the description is too broad.
Evaluate: does the description cover all should-trigger prompts? Would it plausibly reject the should-NOT-trigger prompts? If coverage is weak, revise the description — add missing trigger phrases, tighten language to exclude adjacent domains, or add a negative trigger ("Not for X").
This step catches routing misses before the rest of the skill is built. Proceed when description coverage is adequate.
Step 4 — Write body
Construction rules:
- State objective explicitly in first sentence
- Use imperative voice ("Analyze", "Generate", "Identify") — no first-person ("I will", "I am")
- Context only when necessary for understanding
- XML tags only for complex structured data
- No "When to Use This Skill" section — body loads only after triggering; routing guidance there is never read by the routing decision
- Avoid headers deeper than H3 — deep nesting signals content that belongs in , not
references/SKILL.md - is the path variable for skill-relative file references (substituted before model sees the skill body)
{baseDir}
Both skills and commands follow the same body pattern:
markdown
# Name
Brief overview (1-2 sentences).
## Process
1. Step one (imperative voice)
2. Step two
3. Step threeDynamic Content:
| Syntax | Purpose |
|---|---|
| All arguments as string |
| Positional arguments |
| Absolute path to skill directory (substituted at load time) |
Note: injection and bang-backtick command expansion are Claude Code features specific to Claude Code's skill loader implementation — the pi-coding-agent skill loader only supports path substitution and does not implement these extensions. Do not use them in generated OpenClaw skills.
@file{baseDir}Step 5 — Script opportunity scan
Read and apply the five signal patterns to every workflow step in the skill being generated:
{baseDir}/references/script-patterns.md| Signal | Question | If yes → |
|---|---|---|
| Repeated Generation | Does any step produce the same structure with different params across invocations? | Parameterized script in |
| Unclear Tool Choice | Does any step combine multiple operations in a fragile sequence naturally expressible as one function? | Script the procedure |
| Rigid Contract | Can you write | CLI candidate |
| Dual-Use Potential | Would a user want to run this step from the terminal, outside the skill workflow? | Design as proper CLI from the start |
| Consistency Critical | Must this step produce bit-for-bit identical output for identical inputs? | Script — never LLM generation |
For each identified script candidate:
- Choose the archetype from (init/validate/transform/package/query)
{baseDir}/references/script-patterns.md - Scaffold the script in using the Python template from
scripts/{baseDir}/references/script-patterns.md - Wire it into SKILL.md with: trigger condition, exact invocation using tool, output interpretation
exec
Wiring rule: A script reference must state when to invoke (trigger condition), how to invoke (exact command with flags), and what to do with the result (exit code handling, which output fields matter).
Scripts are invoked via the tool (not ). Reference paths using .
execBash{baseDir}/scripts/script.pyStep 6 — Check delegation
Read for delegation patterns, usage, cross-skill reference conventions, and tool group translations (Claude Code → OpenClaw tool name mapping).
{baseDir}/references/claw-patterns.mdsessions_spawnScan for existing resources before finalizing:
Review available OpenClaw skills (check ~/.openclaw/skills/ and workspace/skills/)
For each workflow step, ask: "Do we already have this?"Common delegation patterns:
- To invoke another OpenClaw skill: tell the model to read via the
{baseDir}/../<other-skill>/SKILL.mdtool, or instruct the user to typeread/<other-skill-name> - For background delegation: use (non-blocking; result announced back to chat)
sessions_spawn - Documentation lookups:
exec: clawdocs get "<slug>" --no-header -q
There is no tool in OpenClaw — skills are invoked by the routing model, not programmatically from within another skill.
SkillStep 7 — Validate
When generating a new skill directory (not editing an existing single file):
bash
python3 {baseDir}/scripts/validate_claw_skill.py <skill-directory> --output jsonExit 0 = proceed to Phase 3. Exit 1 = parse the array; each entry has , , . Resolve all and items before writing to disk.
errorsfieldmessageseveritycriticalmajorExplain Your Choices
When presenting the generated skill/command to the user, briefly explain:
- What you set and why — "Added because the skill calls jq in a subprocess"
metadata.openclaw.requires.bins: [jq] - What you excluded and why — "Left at default (true),
user-invocableomitted (skill routes through model)"command-dispatch - Add more trigger phrases if routing misses expected inputs
Phase 3: Deliver
Output Paths
| Type | Location | When active |
|---|---|---|
| Workspace skill | | Next session in that workspace |
| Managed skill | | Shared across all agents on this machine |
Skills are session-snapshotted — changes take effect on the next new session, not the current one.
Write and Confirm
Before writing:
Writing to: [path]
This will [create new / overwrite existing] file.
Proceed?After Creation
Summarize what was created:
- Name and type
- Path and when it takes effect
- How to invoke/trigger
- Suggested test scenario
Publish to ClawHub
Invoke only when the user explicitly requests distribution:
bash
clawhub publish <skill-directory> --slug <slug> --version X.Y.Z --tags latestExit 0 = published. Exit 1 = validation or auth failure; read stdout for details.
Phase 4: Evaluate
Score the generated skill/command:
| Dimension | Criteria |
|---|---|
| Clarity (0-10) | Instructions unambiguous, objective clear |
| Precision (0-10) | Appropriate specificity without over-constraint |
| Efficiency (0-10) | Token economy — maximum value per token |
| Completeness (0-10) | Covers requirements without gaps or excess |
| Usability (0-10) | Practical, actionable, appropriate for target use |
Target: 9.0/10.0. If below, refine once addressing the weakest dimension, then deliver.
Re-run after any revisions and verify the validation checklist below before finalizing.
validate_claw_skill.pyDegrees of Freedom
| Level | When to Use | Format |
|---|---|---|
| High freedom | Multiple valid approaches, context-dependent decisions | Text instructions, heuristics |
| Medium freedom | Preferred pattern exists, some variation acceptable | Pseudocode, scripts with parameters |
| Low freedom | Fragile operations, consistency critical, specific sequence required | Exact scripts, few parameters |
Quality Standards
Format Economy:
- Simple task → direct instruction, no sections
- Moderate task → light organization with headers
- Complex task → full semantic structure
Remove ruthlessly: Filler phrases, obvious implications, redundant framing, excessive politeness
Validation Checklist
Before finalizing an OpenClaw skill or command:
Structure:
- SKILL.md exists with valid YAML frontmatter
- Frontmatter has and
namefieldsdescription - field (if present) is single-line JSON on one line
metadata - Markdown body is present and substantial
- Referenced files actually exist
Description Quality:
- Uses third person ("This skill should be used when...")
- Includes specific trigger phrases users would say (verbatim)
- Trigger phrases derived from user's actual words, not formalized paraphrases
- Under ~400 chars (~100 tokens); 600 chars (~150 tokens) absolute max
- Negative triggers present if adjacent skills could false-trigger
- Lists concrete scenarios ("create X", "configure Y")
- Not vague or generic
OpenClaw Correctness:
- No Claude Code-only fields: no ,
model,context,agent,allowed-tools,hookslicense - No Claude Code tool names referenced in body: no ,
Bash,WebSearch,WebFetch,Read,Write,Edit,Glob,Grep,Task,Skill,AskUserQuestion,EnterPlanModeExitPlanMode - Uses OpenClaw tool names: ,
exec,read,write,edit,web_search,web_fetchsessions_spawn - Uses for skill-relative paths (not
{baseDir})$CLAUDE_PLUGIN_ROOT - Output path is OpenClaw workspace () or managed (
<workspace>/skills/)~/.openclaw/skills/
Content Quality:
- Body uses imperative/infinitive form, not second person
- Body is focused and lean (1,500–2,000 words ideal, <5k max)
- Detailed content moved to
references/ - Scripts are executable and documented
- Script opportunities identified via five signal patterns
- Script references in SKILL.md include trigger condition, invocation (), output handling
exec - Consistency-critical steps are scripted, not left to LLM re-generation
Progressive Disclosure:
- Core concepts in SKILL.md
- Detailed docs in
references/ - Utilities in
scripts/ - SKILL.md references these resources
- present if skill produces user-adaptable output (see
examples/for a minimal command example){baseDir}/examples/sample-command/SKILL.md
Error Handling
| Issue | Action |
|---|---|
| Unclear requirements | Ask clarifying questions before generating |
| Missing context | Request usage examples or target scenarios from user |
| Path issues | Verify target directory exists; let |
| Type unclear | Default to skill (auto-triggered) if user hasn't specified |
| Proceed with current references — they are sufficient |
Execute phases sequentially. Always fetch current documentation first.