Create Your First Skill
Empower your agent with new abilities. We'll build a 'Random Quote Generator' to demonstrate the skill structure.
What We'll Build
We'll create a Random Quote Skill that:
- Provides inspirational quotes when asked
- Demonstrates basic skill structure
- Shows how to use built-in tools
- Can be easily extended later
This is a simple example, but it covers all the fundamentals you need to build more complex skills.
Prerequisites
Before starting, ensure you have:
- OpenClaw installed and running - Complete the Getting Started Tutorial first
- A channel connected - Follow the Channel Setup Tutorial
- Basic text editor - Any editor works (nano, VS Code, etc.)
- Access to your workspace - Default location is
~/.openclaw
Plan Your Skill
Before writing code, let's plan what our skill will do:
Skill Purpose
Random Quote Skill will:
- Respond when users ask for quotes, inspiration, or motivation
- Provide a random quote from a predefined list
- Be simple enough to understand, but extensible
What Tools Do We Need?
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.
Tutorial.alert.tip
Create Skill Directory
Skills are stored in your workspace. Let's create the directory structure:
mkdir -p ~/.openclaw/skills/random-quote
Directory structure: Skills are organized as ~/.openclaw/skills/<skill-name>/. The skill name should be lowercase with hyphens (kebab-case).
Tutorial.alert.success
~/.openclaw, but you can check or change it in your configuration. See the Configuration Reference for details.Create the Skill File
Every skill needs a SKILL.md file. This is a Markdown file that defines your skill.
Step 3.1: Create SKILL.md
Create the skill file in your skill directory:
touch ~/.openclaw/skills/random-quote/SKILL.md # or open in your editor: code ~/.openclaw/skills/random-quote/SKILL.md
Step 3.2: Write the Skill Content
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.
Understanding the Skill Structure
Let's break down what each section does:
- Description - What your skill does (used by OpenClaw to understand when to use it)
- Tools - What capabilities your skill uses (can be built-in or external APIs)
- Instructions - How OpenClaw should use this skill (triggers, behavior, examples)
- Examples - Concrete examples of how the skill should work
Enable Your Skill
Now we need to tell OpenClaw about your new skill. There are two ways to do this:
Method A: Ask OpenClaw (Easiest)
Simply ask OpenClaw to enable your skill via your connected channel:
- "Enable the random-quote skill"
- "Use the random-quote skill"
- "Activate random-quote"
OpenClaw will automatically detect and enable the skill!
Method B: Manual Configuration
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.
Test Your Skill
Now let's test that your skill works!
Step 5.1: Send Test Messages
Via your connected channel (Telegram, WhatsApp, etc.), try asking:
- "Give me a quote"
- "I need inspiration"
- "Random quote please"
- "Motivate me"
Step 5.2: Verify Response
OpenClaw should respond with a quote from your skill. If it does, congratulations - your skill is working! π
Tutorial.alert.success
- OpenClaw responds with quotes from your list
- Quotes vary between requests
- Responses feel natural and contextual
Improve Your Skill (Optional)
Now that your basic skill works, here are ways to enhance it:
- 1Add More QuotesExpand your quote list in the Instructions section. Add quotes from your favorite authors, speakers, or sources.
- 2Add CategoriesYou could extend the skill to support categories (e.g., "Give me a motivational quote", "Quote about success"). Update the Instructions section to handle these variations.
- 3Integrate External APIFor a more advanced version, you could use a quotes API, add a tool that fetches quotes from the web, or store quotes in a database.
Troubleshooting
Skill Not Working
If OpenClaw doesn't use your skill:
- Check file location: Ensure
SKILL.mdis in~/.openclaw/skills/random-quote/SKILL.md - Verify skill is enabled: Check your configuration or ask OpenClaw to list enabled skills
- Check file format: Ensure it's valid Markdown and the structure is correct
- Restart Gateway: Sometimes a restart is needed to load new skills
Skill Not Triggering
If the skill doesn't activate when you ask for quotes:
- Review your Instructions section - are the triggers clear?
- Try more explicit requests like "use the random-quote skill"
- Check that the Description mentions quotes/inspiration
Wrong Responses
If OpenClaw responds but not with quotes:
- Make your Instructions more specific
- Add more examples to clarify expected behavior
- Ensure the skill description clearly states its purpose
Next Steps
Congratulations on creating your first skill! Here's what to explore next:
Advanced Skill Patterns
Once you're comfortable with basic skills, explore these advanced patterns:
- API Integration - Connect to external services and APIs
- File Operations - Read and write files on the system
- Database Access - Store and retrieve data
- Complex Tools - Create custom tools with multiple parameters
- Conditional Logic - Skills that adapt based on context
Browse the OpenClaw Hub skills registry to see examples of advanced skills created by the community.