Comprehensive tutorial series for OpenClaw AI agent gateway
Skills are in-context instruction modules that teach agents how to perform specific tasks.
A skill is a markdown file (SKILL.md) containing:
When an agent needs to perform a task, it loads the relevant skill into context and follows the instructions.
skills/
└── deployment/
└── SKILL.md
<!-- skills/deployment/SKILL.md -->
# Deployment Skill
## Overview
This skill covers deploying applications to staging and production.
## Prerequisites
- Docker installed
- Access to container registry
- Kubernetes credentials configured
## Deploy to Staging
1. Build the Docker image:
```bash
docker build -t app:$(git rev-parse --short HEAD) .
docker push registry.example.com/app:$(git rev-parse --short HEAD)
kubectl set image deployment/app app=registry.example.com/app:$(git rev-parse --short HEAD) -n staging
kubectl rollout status deployment/app -n staging
Requires approval before proceeding.
[Similar steps with production namespace]
If issues arise:
kubectl rollout undo deployment/app -n <namespace>
### Skill with Supporting Files
skills/ └── data-migration/ ├── SKILL.md # Main instructions ├── templates/ │ ├── migration.sql # SQL template │ └── verify.sql # Verification queries └── examples/ └── user-migration.md # Example walkthrough
## How Skills Are Loaded
### Automatic Loading
Skills in the workspace `skills/` directory are available automatically:
~/.openclaw/workspace/ └── skills/ ├── deployment/SKILL.md # Available as “deployment” ├── review/SKILL.md # Available as “review” └── testing/SKILL.md # Available as “testing”
### Manual Loading
Agent can explicitly load a skill:
```markdown
## Agent Instructions
When asked to deploy:
1. Load the deployment skill: Read skills/deployment/SKILL.md
2. Follow the instructions there
Some skills are loaded only when relevant keywords are detected:
// In agent configuration
{
skills: {
deployment: {
path: "skills/deployment/SKILL.md",
keywords: ["deploy", "release", "ship"],
},
},
}
# Skill Name
## Overview
[1-2 sentences on what this skill does]
## When to Use
[Trigger conditions]
## Prerequisites
[What must be true before starting]
## Steps
[Numbered, actionable steps]
## Examples
[Concrete examples]
## Troubleshooting
[Common issues and fixes]
Bad:
## Deployment
Deploy the application to the server.
Good:
## Deploy to Staging
1. Verify tests pass:
```bash
npm test
npm run build
./deploy.sh staging
curl https://staging.example.com/health
Expected: {"status": "ok"}
```
## Troubleshooting
### "Connection refused" error
The deploy server may be down. Check:
```bash
ssh deploy-server "systemctl status deploy-service"
Increase Node memory:
NODE_OPTIONS="--max-old-space-size=4096" npm run build
### Provide Context
```markdown
## Background
This deployment system uses blue-green deployment:
- "Blue" is the current production
- "Green" is the new version
- Traffic switches atomically after verification
Understanding this helps when troubleshooting rollbacks.
skills/
├── deployment/ # Infrastructure
├── database/ # Database operations
├── testing/ # Test workflows
├── security/ # Security procedures
└── support/ # Customer support
skills/
├── quickstart/ # Simple, common tasks
│ ├── deploy-staging.md
│ └── run-tests.md
├── standard/ # Normal workflows
│ ├── release/SKILL.md
│ └── review/SKILL.md
└── advanced/ # Complex procedures
├── migration/SKILL.md
└── disaster-recovery/SKILL.md
workspace-coder/
└── skills/
├── coding-standards/SKILL.md
└── testing/SKILL.md
workspace-reviewer/
└── skills/
└── code-review/SKILL.md
workspace-deployer/
└── skills/
└── deployment/SKILL.md
For skills used by multiple agents, use a shared location:
~/.openclaw/shared-skills/
├── git-workflow/SKILL.md
├── documentation/SKILL.md
└── communication/SKILL.md
Reference from agent workspaces:
{
agents: {
coder: {
workspace: "~/.openclaw/workspace-coder",
skills: {
extraPaths: ["~/.openclaw/shared-skills"],
},
},
},
}
Skills can be shared and reused:
# Clone a skill library
git clone https://github.com/example/openclaw-skills ~/.openclaw/community-skills
# Reference in config
{
skills: {
extraPaths: ["~/.openclaw/community-skills"],
},
}
Skills often wrap CLI tools:
# Coach Skill
## Check Priorities
```bash
python3 skills/coach/coach_db.py report priorities --limit 5
python3 skills/coach/coach_db.py task complete <task_id>
python3 skills/coach/coach_db.py task create --title "..." --priority 1
### Script References
Skills can reference helper scripts:
skills/ └── release/ ├── SKILL.md ├── bump-version.sh ├── generate-changelog.py └── tag-release.sh
```markdown
<!-- SKILL.md -->
# Release Skill
## Steps
1. Bump version:
```bash
./skills/release/bump-version.sh minor
python3 skills/release/generate-changelog.py
./skills/release/tag-release.sh
```
Use placeholders for reusable patterns:
# Deploy {SERVICE_NAME}
## Prerequisites
- {SERVICE_NAME} repository cloned
- Docker installed
## Steps
1. Navigate to service:
```bash
cd ~/repos/{SERVICE_NAME}
docker build -t {SERVICE_NAME}:latest .
```
# Environment Setup
## Detect Environment
First, check your environment:
```bash
uname -s
brew install dependencies
apt-get install dependencies
Use WSL and follow Linux instructions.
## Skill Testing
### Manual Testing
```bash
# Ask agent to use skill
openclaw agent main --task "Deploy to staging using the deployment skill"
# Verify it followed instructions
Create a test checklist:
<!-- skills/deployment/TEST.md -->
# Deployment Skill Tests
## Test: Deploy to staging
- [ ] Agent reads SKILL.md
- [ ] Agent runs tests first
- [ ] Agent builds correctly
- [ ] Agent deploys to staging
- [ ] Agent verifies deployment
## Test: Rollback
- [ ] Agent identifies rollback need
- [ ] Agent executes rollback command
- [ ] Agent verifies rollback
One skill, one purpose:
Bad:
skills/everything/SKILL.md # 2000 lines covering all operations
Good:
skills/deploy/SKILL.md # Just deployment
skills/test/SKILL.md # Just testing
skills/release/SKILL.md # Just releases
<!-- SKILL.md -->
# Deployment Skill
**Version:** 2.1.0
**Last Updated:** 2024-01-15
**Maintainer:** DevOps team
## Changelog
- 2.1.0: Added blue-green deployment
- 2.0.0: Migrated to Kubernetes
- 1.0.0: Initial Docker deployment
## When to Deviate
These instructions cover the common case. Deviate when:
- Emergency hotfix needed (skip staging)
- Infrastructure changes required (coordinate with DevOps)
- Breaking changes (follow migration guide instead)
When deviating, document why in the deployment notes.
## Additional Resources
- [Kubernetes documentation](https://kubernetes.io/docs/)
- [Company deployment wiki](https://wiki.example.com/deployment)
- [On-call runbook](https://runbook.example.com)
Skills handle instructions. For external tool integration, see Plugin Basics →