Complete step-by-step tutorial to build a custom OpenClaw skill from scratch
This tutorial will guide you through creating your first OpenClaw skill. We'll build a simple but practical skill that demonstrates the core concepts. By the end, you'll understand how to create, test, and share skills. Estimated time: 20-30 minutes.
We'll create a Random Quote Skill that:
This is a simple example, but it covers all the fundamentals you need to build more complex skills.
Before starting, ensure you have:
~/clawdBefore writing code, let's plan what our skill will do:
Random Quote Skill will:
For this skill, we'll use OpenClaw's built-in capabilities. We don't need external APIs - we'll store quotes in the skill file itself. This keeps it simple for learning.
Skills are stored in your workspace. Let's create the directory structure:
mkdir -p ~/clawd/skills/random-quote
Directory structure: Skills are organized as ~/clawd/skills/<skill-name>/. The skill name should be lowercase with hyphens (kebab-case).
~/clawd, but you can check or change it in your configuration.
See the Configuration Reference for details.
Every skill needs a SKILL.md file. This is a Markdown file that defines your skill.
Create the skill file in your skill directory:
touch ~/clawd/skills/random-quote/SKILL.md
# or open in your editor:
code ~/clawd/skills/random-quote/SKILL.md
Open SKILL.md and add the following content:
# Random Quote Skill
## Description
Provides inspirational and motivational quotes when users ask for quotes, inspiration, or motivation.
This skill demonstrates basic skill structure and can be extended with more quotes or API integration.
## Tools
This skill uses OpenClaw's built-in capabilities to select and return quotes. No external tools required.
## Instructions
When the user asks for:
- A quote
- Inspiration
- Motivation
- A random quote
- Something uplifting
Respond with a random quote from the following list, formatted nicely:
1. "The only way to do great work is to love what you do." - Steve Jobs
2. "Innovation distinguishes between a leader and a follower." - Steve Jobs
3. "Life is what happens to you while you're busy making other plans." - John Lennon
4. "The future belongs to those who believe in the beauty of their dreams." - Eleanor Roosevelt
5. "It is during our darkest moments that we must focus to see the light." - Aristotle
6. "The only impossible journey is the one you never begin." - Tony Robbins
7. "In the middle of difficulty lies opportunity." - Albert Einstein
8. "Success is not final, failure is not fatal: it is the courage to continue that counts." - Winston Churchill
Vary your responses and make them feel natural. You can add context or commentary to the quote if appropriate.
## Examples
- User: "Give me a quote"
Response: "Here's an inspiring quote for you: 'The only way to do great work is to love what you do.' - Steve Jobs"
- User: "I need some motivation"
Response: "Here's something to inspire you: 'The future belongs to those who believe in the beauty of their dreams.' - Eleanor Roosevelt"
- User: "Random quote please"
Response: "Here's a quote: 'In the middle of difficulty lies opportunity.' - Albert Einstein"
Save the file after adding this content.
Let's break down what each section does:
Now we need to tell OpenClaw about your new skill. There are two ways to do this:
Simply ask OpenClaw to enable your skill via your connected channel:
OpenClaw will automatically detect and enable the skill!
Alternatively, add it to your configuration file:
{
"agent": {
"model": "anthropic/claude-opus-4-5"
},
"skills": {
"enabled": ["random-quote"]
}
}
After adding to config, restart your Gateway for changes to take effect.
Now let's test that your skill works!
Via your connected channel (Telegram, WhatsApp, etc.), try asking:
OpenClaw should respond with a quote from your skill. If it does, congratulations - your skill is working! 🎉
Now that your basic skill works, here are ways to enhance it:
Expand your quote list in the Instructions section. Add quotes from your favorite authors, speakers, or sources.
You could extend the skill to support categories:
Update the Instructions section to handle these variations.
For a more advanced version, you could:
See the Skills Reference for examples of skills using external APIs and tools.
If OpenClaw doesn't use your skill:
SKILL.md is in ~/clawd/skills/random-quote/SKILL.mdIf the skill doesn't activate when you ask for quotes:
If OpenClaw responds but not with quotes:
Congratulations on creating your first skill! Here's what to explore next:
Once you're comfortable with basic skills, explore these advanced patterns:
Browse the ClawHub skills registry to see examples of advanced skills created by the community.