Files
edict/docs/remote-skills-quickstart.md
cft0808 709e163932 feat: 添加远程 Skills 资源管理功能
新增远程 skill 管理系统,支持从 GitHub/HTTPS URL 获取:
- API 端点: add-remote-skill, remote-skills-list, update-remote-skill, remove-remote-skill
- CLI 工具: scripts/skill_manager.py (add-remote, list-remote, update-remote, remove-remote, import-official-hub)
- 文档: remote-skills-guide.md 和 remote-skills-quickstart.md
- 功能: 安全验证、YAML 校验、版本管理、多渠道操作
2026-03-02 06:21:28 +08:00

7.3 KiB
Raw Permalink Blame History

远程 Skills 快速入门

5 分钟体验

1. 启动服务器

# 确保你在项目根目录
python3 dashboard/server.py
# 输出: 三省六部看板启动 → http://127.0.0.1:7891

2. 添加官方 SkillCLI

# 为中书省添加代码审查 skill
python3 scripts/skill_manager.py add-remote \
  --agent zhongshu \
  --name code_review \
  --source https://raw.githubusercontent.com/openclaw-ai/skills-hub/main/code_review/SKILL.md \
  --description "代码审查能力"

# 输出:
# ⏳ 正在从 https://raw.githubusercontent.com/... 下载...
# ✅ 技能 code_review 已添加到 zhongshu
#    路径: /Users/xxx/.openclaw/workspace-zhongshu/skills/code_review/SKILL.md
#    大小: 2048 字节

3. 列出所有远程 Skills

python3 scripts/skill_manager.py list-remote

# 输出:
# 📋 共 1 个远程 skills
# 
# Agent       | Skill 名称           | 描述                           | 添加时间
# ------------|----------------------|--------------------------------|----------
# zhongshu    | code_review          | 代码审查能力                   | 2026-03-02

4. 查看 API 响应

curl http://localhost:7891/api/remote-skills-list | jq .

# 输出:
# {
#   "ok": true,
#   "remoteSkills": [
#     {
#       "skillName": "code_review",
#       "agentId": "zhongshu",
#       "sourceUrl": "https://raw.githubusercontent.com/...",
#       "description": "代码审查能力",
#       "localPath": "/Users/xxx/.openclaw/workspace-zhongshu/skills/code_review/SKILL.md",
#       "addedAt": "2026-03-02T14:30:00Z",
#       "lastUpdated": "2026-03-02T14:30:00Z",
#       "status": "valid"
#     }
#   ],
#   "count": 1,
#   "listedAt": "2026-03-02T14:35:00Z"
# }

常见操作

一键导入官方库中的所有 skills

python3 scripts/skill_manager.py import-official-hub \
  --agents zhongshu,menxia,shangshu,bingbu,xingbu

这会自动为每个 agent 添加:

  • zhongshu: code_review, api_design, doc_generation
  • menxia: code_review, api_design, security_audit, data_analysis, doc_generation, test_framework
  • shangshu: 同 menxia协调者
  • bingbu: code_review, api_design, test_framework
  • xingbu: code_review, security_audit, test_framework

更新某个 Skill 到最新版本

python3 scripts/skill_manager.py update-remote \
  --agent zhongshu \
  --name code_review

# 输出:
# ⏳ 正在从 https://raw.githubusercontent.com/... 下载...
# ✅ 技能 code_review 已添加到 zhongshu
# ✅ 技能已更新
#    路径: /Users/xxx/.openclaw/workspace-zhongshu/skills/code_review/SKILL.md
#    大小: 2156 字节

移除某个 Skill

python3 scripts/skill_manager.py remove-remote \
  --agent zhongshu \
  --name code_review

# 输出:
# ✅ 技能 code_review 已从 zhongshu 移除

看板 UI 操作

在看板中添加 Remote Skill

  1. 打开 http://localhost:7891
  2. 进入 🔧 技能配置 面板
  3. 点击 添加远程 Skill 按钮
  4. 填写表单:
    • Agent: 从下拉列表选择(如 zhongshu
    • Skill 名称: 输入内部 ID 如 code_review
    • 远程 URL: 粘贴 GitHub URL 如 https://raw.githubusercontent.com/openclaw-ai/skills-hub/main/code_review/SKILL.md
    • 中文描述: 可选,如 代码审查能力
  5. 点击 导入 按钮
  6. 等待 1-2 秒,看到 成功提示

管理已添加的 Skills

在看板 → 🔧 技能配置 → 远程 Skills 标签页:

  • 查看: 点击 Skill 名称查看 SKILL.md 内容
  • 更新: 点击 🔄 重新从源 URL 下载最新版本
  • 删除: 点击 ✕ 移除本地副本
  • 复制 URL: 快速分享给他人

创建自己的 Skill 库

目录结构

my-skills-hub/
├── code_review/
│   └── SKILL.md          # 代码审查能力
├── api_design/
│   └── SKILL.md          # API 设计审查
├── data_analysis/
│   └── SKILL.md          # 数据分析
└── README.md

SKILL.md 模板

---
name: my_custom_skill
description: 简短描述
version: 1.0.0
tags: [tag1, tag2]
---

# Skill 完整名称

详细描述...

## 输入

说明接收什么参数

## 处理流程

具体步骤...

## 输出规范

输出格式说明

上传到 GitHub

git init
git add .
git commit -m "Initial commit: my-skills-hub"
git remote add origin https://github.com/yourname/my-skills-hub
git push -u origin main

导入自己的 Skill

python3 scripts/skill_manager.py add-remote \
  --agent zhongshu \
  --name my_skill \
  --source https://raw.githubusercontent.com/yourname/my-skills-hub/main/my_skill/SKILL.md \
  --description "我的定制技能"

API 完整参考

POST /api/add-remote-skill

添加远程 skill。

请求:

curl -X POST http://localhost:7891/api/add-remote-skill \
  -H "Content-Type: application/json" \
  -d '{
    "agentId": "zhongshu",
    "skillName": "code_review",
    "sourceUrl": "https://raw.githubusercontent.com/...",
    "description": "代码审查"
  }'

响应 (200):

{
  "ok": true,
  "message": "技能 code_review 已从远程源添加到 zhongshu",
  "skillName": "code_review",
  "agentId": "zhongshu",
  "source": "https://raw.githubusercontent.com/...",
  "localPath": "/Users/xxx/.openclaw/workspace-zhongshu/skills/code_review/SKILL.md",
  "size": 2048,
  "addedAt": "2026-03-02T14:30:00Z"
}

GET /api/remote-skills-list

列出所有远程 skills。

curl http://localhost:7891/api/remote-skills-list

响应:

{
  "ok": true,
  "remoteSkills": [
    {
      "skillName": "code_review",
      "agentId": "zhongshu",
      "sourceUrl": "https://raw.githubusercontent.com/...",
      "description": "代码审查能力",
      "localPath": "/Users/xxx/.openclaw/workspace-zhongshu/skills/code_review/SKILL.md",
      "addedAt": "2026-03-02T14:30:00Z",
      "lastUpdated": "2026-03-02T14:30:00Z",
      "status": "valid"
    }
  ],
  "count": 1,
  "listedAt": "2026-03-02T14:35:00Z"
}

POST /api/update-remote-skill

更新远程 skill 为最新版本。

curl -X POST http://localhost:7891/api/update-remote-skill \
  -H "Content-Type: application/json" \
  -d '{
    "agentId": "zhongshu",
    "skillName": "code_review"
  }'

DELETE /api/remove-remote-skill

移除远程 skill。

curl -X POST http://localhost:7891/api/remove-remote-skill \
  -H "Content-Type: application/json" \
  -d '{
    "agentId": "zhongshu",
    "skillName": "code_review"
  }'

故障排查

Q: 下载失败,提示 "Connection timeout"

A: 检查网络连接和 URL 有效性

curl -I https://raw.githubusercontent.com/...
# 应该返回 HTTP/1.1 200 OK

Q: 文件格式无效

A: 确保 SKILL.md 以 YAML frontmatter 开头

---
name: skill_name
description: 描述
---

# 正文开始...

Q: 导入后看不到 Skill

A: 刷新看板或检查 Agent 是否配置正确

# 检查 Agent 是否存在
python3 scripts/skill_manager.py list-remote

# 检查本地文件
ls -la ~/.openclaw/workspace-zhongshu/skills/

更多信息