OpenClaw skills are the building blocks that turn a conversational AI into an autonomous agent. Each skill teaches your agent something new.
This guide walks you through creating the skill structure, writing SKILL.md, adding scripts, testing locally, and publishing to ClawHub.
What Is an OpenClaw Skill?
A directory with one required file: SKILL.md. It tells the agent what the skill does and how to use it.
my-skill/
├── SKILL.md
├── scripts/
│ └── run.sh
└── references/
└── api-docs.md
No package.json, no build step.
Step 1: Choose What Your Skill Does
Pick something you already do manually. We'll build a URL shortener skill using the CleanURI API — free, no auth needed.
Step 2: Create the Directory
mkdir -p ~/.openclaw/workspace/skills/url-shortener/scripts
cd ~/.openclaw/workspace/skills/url-shortener
Step 3: Write the SKILL.md
# URL Shortener
Shorten long URLs using the CleanURI API. Free, no API key required.
## When to Use
- User asks to shorten a URL
- Generating shareable links for social media posts
## How to Use
bash ~/.openclaw/workspace/skills/url-shortener/scripts/shorten.sh URL
## Notes
- No authentication required
- Rate limited to ~10 requests per minute
Key points: clear description, trigger conditions, exact commands, error handling notes, and constraints.
Step 4: Write the Script
#!/usr/bin/env bash
set -euo pipefail
URL="${1:?Usage: shorten.sh <url>}"
RESPONSE=$(curl -s -X POST "https://cleanuri.com/api/v1/shorten" \
-d "url=$URL" --max-time 10)
SHORT=$(echo "$RESPONSE" | jq -r '.result_url // empty')
if [ -z "$SHORT" ]; then
ERROR=$(echo "$RESPONSE" | jq -r '.error // "Unknown error"')
echo "Error: $ERROR" >&2
exit 1
fi
echo "$SHORT"
chmod +x scripts/shorten.sh
Step 5: Test It
bash scripts/shorten.sh "https://github.com/anthropics/anthropic-cookbook"
Then test with your agent — ask it to shorten a URL and see if it picks up the skill.
Step 6: Publish to ClawHub
clawhub publish ~/.openclaw/workspace/skills/url-shortener
Anyone can install it:
clawhub install your-username/url-shortener
Patterns for Better Skills
Be specific about triggers. Vague descriptions make it hard for the agent to activate your skill.
Fail loudly. The agent can recover from clear error messages, not silent failures.
Keep scripts idempotent. Same input, same output. Agents retry sometimes.
Document environment requirements. If your skill needs jq or ffmpeg, say so.
Use the references directory. Put complex API docs there instead of bloating SKILL.md.
Going Further with Clamper
Clamper helps manage skills at scale — tracking usage, monitoring token costs, syncing across machines, and providing a dashboard for performance visibility.
What to Build Next
- Notification skill (Pushover / ntfy.sh)
- Screenshot skill (capture web pages)
- Database query skill (SQLite / PostgreSQL)
- Deployment skill (one-command deploys)
- File converter skill (markdown to PDF, images to WebP)
Every skill you publish makes the OpenClaw ecosystem stronger. Get started on ClawHub.
Top comments (0)