mkdir -p skills/my_skill
2. Write the SKILL.md File (With Advanced Metadata)
Inside your new directory, create the SKILL.md file. Like all Agent Skills, it requires a YAML frontmatter block followed by Markdown instructions.
But here is where OpenClaw shines: the metadata.openclaw field. It allows you to define a single-line JSON object that acts as a load-time filter. You can tell the agent: "Only load this skill if the user is on macOS and has jq installed on their PATH."
Here is a complete example of an advanced SKILL.md:
---
name: my_greeting_skill
description: Greets the user and performs a system-level action using a bundled script.
user-invocable: true
disable-model-invocation: false
metadata.openclaw: '{"os":["darwin","linux"],"requires":{"bins":["jq"],"env":["API_KEY"]}}'
---
You are executing my_greeting_skill.
Step 1: Greet the user based on their input.
Step 2: Use the built-in `exec` tool to run the shell script bundled with this skill.
The script is located at: {baseDir}/scripts/action.sh
Key OpenClaw Features in this file:
-
metadata.openclaw: Prevents the skill from loading and breaking if the user lacks the required environment variables or system binaries.
-
{baseDir}: A dynamic variable that automatically resolves to the absolute path of your skill folder, allowing you to easily trigger bundled scripts!
-
Built-in tools: You can instruct the agent to use standard OpenClaw tools like
exec (for terminal commands) or browser.
3. Load and Verify Your Skill
OpenClaw snapshots your skills the moment a session starts. To load your new skill, simply start a new chat session:
openclaw chat
To verify that your skill successfully passed the dependency filters and was loaded, type this inside the chat:
/tools verbose
4. Test Your Skill
You have three ways to trigger and test your skill:
-
Implicitly (Autonomous): Just ask a natural question in the chat: "Can you run my greeting skill?" The agent reads the description and triggers it.
-
Explicitly (Manual): Type the slash command
/skill my_greeting_skill directly in the chat interface.
-
CLI Testing (Headless): Test it straight from your terminal without opening the chat interface:
openclaw agent --message "Run the greeting skill"
⚠️ Security Tip: If your skill uses the exec tool, ensure your Markdown instructions strictly guide the agent to sanitize inputs and prevent arbitrary command injection.
5. Share with ClawHub
The best part about OpenClaw is ClawHub—the public skill registry. Once you've perfected your SKILL.md, you can publish it to the community.
Or, if you want to see how others build their skills, you can easily install community tools via:
openclaw skills install <skill-slug>
What kind of skills are you building for your OpenClaw agents? Let me know below!