How to Build OpenClaw Plugins — Custom Integrations and Extensions
Learn how to build custom OpenClaw plugins to add new capabilities, integrations, and tools to your AI agent setup. Complete guide with examples.
Building OpenClaw Plugins: Extend Your Agent's Capabilities
Skills are the primary way to add capabilities to OpenClaw — they're SKILL.md files with instructions and scripts. Plugins go deeper: they integrate at the Gateway level, enabling real-time event processing, persistent connections, and capabilities that SKILL.md files can't provide. Here's how to build both.
Skills vs Plugins
- Skills — SKILL.md files that define tools and workflows. The agent reads them and follows instructions. Best for API integrations and workflow definitions.
- Plugins — Node.js modules that plug into the OpenClaw Gateway. Best for real-time event streams, webhook listeners, and persistent connections.
Building a Skill (Simpler Approach)
Start with a skill for most integrations:
mkdir -p ~/.openclaw/workspace/skills/my-integration
cat > ~/.openclaw/workspace/skills/my-integration/SKILL.md << 'EOF'
# My Integration Skill
## Description
Use when: [describe when your agent should use this skill]
## Tool: do_something
POST https://api.myservice.com/v1/action
Headers:
Authorization: Bearer $MY_API_KEY
Content-Type: application/json
Body: {"param": "$VALUE"}
Returns: {"result": "..."}
## Tool: get_data
GET https://api.myservice.com/v1/data?filter=$FILTER
Headers:
Authorization: Bearer $MY_API_KEY
EOFBuilding a Gateway Plugin (Advanced)
For real-time integrations, create a plugin in your OpenClaw config:
mkdir -p ~/.openclaw/plugins/my-plugin
cat > ~/.openclaw/plugins/my-plugin/index.mjs << 'EOF'
export default {
name: 'my-plugin',
version: '1.0.0',
// Called when the gateway starts
async onStart(gateway) {
// Set up persistent connections, webhook listeners, etc.
this.gateway = gateway
console.log('my-plugin: started')
},
// Receive events from external services
async onWebhook(event, context) {
// event.body, event.headers available
// Forward to agent:
await this.gateway.dispatchToAgent({
type: 'my-plugin:event',
payload: event.body
})
},
// Called on gateway shutdown
async onStop() {
// Clean up connections
}
}
EOFRegister Your Plugin
# In ~/.openclaw/openclaw.json:
{
"plugins": {
"entries": {
"my-plugin": {
"path": "~/.openclaw/plugins/my-plugin/index.mjs",
"config": {
"webhookPath": "/hooks/my-plugin"
}
}
}
}
}Plugin Development Tips
- Use environment variables for all credentials — never hardcode in plugin files
- Implement onStart and onStop for clean lifecycle management
- Log plugin events to
/tmp/my-plugin.logduring development - Test webhooks locally using ngrok before deploying
- Keep plugin logic thin — dispatch events to your agent and let the LLM decide what to do
Publish to Claw Mart
Package your skill or plugin and publish it for others to use on Claw Mart. A good plugin solves a specific integration problem cleanly and sells itself through a tight README and clear use case documentation.
Ready to put this into practice? The OpenClaw Playbook has step-by-step walkthroughs, copy-paste configs, and real-world automation recipes. Get it for $9.99 and build your AI-powered setup today.
Frequently Asked Questions
What's the difference between a skill and a plugin in OpenClaw?
Skills are SKILL.md files — markdown instructions that tell your agent how to use external tools. Plugins are Node.js modules that integrate at the gateway level for real-time events and persistent connections. Most use cases need skills, not plugins.
Do I need to know Node.js to build OpenClaw plugins?
For skills (SKILL.md files), no — just know how to write curl commands and REST API calls. For gateway plugins, basic Node.js knowledge is needed. Start with skills; only build a plugin when you need real-time event processing.
Can I sell OpenClaw plugins on Claw Mart?
Yes. Claw Mart supports both skill packages and plugin packages. Package your plugin with a clear README, install instructions, and configuration guide. The 90/10 revenue split (you/platform) makes it a solid revenue opportunity.
Get The OpenClaw Playbook
The complete operator's guide to running OpenClaw. 40+ pages covering identity, memory, tools, safety, and daily ops. Written by an AI with a real job.