clawskills-strands
v0.1.0
Published
Convert OpenClaw skills (markdown documentation) to executable Strands Agents tools
Maintainers
Readme
clawskills-strands
Convert OpenClaw skills (markdown documentation) to executable Strands Agents tools.
Overview
OpenClaw skills are markdown files that document CLI commands and workflows. In OpenClaw, agents read these files and execute commands manually. This package converts those skills into directly executable Strands Agents tools, making them immediately usable without the read-then-exec pattern.
Installation
npm install clawskills-strandsPeer Dependencies:
@strands-agents/sdk- Required for tool creationzod- Required for schema validation
Quick Start
import { Agent } from '@strands-agents/sdk'
import { BedrockModel } from '@strands-agents/sdk'
import { loadSkills, convertSkillsToTools } from 'clawskills-strands'
// Load all 52 bundled OpenClaw skills (included with package)
const skills = await loadSkills({
useBundled: true
})
// Convert to Strands tools
const tools = await convertSkillsToTools(skills)
// Use with Strands Agent
const agent = new Agent({
model: new BedrockModel({ region: 'us-east-1' }),
tools: tools
})
// Agent can now use skills directly as tools!
await agent.invoke('Get the weather for London')Features
- ✅ 52 Bundled Skills: All OpenClaw skills included and ready to use
- ✅ Skill Loader: Load skills from bundled package or external directories
- ✅ Skill Parser: Parse SKILL.md files with frontmatter and JSON5 metadata
- ✅ Tool Converter: Automatically convert skills to executable Strands tools
- ✅ Type-Safe: Full TypeScript support with proper types
- ✅ Standalone: No OpenClaw dependency required
- ✅ Extensible: Easy to add custom skill directories
API Reference
loadSkills(options?)
Load skills from various sources.
const skills = await loadSkills({
useBundled: true, // Include bundled skills (default: true)
skillsDir: './my-skills', // Primary directory to load from
extraDirs: [ // Additional directories
'./custom-skills',
process.env.OPENCLAW_SKILLS_DIR
]
})Returns: Promise<Skill[]> - Array of loaded skills
loadBundledSkills()
Load only the skills bundled with the package.
const bundledSkills = await loadBundledSkills()loadSkillByName(name, options?)
Load a specific skill by name.
const weatherSkill = await loadSkillByName('weather', {
useBundled: true
})convertSkillToTool(skill, options?)
Convert a single skill to a Strands tool.
const tool = await convertSkillToTool(skill, {
useBash: true, // Use bash for command execution (default: true)
executor: customExecutor // Optional custom executor function
})Returns: Promise<Tool> - A Strands-compatible tool
convertSkillsToTools(skills, options?)
Convert multiple skills to Strands tools.
const tools = await convertSkillsToTools(skills)How It Works
Skill Format
Skills are markdown files with YAML frontmatter:
---
name: weather
description: Get current weather and forecasts
metadata: { "openclaw": { "emoji": "🌤️", "requires": { "bins": ["curl"] } } }
---
# Weather
```bash
curl -s "wttr.in/London?format=3"
### Conversion Process
1. **Parse**: Extract frontmatter and content from SKILL.md
2. **Analyze**: Extract CLI command patterns from code blocks
3. **Infer Schema**: Automatically infer Zod input schema from commands
4. **Create Tool**: Generate Strands tool with executable callback
### Example Output
```json
{
"skillsLoaded": 3,
"toolsCreated": 3,
"tools": [
{
"name": "weather",
"description": "Get current weather and forecasts (no API key required).",
"hasSchema": true
}
]
}Examples
Basic Usage
import { loadSkills, convertSkillsToTools } from 'clawskills-strands'
import { Agent, BedrockModel } from '@strands-agents/sdk'
const skills = await loadSkills({ useBundled: true })
const tools = await convertSkillsToTools(skills)
const agent = new Agent({
model: new BedrockModel({ region: 'us-east-1' }),
tools: tools
})Custom Skills Directory
const skills = await loadSkills({
useBundled: true,
skillsDir: './my-custom-skills',
extraDirs: ['./workspace-skills']
})Single Skill
import { loadSkillByName, convertSkillToTool } from 'clawskills-strands'
const skill = await loadSkillByName('github')
const githubTool = await convertSkillToTool(skill)See examples/ directory for complete examples with outputs.
Skill Conversion Details
Supported Skill Patterns
The converter intelligently handles different skill types:
- CLI Tools (e.g.,
gh,memo,curl): Extracts command patterns - API Tools (e.g., Notion, GitHub API): Infers parameters from examples
- Simple Commands: Creates generic command parameter
- Complex Workflows: Extracts multiple command patterns
Schema Inference
The converter analyzes skill content to infer input schemas:
- GitHub skills: Infers
repo,prNumber,issueNumber,limit - Weather skills: Infers
location,format - Notes skills: Infers
action,title,query,folder - Generic: Falls back to
command+argsparameters
Command Building
Commands are built from:
- Skill-specific patterns (e.g., GitHub, Weather)
- Extracted command templates from markdown
- Parameter substitution from user input
Project Structure
clawskills-strands/
├── src/
│ ├── types.ts # Type definitions
│ ├── parser.ts # Skill file parser
│ ├── loader.ts # Skill loader
│ ├── converter.ts # Skill to tool converter
│ └── index.ts # Main exports
├── skills/ # Bundled skills (copied from OpenClaw)
├── examples/ # Usage examples
│ ├── src/ # Example source files
│ └── outputs/ # Example run outputs
├── dist/ # Compiled output
└── package.jsonDevelopment
# Install dependencies
npm install
# Build
npm run build
# Test
npm test
# Run examples
npx tsx examples/run-example.tsPublishing
# Build and test
npm run prepublishOnly
# Publish
npm publishLicense
MIT
Contributing
Contributions welcome! This package converts OpenClaw skills to Strands tools, making them directly usable in Strands Agents.
