Back to OpenClaw

Designing Production-Grade OpenClaw Skills: Schemas, Tool Calling, and Dynamic Dispatch

A deep engineering walkthrough on creating modular, reusable skills for OpenClaw agents with strict JSON schemas, fallback execution paths, and error telemetry.

Designing Production-Grade OpenClaw Skills: Schemas, Tool Calling, and Dynamic Dispatch
Image credit: labs.zeroshot.studio

Contents

What is an OpenClaw skill?

In OpenClaw, a skill is a self-contained directory containing instructions, configuration schemas, and executable scripts. Instead of writing monolithic prompts that describe every possible task, skills allow agents to discover, load, and execute specialized capabilities on demand.

Flowchart
6 linescompact
flowchart TD
    A[User Request] --> B[OpenClaw Router Agent]
    B -->|Matches Capability| C[Load skill: domain-seo-audit]
    C --> D[Read SKILL.md Frontmatter & Rules]
    D --> E[Execute Scoped Python Script / Tool]
    E --> F[Return Formatted Output to Context]
Rendered from Mermaid source with the native ZeroLabs diagram container.

How do you structure the SKILL.md specification?

Every skill must reside in its own subdirectory under skills// with a root SKILL.md file:

markdown
---name: domain-seo-auditdescription: Scans a target URL for Core Web Vitals, OpenGraph tags, and indexability issues.version: 1.0.0parameters:  type: object  properties:    url:      type: string      format: uri      description: The full target URL to audit (including https://).    check_mobile:      type: boolean      default: true      description: Whether to emulate mobile viewport checks.  required:    - url---# Domain SEO Audit Skill## OverviewUse this skill when the user asks for a website performance audit or SEO tag verification.## Execution Rules1. Validate that the URL is reachable before initiating heavy scanning.2. Never scrape more than 5 sub-pages per execution.3. Return results formatted in GitHub markdown tables.

How do you implement reliable Python tool scripts?

Skills that execute shell operations or API calls should delegate execution to deterministic Python scripts located in skills//scripts/:

python
#!/usr/bin/env python3# skills/domain-seo-audit/scripts/audit.pyimport sysimport jsonimport httpxfrom bs4 import BeautifulSoupdef run_audit(target_url: str) -> dict:    try:        response = httpx.get(target_url, timeout=10.0, follow_redirects=True)        soup = BeautifulSoup(response.text, 'html.parser')                title = soup.title.string.strip() if soup.title else 'Missing'        og_image = soup.find('meta', property='og:image')        og_image_content = og_image['content'] if og_image else 'Missing'        h1_tags = len(soup.find_all('h1'))        return {            'status': 'success',            'status_code': response.status_code,            'title': title,            'og_image': og_image_content,            'h1_count': h1_tags        }    except Exception as e:        return {            'status': 'error',            'message': str(e)        }if __name__ == '__main__':    if len(sys.argv) /` or in the central OpenClaw configuration directory `~/.openclaw/skills/`.### Can a skill invoke other skills?Yes. Supervisor agents can compose multiple skills sequentially, passing the output of a research skill into a content drafting or validation skill.### How do I test a new skill before deploying it live?Run the skill's Python script directly from the terminal with sample arguments, then invoke the skill through the CLI agent in a sandbox branch to verify proper schema parsing.
Share