Developing Skills
for OpenClaw

A comprehensive guide to extending AI agent capabilities through declarative skill architecture, from API automation to smart home orchestration.

Technical Guide 6 Sections 45 min read
2,857+
Available Skills
25
API Calls/Day (Free)
1,000+
HA Integrations
7.1%
Skills with Vulnerabilities

TL;DR: OpenClaw Skills are directories with a SKILL.md file, extending LLM agent capabilities through declarative instructions. Key scenarios include API automation (curl + jq), data processing (Python pipelines), and IoT control (Home Assistant REST API). Security is critical: no hardcoded secrets, only environment variables.

The architecture of OpenClaw Skills represents a fundamental shift from traditional software extension paradigms. Instead of writing imperative code that executes directly, developers create declarative instructions in natural language that large language models interpret to perform complex tasks. This approach combines the flexibility of natural language interfaces with the precision of structured workflows.

Declarative Structure

Skills are organized in directories with SKILL.md files containing YAML metadata and Markdown instructions for LLMs.

Tool Integration

Seamless integration with external tools through scripts/ directory while maintaining security boundaries.

Security First

No hardcoded secrets. All credentials managed through environment variables with scoped permissions.

Architecture Principles

The core concept of an OpenClaw Skill fundamentally differs from traditional plugins or extensions. A Skill functions as a documented contract between the agent and external systems, allowing the LLM to understand when and how to apply specific capabilities [373].

Skill Activation Process

  1. Scanning: Agent scans installed skills by name and description
  2. Selection: Chooses most relevant skill based on semantic matching
  3. Loading: Loads full SKILL.md into context (lazy loading)
  4. Execution: Interprets instructions and performs described actions

This progressive disclosure mechanism ensures efficient use of the LLM's context window. Skills load only when relevant, preventing token exhaustion that would occur if all skills were permanently present in the system prompt [373].

Skill Structure

A minimal Skill requires only a directory with a SKILL.md file. However, sophisticated skills follow a structured organization that separates declarative instructions from deterministic implementation.

my-skill/
├── SKILL.md          # Required: metadata and LLM instructions
├── scripts/          # Executable code (Python, Bash, etc.)
├── references/       # Documentation and specifications
└── assets/           # Templates and static resources

The SKILL.md file uses a two-component structure: YAML frontmatter for machine-readable metadata and Markdown section for human-readable LLM instructions [15] [313].

Important: The YAML parser supports only single-line values. Multi-line strings or block scalars will cause parsing errors [361].

YAML Frontmatter Structure

---
name: "stock-price"
description: "Get real-time stock prices using AlphaVantage"
version: "1.0.0"
allowed-tools:
  - "Bash(curl:*)"
  - "Bash(jq:*)"
metadata:
  openclaw:
    requires:
      env:
        - "STOCK_API_KEY"
      bins:
        - "curl"
        - "jq"
user-invocable: true
---

The allowed-tools field explicitly enumerates tools the agent can use without permission requests, implementing the principle of least privilege [398]. The {baseDir} template ensures portability by resolving to the skill's directory path at runtime.

API Integration & Web Services

API integration represents the most common skill scenario, enabling seamless communication between the AI agent and external services. The combination of curl for HTTP requests and jq for JSON processing forms the foundation of robust API skills.

cURL & jq Patterns

The curl utility serves as the fundamental tool for API integrations, offering universal protocol support and predictable behavior across environments [373].

Essential cURL Parameters

Silent Operation
-s / --silent - Suppress progress meter
Error Handling
-f / --fail - Return non-zero on HTTP errors
Redirects
-L / --location - Follow redirects
Headers
-H / --header - Add HTTP headers
# GET request with query parameters
curl "https://api.example.com/endpoint?param1=$VALUE1&apikey=$API_KEY"

# POST request with JSON body
curl -X POST "https://api.example.com/webhook" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $TOKEN" \
  -d '{"event": "$EVENT_TYPE", "data": "$PAYLOAD"}'

The jq utility provides declarative JSON transformation capabilities, enabling complex data extraction and formatting without imperative code.

# Extract nested data from Alpha Vantage API response
curl "https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol=$SYMBOL&apikey=$STOCK_API_KEY" | \
  jq '.["Global Quote"]'

# Format output with raw strings
| jq -r '"\(.["01. symbol"]): $\(.["05. price"]) (\(.["10. change percent"]))"'

Secure Authentication

Security research reveals that 7.1% of skills in ClawHub contain vulnerabilities exposing sensitive credentials [399]. The only secure approach is using environment variables declared in metadata.openclaw.requires.env [388].

Critical: Hardcoding API keys in SKILL.md creates multiple vulnerability vectors: version control leaks, log exposure, and LLM provider transmission.

// Configuration in ~/.openclaw/openclaw.json
{
  "skills": {
    "entries": {
      "stock-price": {
        "enabled": true,
        "env": {
          "STOCK_API_KEY": "your_alpha_vantage_key"
        }
      }
    }
  }
}

Advanced API Patterns

Error Handling

  • • Exponential backoff for transient failures
  • • Rate limit respect with Retry-After
  • • Graceful degradation with cached data
  • • Immediate alerts for auth failures

Webhooks

  • • Bidirectional communication
  • • Event-driven architecture
  • • Real-time reactivity
  • • Reduced polling overhead

Production-ready skills implement sophisticated error handling and recovery strategies. The webhook architecture enables external systems to initiate actions in OpenClaw through HTTP POST requests, supporting CI/CD events, payment notifications, and IoT alerts [373].

graph TD A["External System"] -->|"HTTP POST"| B["OpenClaw Webhook"] B --> C["Trigger Skill"] C --> D["Process Event"] D --> E["Take Action"] E --> F["Notify User"] style A fill:#e3f2fd,stroke:#1976d2,stroke-width:2px,color:#0d47a1 style B fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px,color:#4a148c style C fill:#e8f5e8,stroke:#388e3c,stroke-width:2px,color:#1b5e20 style D fill:#fff3e0,stroke:#f57c00,stroke-width:2px,color:#e65100 style E fill:#fce4ec,stroke:#c2185b,stroke-width:2px,color:#880e4f style F fill:#e0f2f1,stroke:#00695c,stroke-width:2px,color:#004d40

Data Processing & File Formats

Data processing skills automate routine operations with structured and unstructured data, integrating powerful Python-based tools while maintaining natural language interfaces for end users [277] [305].

Tabular Data Processing

Excel and CSV formats dominate business analytics, requiring specialized handling for complex scenarios: multiple sheets, formulas, conditional formatting, and merged cells.

Three-Stage Processing Pipeline

Clean
Reading & validation
Analyze
Metrics calculation
Visualize
Report generation
# Python script for Excel processing with pandas
def clean_data(input_path, output_path, sheet_name=0):
    df = pd.read_excel(input_path, sheet_name=sheet_name, 
                       engine='openpyxl', dtype=str)
    
    # Remove completely empty rows and columns
    df = df.dropna(how='all').dropna(axis=1, how='all')
    
    # Normalize column names
    df.columns = df.columns.str.lower().str.replace(' ', '_')
    
    # Save intermediate result
    df.to_csv(output_path, index=False, encoding='utf-8')
    return len(df), list(df.columns)

PDF Document Processing

PDF processing requires different approaches for text-based versus scanned documents. The pdfplumber library preserves layout information for accurate table extraction [72] [398].

Native PDF Processing

  • • Text extraction with layout preservation
  • • Table detection by geometric analysis
  • • Form field identification
  • • Metadata extraction
Tool: pdfplumber, PyPDF2

OCR Processing

  • • Image preprocessing (deskew, binarize)
  • • Multi-language support
  • • Cloud API integration
  • • Local Tesseract execution
Tools: pytesseract, Google Vision

Specialized File Formats

Beyond common office formats, skills handle diverse structured data through specialized tools and command-line utilities for efficient processing.

# JSON processing with jq
cat data.json | jq '.items[] | select(.status=="active")' | \
  jq '[.id, .name, .value] | @tsv'

# XML processing with xmlstarlet
xmlstarlet sel -t -m "//item" -v "concat(@id, ',', name, ',', value)" data.xml

# Image processing with ImageMagick
convert input.jpg -resize 1920x1080 -quality 85 output.jpg

Pipeline Architecture Benefits

  • Modularity: Clear separation of concerns between stages
  • Reusability: Individual components in different workflows
  • Testability: Independent testing of each processing stage
  • Transparency: Intermediate results for debugging and audit

Smart Home & IoT Integration

Smart home integration transforms the AI agent into a central control hub for residential spaces. Local execution ensures privacy and reliability without cloud dependencies [53] [157].

Home Assistant Integration

Home Assistant provides a comprehensive REST API for controlling over 1,000 integrations through a unified interface. The skill enables natural language control of the entire smart home ecosystem.

Lights

  • • Brightness control
  • • Color temperature
  • • RGB color selection
  • • Effects and scenes

Climate

  • • Temperature setting
  • • Mode selection
  • • Fan control
  • • Humidity monitoring

Media

  • • Playback control
  • • Volume adjustment
  • • Source selection
  • • TTS announcements
# Home Assistant skill configuration
---
name: "homeassistant"
description: "Control and monitor smart home devices"
metadata:
  {
    "openclaw":
      {
        "requires": { "bins": ["curl"], "env": ["HA_URL", "HA_TOKEN"] },
      },
  }
---

# Get current state
curl -s "$HA_URL/api/states/sensor.outdoor_temperature" \
  -H "Authorization: Bearer $HA_TOKEN"

# Call service to turn on light
curl -s -X POST "$HA_URL/api/services/light/turn_on" \
  -H "Authorization: Bearer $HA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"entity_id": "light.kitchen"}'

IoT Protocols

Modern IoT ecosystems rely on specialized protocols for device communication. OpenClaw skills interface with these protocols through unified abstractions.

MQTT Protocol

Lightweight pub/sub protocol for real-time IoT communication with quality of service guarantees.

Use Cases: Sensor telemetry, command distribution, device status monitoring

Zigbee/Z-Wave

Mesh networking protocols for low-power devices requiring hardware coordinators.

Use Cases: Smart lighting, sensors, locks, thermostats with local control
graph LR A["User Request"] --> B["OpenClaw Agent"] B --> C["Home Assistant Skill"] C --> D["HA REST API"] D --> E["Device Control"] D --> F["Sensor Data"] E --> G["Action Confirmation"] F --> H["Status Report"] G --> I["User Notification"] H --> I style A fill:#e3f2fd,stroke:#1976d2,stroke-width:2px,color:#0d47a1 style B fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px,color:#4a148c style C fill:#e8f5e8,stroke:#388e3c,stroke-width:2px,color:#1b5e20 style D fill:#fff3e0,stroke:#f57c00,stroke-width:2px,color:#e65100 style E fill:#fce4ec,stroke:#c2185b,stroke-width:2px,color:#880e4f style F fill:#e1f5fe,stroke:#0288d1,stroke-width:2px,color:#01579b style G fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px,color:#4a148c style H fill:#e8f5e8,stroke:#388e3c,stroke-width:2px,color:#1b5e20 style I fill:#e0f2f1,stroke:#00695c,stroke-width:2px,color:#004d40

IoT Security Considerations

IoT security requires layered protection: network segmentation, principle of least privilege, and comprehensive auditing of agent actions.

Security Best Practices

Network Segmentation
Isolate IoT devices in separate VLANs with restricted routing
Minimal Permissions
Dedicated user accounts with scoped entity access
Audit Logging
Comprehensive logging with SIEM integration for anomaly detection
# Network segmentation configuration
# Firewall rules for IoT VLAN
iptables -A FORWARD -i iot_vlan -o main_lan -j DROP
iptables -A FORWARD -i iot_vlan -p tcp -d homeassistant.local --dport 8123 -j ACCEPT
iptables -A FORWARD -i iot_vlan -p udp -d mqtt.local --dport 1883 -j ACCEPT

Best Practices & Development Guidelines

Effective skill development follows established patterns that ensure reliability, security, and maintainability across diverse use cases and integration scenarios.

Design Principles

Skills should embody the single responsibility principle: each skill solves one well-defined problem. This approach improves testability, reusability, and instruction clarity for LLMs [278].

Do This

  • • Implement idempotent operations
  • • Use explicit tool permissions
  • • Validate all external inputs
  • • Handle errors gracefully
  • • Document clear usage scenarios

Avoid This

  • • Monolithic "do-everything" skills
  • • Hardcoded secrets or credentials
  • • Floating version dependencies
  • • Unchecked external inputs
  • • Vague or ambiguous instructions

Testing & Security

Production-ready skills require comprehensive testing and security measures to prevent credential exposure and ensure reliable operation.

Security Checklist

Credential Management
  • ✓ Environment variables only
  • ✓ No secrets in SKILL.md
  • ✓ Scoped permissions
  • ✓ Token rotation procedures
Input Validation
  • ✓ Type and format checking
  • ✓ Range and boundary validation
  • ✓ Command injection prevention
  • ✓ Path traversal protection
# Secure input validation example
import os
import re

def validate_file_path(path):
    """Prevent path traversal attacks"""
    # Normalize the path
    abs_path = os.path.abspath(path)
    base_dir = os.path.abspath(os.getcwd())
    
    # Check if path is within allowed directory
    if not abs_path.startswith(base_dir):
        raise ValueError("Path traversal detected")
    
    return abs_path

def sanitize_command(input_str):
    """Prevent command injection"""
    # Remove dangerous characters
    return re.sub(r'[;&|`]', '', input_str)

Publishing & Lifecycle

ClawHub serves as the official skill registry with over 2,857 published skills [308]. Publication follows semantic versioning with comprehensive documentation and user feedback integration.

Publication Process

  1. Repository Setup: Create structured repository with README and LICENSE
  2. Version Tagging: Use semantic versioning (git tag v1.0.0)
  3. Documentation: Include quick start, installation, and usage examples
  4. Security Audit: Run vulnerability scanners and code analysis
  5. Submission: Publish through ClawHub UI or CLI
graph TD A["Developer"] --> B["Create Skill"] B --> C["Test Locally"] C --> D["Security Audit"] D --> E["Document"] E --> F["Version Tag"] F --> G["Publish to ClawHub"] G --> H["User Feedback"] H --> I["Iterate & Improve"] I --> B style A fill:#e3f2fd,stroke:#1976d2,stroke-width:2px,color:#0d47a1 style B fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px,color:#4a148c style C fill:#e8f5e8,stroke:#388e3c,stroke-width:2px,color:#1b5e20 style D fill:#fff3e0,stroke:#f57c00,stroke-width:2px,color:#e65100 style E fill:#fce4ec,stroke:#c2185b,stroke-width:2px,color:#880e4f style F fill:#e1f5fe,stroke:#0288d1,stroke-width:2px,color:#01579b style G fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px,color:#4a148c style H fill:#e8f5e8,stroke:#388e3c,stroke-width:2px,color:#1b5e20 style I fill:#e0f2f1,stroke:#00695c,stroke-width:2px,color:#004d40

Conclusion

OpenClaw Skills represent a paradigm shift in software extension architecture, enabling sophisticated AI agent capabilities through declarative natural language instructions rather than traditional imperative code.

Key Architectural Benefits

  • Progressive Disclosure: Skills load only when relevant
  • Security First: Environment-based credential management
  • Tool Integration: Seamless external tool orchestration
  • Natural Language: Declarative instruction interpretation
  • Scalable Composition: Complex workflows from simple skills

Critical Success Factors

  • Clear Boundaries: Well-defined skill responsibilities
  • Robust Security: No hardcoded secrets, scoped permissions
  • Comprehensive Testing: Local sandbox validation
  • Graceful Error Handling: Failures without catastrophic effects
  • Community Standards: ClawHub publication best practices

The architecture's strength lies in its ability to bridge natural language interfaces with deterministic tool execution, enabling complex workflows while maintaining human-readable, maintainable instructions. This approach democratizes AI agent development, allowing non-programmers to create sophisticated capabilities through structured documentation.

Future Directions

As the ecosystem evolves, we anticipate enhanced security models with granular permissions, improved skill composition patterns, and expanded integration capabilities with emerging AI models and services.

The fundamental principle remains: instruct the model on what to do, not how to be an AI. This philosophy guides the development of skills that are both powerful and accessible, secure yet flexible.

Success in skill development requires balancing innovation with security, complexity with usability, and individual capability with ecosystem integration. By following established patterns and security practices, developers can create skills that extend AI agent capabilities while maintaining the trust and reliability essential for production deployment.