Building AI Skills
25 min4.8Intermediate
Create your own AI skills and plugins for OpenClaw
What are AI Skills?
AI Skills are building blocks of OpenClaw. They are reusable, modular units of functionality that can be combined to create powerful AI agents.
Skills can:
- Execute system commands
- Make HTTP requests
- Process and analyze data
- Integrate with external APIs
- Interact with databases
Skill Structure
A basic skill consists of:
```typescript
export const skill = {
name: 'my-skill',
description: 'A helpful skill',
execute: async (context) => {
// Your skill logic here
return { result: 'success' };
}
};
```
Creating Your First Skill
Let's create a simple skill that fetches weather information:
```typescript
export const weatherSkill = {
name: 'weather',
description: 'Get current weather for a location',
parameters: {
location: {
type: 'string',
description: 'The city name',
required: true
}
},
execute: async (context) => {
const { location } = context.parameters;
const response = await fetch(
`https://api.openweathermap.org/data/2.5/weather?q=${location}&appid=YOUR_API_KEY`
);
const data = await response.json();
return {
location: data.name,
temperature: data.main.temp,
description: data.weather[0].description
};
}
};
```
Registering Your Skill
To use your skill, register it in your OpenClaw configuration:
```json
{
"skills": {
"mySkills": {
"enabled": true,
"skills": [
"./skills/weather.ts"
]
}
}
}
```