Cubitrek

How to Build Custom OpenClaw Skills: Developer Tutorial

Step-by-step tutorial for building custom OpenClaw skills. Covers SKILL.md structure, script development, tool definitions, testing, and publishing to ClawHub. Code examples included.

Faizan Ali Khan
Faizan Ali Khan
Co-founder & CEO
5 min read
How to Build Custom OpenClaw Skills: Developer Tutorial
Share

An OpenClaw skill is a modular, self-contained package that gives your AI agent a specific capability. Building a custom skill is simpler than most developers expect: at minimum, it requires a single SKILL.md file in a specific directory. This tutorial walks through the complete process of creating, testing, and deploying custom OpenClaw skills, from a basic configuration to a production-ready skill with API integrations and error handling.

Understanding Skill Architecture

Every OpenClaw skill is a directory containing up to three components. First, the SKILL.md file, which is required and serves as the configuration and instruction file that tells OpenClaw what the skill does and when to invoke it. Second, the scripts folder, which is optional and contains the executable code (Python, Bash, Node.js, or any language) that the skill runs. Third, the references folder, also optional, which contains supplementary documentation the agent can reference for context. Skills live in the ~/.openclaw/workspace/skills/ directory. When OpenClaw starts, it reads all SKILL.md files and registers the available skills. When a user request matches a skill's trigger conditions, OpenClaw loads the skill's full instructions and uses them to guide the agent's behavior.

Step 1: Create the Skill Directory

Create a new directory for your skill inside the OpenClaw skills folder. The directory name should be descriptive and use kebab-case. For this tutorial, we will build a skill called lead-enricher that researches a company or person and returns enrichment data. Inside your skill directory, create the SKILL.md file. This file uses YAML frontmatter followed by Markdown instructions. The frontmatter contains the metadata that OpenClaw uses for skill discovery and registration.

Step 2: Write the SKILL.md Frontmatter The frontmatter requires these core fields: name (the skill's identifier), version (semantic version string), description (what the skill does, written as a trigger phrase rather than marketing copy), and tools (the list of tool definitions the skill provides). Optional but recommended fields include triggers (specific words or phrases that activate the skill) and dependencies (other skills or packages required). The description field is critical. OpenClaw uses the name plus description to decide whether a skill is relevant to the current request. Write it as a clear, specific statement of capability: Researches a company or person using web search and LinkedIn to return enrichment data including company size, industry, funding, key contacts, and recent news. This tells the LLM exactly when to invoke the skill.

Step 3: Write the Skill Instructions

Below the frontmatter, write the Markdown instructions that guide the agent's behavior when the skill is activated. These instructions are essentially a prompt that tells the agent what to do, how to do it, and what output format to produce. Be specific and structured: define the exact steps the agent should follow, the data sources it should consult, the output format (JSON, Markdown table, plain text), and error handling behavior. For our lead-enricher skill, the instructions would specify: accept a company name or person name as input, use the browser tool to visit the company website and LinkedIn, extract specific data points (company size, industry, founded date, key executives, recent funding, latest news), format the results as a structured Markdown report, and include a confidence score for each data point based on source reliability.

Step 4: Add Scripts (Optional)

For skills that need to execute code, such as calling external APIs, processing data, or performing calculations, add scripts to the scripts/ folder. Scripts can be written in any language that runs on your system: Python, Bash, Node.js, Go, or anything else. The SKILL.md instructions reference these scripts as tools the agent can call. For API-based skills, a Python script is the most common choice. Your script should: accept input parameters (typically as command-line arguments or stdin), call the external API with proper authentication, parse the response, format the output, handle errors gracefully with meaningful error messages, and return results to stdout for the agent to consume.

Step 5: Test Your Skill

Testing is the most important step that developers often skip. Test your skill in three phases. First, unit test the scripts independently: run your Python or Node.js scripts directly with sample inputs and verify the output. Second, integration test with OpenClaw: ask the agent to perform a task that should trigger your skill, and verify it activates correctly and produces the expected

output. Third, edge case testing: test with invalid inputs, missing data, API timeouts, and other failure modes. Verify that the agent handles errors gracefully rather than crashing or producing misleading output.

Step 6: Secure Your Skill

If your skill accesses external APIs, handles credentials, or processes sensitive data, implement these security practices: never hardcode API keys in your scripts (use environment variables or a secret manager), validate all inputs before processing, sanitize outputs to prevent prompt injection attacks, implement rate limiting to prevent API abuse, log all actions for audit purposes, and restrict network access to only the endpoints your skill needs.

Step 7: Publish to ClawHub (Optional)

If your skill solves a common problem that other teams face, consider publishing it to ClawHub. The publishing process involves: creating a ClawHub account, running clawhub publish from your skill directory, passing the automated security scan (SHA-256 hash and VirusTotal check), and writing clear documentation with usage examples. Published skills gain visibility across the entire OpenClaw community and contribute to the ecosystem that makes the platform valuable.

When to Build vs. When to Hire Building a basic skill with a SKILL.md file and simple scripts is straightforward for any developer with a few hours to spare. However, production-grade skills that need to handle high volumes, integrate with complex APIs, implement robust error handling, pass security audits, and maintain reliability over time require more investment. At Cubitrek, our skill development service handles the entire lifecycle: requirements gathering, architecture design, development, testing (including adversarial edge cases), security audit, deployment, and documentation. We build skills that run reliably in production, not weekend prototypes.

Keep exploring

Key takeaways

  • Understanding Skill Architecture
  • Frequently Asked Questions
  • Can a skill use multiple scripts?
  • How do I debug a skill that is not triggering?
Tagsbuild custom OpenClaw skillsopenclaw
Faizan Ali Khan
Written by

Faizan Ali Khan

Co-founder & CEO

Founder, innovator, and AI solution provider. Fifteen-plus years building technology products and growth systems for SaaS, e-commerce, and real estate companies. Today he leads Cubitrek's AI solutions practice: agentic workflows that integrate with CRMs, support inboxes, ad platforms, e-commerce stacks, and messaging channels to automate sales, service, and marketing operations end to end, plus AI-first SEO (AEO and GEO) for growth-stage and mid-market companies across the US and Europe. One of the first practitioners in Pakistan to ship AI-native marketing systems in production, years before the category went mainstream.

Questions people ask about this

Sourced from client conversations, Search Console, and AI-search citation monitoring.

  • Yes. A skill can define multiple tools, each backed by a different script. This is useful for skills that provide several related capabilities, like a CRM skill that offers separate tools for searching contacts, creating records, and updating fields.
Keep reading

Related articles.

More on the same thread, picked by tag and category, not chronology.

Newsletter

The AI-first growth memo.

One email every other Tuesday. What's moving across AI search, paid, and agentic AI, with the playbooks attached.

No spam. Unsubscribe in one click.

Ready when you are

Want Cubitrek to run OpenClaw Services for you?

We install openclaw services programs for growing companies across the US and Europe. Book a call and we'll come back with a one-page plan in 72 hours.

Book a strategy call