alphaclaw.md
📄 build-a-skill.md
1# Build Your First Skill
2
3> Extend OpenClaw with a custom skill in 25 minutes.
4
5## What is a Skill?
6
7A skill is a packaged capability for your OpenClaw agent.
8It includes a description, trigger keywords, scripts, and
9reference material.
10
11## Step 1: Create the Directory
12
13```bash
14mkdir -p ~/.openclaw/workspace/skills/my-skill
15```
16
17## Step 2: Write SKILL.md
18
19```markdown
20# My Weather Alerts Skill
21
22> Send weather alerts for saved locations.
23
24## Description
25
26Monitors weather conditions and sends proactive alerts
27when severe weather is expected in your saved locations.
28
29## Triggers
30
31weather alert, storm warning, severe weather
32
33## Scripts
34
35- \`scripts/check-weather.js\` — Polls weather API
36- \`scripts/send-alert.js\` — Formats and sends alert
37
38## Configuration
39
40Required environment variables:
41- WEATHER_API_KEY — OpenWeatherMap API key
42- ALERT_LOCATIONS — Comma-separated city names
43```
44
45## Step 3: Add Scripts
46
47```javascript
48// scripts/check-weather.js
49const locations = process.env.ALERT_LOCATIONS?.split(',') || [];
50
51for (const city of locations) {
52 const res = await fetch(
53 \`https://api.openweathermap.org/...?q=\${city}\`
54 );
55 const data = await res.json();
56
57 if (data.alerts?.length > 0) {
58 console.log(JSON.stringify({
59 city,
60 alerts: data.alerts
61 }));
62 }
63}
64```
65
66## Step 4: Test
67
68Your agent will automatically detect the new skill
69on the next session. Try:
70
71```
72"Check for weather alerts"
73"Are there any storm warnings?"
74```
75
76## Step 5: Share
77
78Package it up and submit to [ClewHub](https://clawhub.com).
79
80## Tags
81
82`tutorial` `skills` `development` `beginner`
83
🐾 alphaclaw.mdUTF-8Markdown