Building a custom OpenClaw skill lets you package domain-specific knowledge and tooling into a reusable capability that any agent can use. A custom skill consists of three parts: a SKILL.md file with instructions, an optional tools.json defining custom tool interfaces, and a skill.json manifest with metadata. This guide walks through the complete lifecycle -- from scaffolding a skill directory, writing effective instructions, defining tool parameter schemas, testing locally against a real agent, to publishing on ClawHub for the community.
Master building custom openclaw skills
Take the Personalizing Your OpenClaw Agent course with hands-on lessons and challenges.
The CLI scaffolds a complete skill directory with templates for each file. This gives you the correct structure and sections to fill in. Start by editing skill.json with your metadata, then write the SKILL.md instructions.
This SKILL.md follows the recommended structure: Description, When to Use, Prerequisites, step-by-step Instructions, a Rollback section for error recovery, Safety Rules with hard boundaries, and Common Patterns for reference. Each section serves a purpose -- the agent uses 'When to Use' to decide activation and 'Safety Rules' as inviolable constraints.
Custom tools in tools.json define the interface the agent uses. Each tool has a name, a description the model reads to understand when to use it, an executor type (bash runs a shell command), a command template with parameter placeholders, and a JSON Schema for parameters. The confirm parameter on rollback forces the agent to get user approval before destructive actions.
Local testing catches problems before publishing. The test command creates a sandboxed session where you can verify the agent follows the SKILL.md instructions for various prompts. The validate command checks the manifest structure, SKILL.md token count, and tool schema validity. Always test with edge cases like missing prerequisites or error scenarios.
Publishing requires authentication with your ClawHub account. The publish command uploads the SKILL.md, tools.json, and manifest. Bump the version in skill.json before publishing updates. ClawHub reviews skills for quality and security -- new skills may take a short time to appear in search results.
Writing SKILL.md instructions that are vague or ambiguous, like 'deploy the application carefully' instead of specific step-by-step commands
Write concrete, numbered steps with exact commands. The agent follows instructions literally. 'Run docker compose pull, then docker compose up -d --remove-orphans' is actionable. 'Deploy carefully' is not.
Defining custom tools without parameter validation schemas, allowing the agent to pass malformed inputs that cause runtime errors
Always define JSON Schema for tool parameters with types, descriptions, and required fields. OpenClaw validates parameters against the schema before execution, catching errors early with clear messages.
Forgetting to list required built-in tools in skill.json, causing the skill to fail silently when installed on an agent that lacks those tools
Audit your SKILL.md instructions and tools.json for every built-in tool referenced. List them all in the requiredTools array. This enables the install command to warn about missing tools upfront.
Skipping local testing and publishing a skill that produces incorrect or unsafe agent behavior in real conversations
Always test with `openclaw skills test` using at least 3-5 representative prompts, including edge cases and error scenarios. Verify the agent follows safety rules and handles failures correctly.
Publishing a skill with a generic name like 'deploy' that conflicts with other skills on ClawHub, causing confusion
Use descriptive, namespaced names: 'docker-compose-deploy', 'aws-ecs-deploy', 'vercel-deploy'. Specificity reduces naming conflicts and makes the skill's purpose immediately clear in search results.
Building custom OpenClaw skills involves creating a SKILL.md with structured instructions, defining tool interfaces with JSON Schema parameters in tools.json, and declaring metadata in skill.json. Test locally with `openclaw skills test` before publishing to ClawHub. Write concrete, step-by-step instructions with explicit safety rules. Keep skills focused on a single capability and under 1,000 tokens. Define parameter schemas for all custom tools. Version with semver and test updates in staging before publishing.
Interactive lessons and challenges on Stanza, practice in VS Code, Cursor, or the web.
Interactive lessons and challenges, right in your code editor.
Check the free courses. No credit card.