Back to all posts
BunOpenClawSkillsTypeScript

Building a Bun Runtime Skill for OpenClaw

Building a Bun Runtime Skill for OpenClaw
7 min read

How I created a reusable OpenClaw skill using Bun's native APIs for filesystem, process, and network operations.

I recently built a custom skill for OpenClaw that leverages Bun's native runtime capabilities. Here's what I learned about creating reusable AI agent skills.

What is OpenClaw?

OpenClaw is an AI agent framework that supports "skills" — modular packages of knowledge and tools. Think of them like plugins that make AI agents smarter at specific tasks.

The Problem

I wanted to use Bun's native APIs (Bun.file(), Bun.write(), etc.) in OpenClaw, but there wasn't an existing skill for it. So I built one.

Skill Structure

OpenClaw skills use a simple structure:

bun-runtime/
├── SKILL.md          # Metadata + instructions
├── scripts/          # Executable scripts
│   ├── bun-fs.sh     # File operations
│   ├── bun-glob.sh   # Pattern matching
│   ├── bun-process.sh # Process execution
│   └── bun-fetch.sh  # HTTP requests
└── package.json

Key Learnings

1. Keep SKILL.md Concise

The skill metadata is what triggers the skill. Make it clear:

---
name: bun-runtime
description: Bun runtime capabilities for filesystem, process, and network operations...
---

2. Shell Scripts > TypeScript

For OpenClaw skills, shell scripts are better than TypeScript:

  • ✅ No compilation needed
  • ✅ Works anywhere Bun is installed
  • ✅ Easy to test and debug

3. JSON Output Matters

Always return structured JSON for easy parsing.

Testing the Skill

I tested each script before packaging:

# Write file
./scripts/bun-fs.sh write /tmp/test.txt "Hello Bun!"
 
# Read file
./scripts/bun-fs.sh read /tmp/test.txt
 
# Glob pattern
./scripts/bun-glob.sh "/tmp/*.txt"

All working? Package it.

Publishing to ClawdHub

Packaging creates a .skill file (just a zip). You can:

  1. Publish via CLI: clawdhub publish ./bun-runtime
  2. Upload to web: Drag the folder to clawdhub.com

I went with web upload — simpler for one-off publishing.

What's Next?

The skill now supports:

  • ✅ File read/write operations
  • ✅ Glob pattern matching
  • ✅ Process execution
  • ✅ HTTP requests with Bun's fetch

Others can now install it and use Bun's APIs in their own OpenClaw workflows.

Final Thoughts

Building OpenClaw skills taught me that:

  • Simple shell scripts beat complex code
  • Clear metadata matters more than clever implementation
  • Testing before packaging saves headaches

If you're using OpenClaw + Bun, check out the bun-runtime skill.


Built with Bun · Published to ClawdHub · Open source