๐Ÿ› ๏ธ Skills

How to Build Custom OpenClaw Skills (Step-by-Step)

Skills are reusable instruction sets that turn your agent into a specialist. Build a skill once, use it across every session. Here's the complete guide to writing SKILL.md files that actually work.

๐Ÿฆž claw.mobile EditorialยทMarch 22, 2026ยท
14 min read

What Are Skills and When to Build Them

A skill is a directory containing a SKILL.md file (plus optional scripts and references) that teaches your agent how to do a specific type of task. When you ask your agent to perform that task, it reads the skill file and follows the specialized instructions.

Built-in skills cover common tools like GitHub CLI, email (Himalaya), Things 3, weather, and many more. But your setup is unique โ€” and that's where custom skills shine.

Build a custom skill when:

  • โ†’You have a workflow you repeat more than 3โ€“4 times
  • โ†’The task involves specific tools, APIs, or formats unique to your setup
  • โ†’You want the same capability available to both your main agent and sub-agents
  • โ†’You want a procedure that's consistently followed without variation

Skill Directory Structure

All custom skills live in ~/.openclaw/workspace/skills/. Each skill gets its own directory:

Skill directory layout
~/.openclaw/workspace/skills/
โ””โ”€โ”€ my-skill/
    โ”œโ”€โ”€ SKILL.md           # Required: instructions for the agent
    โ”œโ”€โ”€ references/        # Optional: docs, schemas, examples
    โ”‚   โ””โ”€โ”€ api-docs.md
    โ””โ”€โ”€ scripts/           # Optional: helper scripts
        โ”œโ”€โ”€ fetch-data.sh
        โ””โ”€โ”€ process.py

Your custom skills directory is separate from built-in skills. This means they survive OpenClaw updates, can be backed up independently, and shared with teammates.

Writing the SKILL.md File

Every SKILL.md needs these sections:

SKILL.md โ€” Template
# Skill Name

## Description
One paragraph describing what this skill does and WHEN to use it.
Use exact phrases users would say when asking for this.

## Prerequisites
- Required tools or CLI utilities
- Required environment variables or API keys

## Instructions

### Step 1: [First action]
[Detailed instructions for step 1]

### Step 2: [Second action]
[Detailed instructions for step 2]

## Output Format
Describe the expected output format.

## Error Handling
What to do when things go wrong.

Writing a Good Description

Bad description

"Web content management"

Too vague โ€” might trigger on unrelated tasks

Good description

"Publish posts to WordPress, update existing posts, manage drafts via WP-CLI. Use when: creating new posts, scheduling content, or updating existing WordPress pages."

References and Scripts Directories

references/ โ€” Supporting Docs

Use references/ for supporting documentation your agent might need to read during the task. Reference files are not loaded automatically โ€” your SKILL.md should explicitly tell the agent to read them when needed:

Referencing docs in SKILL.md
## Instructions
Before starting, read references/api-docs.md for endpoint details.
The authentication flow is documented in references/auth.md.

scripts/ โ€” Executable Helpers

Use scripts/ for executable helper scripts that your skill calls via the exec tool:

Calling scripts in SKILL.md
### Step 2: Fetch Data
Run the fetch script:
exec: bash scripts/fetch-data.sh --date today

Parse the JSON output and extract the "results" array.

Bash vs Python: When to Use Each

๐Ÿš Use Bash for:

  • โ†’Calling CLI tools (gh, vercel, heroku, etc.)
  • โ†’Simple file operations (copy, move, grep, sed)
  • โ†’Chaining commands together
  • โ†’Environment variables and process management
#!/usr/bin/env bash
set -e
cd "$PROJECT_DIR"
git pull origin main
npm run build && npm run deploy

๐Ÿ Use Python for:

  • โ†’Complex data parsing or transformation
  • โ†’API calls with authentication
  • โ†’Working with JSON/CSV/YAML data
  • โ†’Tasks requiring logic, conditionals, loops over data
#!/usr/bin/env python3
import sys, json, requests

data = json.load(sys.stdin)
results = [r for r in data if r['active']]
print(json.dumps(results))

Full Example: Stock Price Checker Skill

~/.openclaw/workspace/skills/stock-checker/SKILL.md
# Stock Price Checker

## Description
Fetch current stock prices, percentage changes, and basic metrics
for any US-listed stock ticker. Use when asked about stock prices,
market data, portfolio values, or ticker lookups.

## Prerequisites
- ALPHA_VANTAGE_API_KEY environment variable set
- Python 3.8+ installed
- requests library: pip install requests

## Instructions

### Step 1: Identify Tickers
Extract all stock ticker symbols from the user's request.
Normalize to uppercase (e.g., "apple" โ†’ "AAPL").

### Step 2: Fetch Data
For each ticker, run:
exec: python3 scripts/fetch-stock.py --ticker {TICKER}

### Step 3: Format Output
Present results as a clean table:
| Ticker | Price | Change | Change % | Volume |

## Error Handling
If a ticker is not found: note it as "not found" and continue.
If API rate limit hit: wait 15 seconds and retry once.

## Output Format
Markdown table with all requested tickers.
Include timestamp of data fetch.

Using the skill-creator Skill

OpenClaw ships with a skill-creator skill that helps you build other skills. Just describe what you want:

Example prompt
"Create a skill for posting to my Ghost blog.
It should: authenticate with Ghost Admin API,
create draft posts, publish posts, and update existing ones.
The API key is stored in ~/.openclaw/.env as GHOST_ADMIN_KEY."

The agent will create the full skill directory, SKILL.md, and any required scripts.

Testing Your Skill

  1. 1

    Describe a simple use case

    Ask your agent to use the skill with a basic request. Watch if it correctly identifies and loads your skill.

  2. 2

    Check the skill is being loaded

    If the agent isn't using your skill, check the description section โ€” it needs to match the phrases you're using.

  3. 3

    Test edge cases

    Try requests that should trigger error handling. Make sure the agent follows your error instructions, not generic behavior.

  4. 4

    Iterate and refine

    Skills improve with use. After each session where the skill ran, review what went well and what was ambiguous. Update SKILL.md accordingly.

Start With the Setup Guide

New to OpenClaw? Get your agent running first, then come back to build custom skills.

Complete Setup Guide
We use cookies for analytics. Learn more
Run your own AI agent for $6/month โ†’