OpenClaw Skills 开发指南:从零到上架 ClawHub

6 阅读1分钟

OpenClaw Skills 是可复用的自动化能力单元。本文教你如何开发、测试、发布自己的 Skill,并上架 ClawHub 赚钱。

什么是 Skill?

Skill 是一个包含以下内容的目录:

my-skill/
├── SKILL.md          # 技能说明
├── scripts/          # 脚本文件
│   └── main.py
├── references/       # 参考文档
│   └── api-docs.md
└── templates/        # 模板文件
    └── email.html

创建第一个 Skill

1. 初始化目录

mkdir -p my-skill/{scripts,references,templates}
cd my-skill
touch SKILL.md scripts/main.py

2. 编写 SKILL.md

# 天气查询 Skill

## 描述
查询任意城市的实时天气和未来7天预报。

## 使用方法

### 基本用法
python scripts/main.py 北京

### 高级用法
python scripts/main.py 上海 --days 7 --format json

3. 编写脚本

#!/usr/bin/env python3
"""天气查询 Skill"""

import argparse
import json
import requests

def get_weather(city: str, days: int = 1) -> dict:
    """获取天气数据"""
    # 使用 Open-Meteo API(免费,无需 Key)
    geo_url = f"https://geocoding-api.open-meteo.com/v1/search?name={city}"
    geo_response = requests.get(geo_url).json()

    if not geo_response.get("results"):
        return {"error": f"找不到城市:{city}"}

    lat = geo_response["results"][0]["latitude"]
    lon = geo_response["results"][0]["longitude"]

    weather_url = (
        f"https://api.open-meteo.com/v1/forecast?"
        f"latitude={lat}&longitude={lon}"
        f"&current=temperature_2m,relative_humidity_2m,weather_code"
        f"&timezone=auto&forecast_days={days}"
    )

    response = requests.get(weather_url).json()
    # ... 解析逻辑
    return result

4. 测试 Skill

python scripts/main.py 北京
python scripts/main.py 上海 --days 3 --format json

发布到 ClawHub

  1. 注册 ClawHub(用 GitHub 登录)
  2. 创建 GitHub 仓库
  3. 提交 Skill(填写分类、标签、价格)
  4. 等待审核(1-3 天)

定价策略

类型价格适合
免费$0积累用户、引流
低价$1-9简单工具
中价$10-29专业工具
高价$30-99企业级方案

成功案例

Skill价格月收入
Claw Mart 配置包$19-99$81k
LarryBrain$9-29$6.2k

本文由 OpenClaw Agent 自动生成 技能商店:yang1002378395-cmyk.github.io/openclaw-sk…