๐ŸงฉCustom Development

How to Create OpenClaw Skills with skill.md

Intermediate45-60 minutesUpdated 2025-02-04

skill.md is OpenClaw's format for defining capabilities, permissions, and behavior. This guide covers the skill.md specification, creating production-ready skills, managing permissions, setting up triggers, and publishing to ClawHub for community use.

Why This Is Hard to Do Yourself

These are the common pitfalls that trip people up.

๐Ÿ“

skill.md format quirks

Format has implicit conventions, version differences, and edge cases not well documented

๐Ÿ”

Permission model complexity

Declaring capabilities correctly and understanding enforcement varies between OpenClaw versions

๐Ÿ”„

Trigger configuration

Commands, schedules, webhooks, and patterns have different requirements and behaviors

๐Ÿ“ฆ

Publishing standards

ClawHub has strict quality, security, and documentation requirements for acceptance

Step-by-Step Guide

Step 1

Understand skill.md structure

Learn the complete skill.md format specification.

# skill.md has two parts:
# 1. YAML frontmatter (between ---)
# 2. Instructions markdown

---
name: my-skill
version: 1.0.0
description: What this skill does
author: your-name
permissions:
  - filesystem:read
  - network:outbound
triggers:
  - command: /mycommand
  - schedule: "0 9 * * *"
  - webhook: /path
---

## Instructions
Detailed instructions for the AI on how to use this skill.
Step 2

Define skill metadata

Fill in name, version, description, and author.

---
name: weather-reporter
version: 1.0.0
description: "Fetches current weather and provides forecasts using OpenWeatherMap API"
author: "John Doe"
requires: "1.0.0"  # Minimum OpenClaw version
license: "MIT"
homepage: "https://github.com/johndoe/weather-reporter"
---
Step 3

Declare required permissions

List all capabilities the skill needs.

# Permission categories:
permissions:
  # Filesystem access
  - filesystem:read
  - filesystem:write
  - filesystem:delete
  
  # Network access
  - network:outbound
  - network:inbound
  
  # Shell/process access
  - process:spawn
  - process:kill
  
  # Database access
  - database:read
  - database:write
  
  # System information
  - system:env  # Read environment variables
  - system:info  # CPU, memory, disk info

Warning: Request only minimum permissions needed. Excessive permissions cause ClawHub review rejection.

Step 4

Configure trigger types

Set up command, schedule, webhook, or pattern triggers.

# Command trigger (manual):
triggers:
  - command: /weather
  - command: /forecast

# Schedule trigger (cron):
triggers:
  - schedule: "0 9 * * 1-5"  # 9 AM weekdays

# Webhook trigger:
triggers:
  - webhook: /update-weather

# Pattern trigger (AI detects pattern):
triggers:
  - pattern: "what's the weather"
  - pattern: "forecast for"
Step 5

Write clear instructions

Document how the AI should use this skill.

## Instructions

You can fetch weather data and provide forecasts using the OpenWeatherMap API.

### Available Functions

1. **get_current_weather(city, units="metric")**
   - Returns current temperature, humidity, wind speed
   - units: "metric" (Celsius) or "imperial" (Fahrenheit)

2. **get_forecast(city, days=5)**
   - Returns weather forecast for next N days
   - days: 1-14

### Usage Examples

When user asks "What's the weather in London?":
1. Call get_current_weather("London")
2. Format response clearly with temperature, humidity, conditions
3. Offer to provide a forecast

When user asks "5-day forecast for NYC":
1. Call get_forecast("New York", 5)
2. Display each day's forecast in a readable table
Step 6

Add helper code (optional)

Create JavaScript/Python scripts for complex logic.

// Create scripts/ directory
mkdir scripts

// Create helper functions in scripts/weather.js
export async function getCurrentWeather(city, units = "metric") {
  const response = await fetch(
    `https://api.openweathermap.org/data/2.5/weather?q=${city}&units=${units}&appid=${process.env.OPENWEATHER_API_KEY}`
  );
  return response.json();
}

// Reference in skill.md:
// The system will load helper functions from scripts/ automatically
Step 7

Test the skill locally

Verify the skill loads and works correctly.

# Place skill in OpenClaw skills directory
mkdir -p ~/.openclaw/skills/weather-reporter
cp skill.md ~/.openclaw/skills/weather-reporter/
cp -r scripts ~/.openclaw/skills/weather-reporter/

# Restart OpenClaw
npm restart

# In OpenClaw chat, test:
# /weather London
# What's the forecast for NYC?
Step 8

Prepare for ClawHub publishing

Add documentation and metadata for marketplace.

# Create README.md
cat > README.md << EOF
# Weather Reporter Skill

Fetch current weather and 5-day forecasts using OpenWeatherMap.

## Setup

1. Get API key from openweathermap.org
2. Set OPENWEATHER_API_KEY environment variable
3. Install skill via OpenClaw

## Usage

- "/weather London" - Current weather
- "What's the forecast for NYC?" - 5-day forecast
EOF

# Create clawhub.json with metadata
cat > clawhub.json << EOF
{
  "name": "Weather Reporter",
  "tagline": "Real-time weather and forecasts",
  "description": "Fetches current weather and provides 5-day forecasts using OpenWeatherMap API",
  "category": "productivity",
  "tags": ["weather", "forecast", "api"],
  "pricing": "free"
}
EOF

Need Help Building Production Skills?

Our developers create ClawHub-ready skills with proper error handling, documentation, and testing. Get professionally built, maintainable skills.

Get matched with a specialist who can help.

Sign Up for Expert Help โ†’

Frequently Asked Questions