How to Create and Share OpenClaw Skills: Developer Tutorial
Learn how to build OpenClaw agent skills with SKILL.md, scripts, and references. A step-by-step tutorial for publishing skills that other agents can use.
What Are OpenClaw Skills?
OpenClaw is an AI agent runtime that connects Claude and other LLMs to your devices, APIs, and services. Skills are modular instruction packages that teach OpenClaw agents how to perform specific tasks โ from managing GitHub issues to controlling smart home devices.
Every skill is a folder with a SKILL.md file and optional scripts, templates, or reference files.
Skill Anatomy
my-skill/
โโโ SKILL.md # Instructions for the agent
โโโ scripts/ # Optional automation scripts
โ โโโ deploy.sh
โโโ templates/ # Optional templates
โ โโโ pr-template.md
โโโ references/ # Optional reference docs
โโโ api-docs.md
SKILL.md Structure
# My Skill Name
## Description
One-line description of what this skill does.
## When to Use
- Trigger condition 1
- Trigger condition 2
## Instructions
Step-by-step instructions the agent follows.
## Tools Required
- tool1
- tool2
## Examples
Concrete usage examples.
Building a Skill: GitHub PR Reviewer
Let's build a real skill that reviews pull requests.
Step 1: Define the Trigger
## When to Use
- User asks to review a PR
- User says "review PR #123"
- User pastes a GitHub PR URL
Step 2: Write Instructions
## Instructions
1. Fetch the PR diff using `gh pr diff {number}`
2. Read the changed files
3. For each file, check:
- Code style consistency
- Potential bugs or edge cases
- Missing error handling
- Test coverage
4. Write a structured review comment with:
- Summary (1-2 sentences)
- Issues found (categorized by severity)
- Suggestions for improvement
- Approval recommendation (approve/request changes)
5. Post the review using `gh pr review {number}`
Step 3: Add Scripts
#!/bin/bash
# scripts/review-checklist.sh
# Quick automated checks before the AI review
PR_NUM=$1
REPO=${2:-$(gh repo view --json nameWithOwner -q .nameWithOwner)}
echo "=== PR #$PR_NUM Review Checklist ==="
# Check PR size
ADDITIONS=$(gh pr view $PR_NUM --json additions -q .additions)
DELETIONS=$(gh pr view $PR_NUM --json deletions -q .deletions)
echo "Size: +$ADDITIONS/-$DELETIONS"
if [ $ADDITIONS -gt 500 ]; then
echo "โ ๏ธ Large PR โ consider breaking into smaller PRs"
fi
# Check for test files
CHANGED_FILES=$(gh pr diff $PR_NUM --name-only)
HAS_TESTS=$(echo "$CHANGED_FILES" | grep -c "test\|spec")
echo "Test files changed: $HAS_TESTS"
if [ $HAS_TESTS -eq 0 ]; then
echo "โ ๏ธ No test files modified โ verify test coverage"
fi
Step 4: Add Examples
## Examples
### Basic PR Review
User: "Review PR #42"
Agent:
1. Runs `gh pr view 42` for context
2. Runs `scripts/review-checklist.sh 42`
3. Reads diff with `gh pr diff 42`
4. Analyzes each changed file
5. Posts structured review
### Review with Focus
User: "Review PR #42, focus on security"
Agent: Same flow but emphasizes:
- Input validation
- SQL injection risks
- Authentication/authorization checks
- Sensitive data exposure
Skill Quality Guidelines
Do's
- Be specific โ "Run
gh pr diff" not "check the diff" - Include error handling โ What if the PR doesn't exist?
- Add examples โ Real input/output pairs
- Document dependencies โ What tools/CLIs are needed?
- Keep it focused โ One skill, one job
Don'ts
- Don't write vague instructions ("do a good review")
- Don't assume tools are installed โ check first
- Don't skip error cases
- Don't make skills too broad (a "do everything" skill does nothing well)
Testing Your Skill
Before publishing, test thoroughly:
- Happy path โ Does it work with normal input?
- Edge cases โ Empty PR, huge PR, binary files?
- Error cases โ Invalid PR number, no permissions?
- Different contexts โ Works in different repos?
# Test with OpenClaw locally
openclaw skill test ./my-skill --input "Review PR #42"
Publishing to Skill Market
Ready to share? Publish on Skill Market:
- Package your skill folder
- Add metadata (name, description, keywords, platform: "openclaw")
- Set pricing (free or paid)
- Submit for review
- Published!
Metadata Example
{
"name": "github-pr-reviewer",
"displayName": "GitHub PR Reviewer",
"description": "Automated code review for GitHub pull requests",
"category": "development",
"platforms": ["openclaw"],
"keywords": ["github", "code review", "pull request"]
}
Popular OpenClaw Skills
Get inspired by community skills:
- openclaw-web-scraper โ Intelligent web scraping and data extraction
- openclaw-github-ops โ GitHub workflow automation
- openclaw-deploy-pro โ Deployment pipeline management
Browse all OpenClaw skills โ
Conclusion
OpenClaw skills are the building blocks of AI agent automation. A well-crafted skill turns a general-purpose AI into a domain expert. Start with a simple skill that solves a problem you face daily, test it thoroughly, and share it with the community.
The best skills are born from real needs. What will you build?
Ready to supercharge your AI workflow?
Browse hundreds of community-built skills for your favorite AI tools.
Browse Skills โ