Files
knowledge-base/4 - Resources/OpenClaw-Skill-Reference.md
Yaojia Wang ad79665527 Sync
2026-03-14 20:23:32 +01:00

112 lines
3.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
created: "2026-03-10"
type: resource
tags: [openclaw, ai-gateway, claude-code, skill]
source: "https://docs.openclaw.ai/"
---
# OpenClaw Skill 参考
## 概述
OpenClaw 是一个自托管的 AI 网关将聊天应用WhatsApp、Telegram、Discord、Slack、Signal、iMessage 等 20+ 渠道)连接到 AI 编码代理。基于 Node.js 22+,使用 WebSocket 控制平面。
- 配置文件: `~/.openclaw/openclaw.json`JSON5 格式,热重载)
- 默认端口: `18789`
- 本地仓库: `C:\Users\yaoji\git\OpenSource\openclaw`
- 文档: https://docs.openclaw.ai/
- Claude Code Skill 位置: `~/.claude/skills/openclaw/SKILL.md`
## Skill 覆盖内容
### 核心操作
| 模块 | 功能 | 关键命令 |
|------|------|----------|
| Gateway | 启动/停止/重启/状态/服务安装 | `openclaw gateway run/start/stop/restart/status` |
| 配置 | JSON5 配置读写/验证/向导 | `openclaw config get/set/unset/validate` |
| Agent | 多 agent 隔离/路由绑定/身份 | `openclaw agents add/bind/unbind/list` |
| Session | 会话列表/清理/作用域管理 | `openclaw sessions/cleanup` |
### 通讯渠道
| 模块 | 功能 | 关键命令 |
|------|------|----------|
| Channel | 添加/登录/状态/能力探测 | `openclaw channels add/login/status/capabilities` |
| Message | 发送/回复/投票/反应/广播/线程 | `openclaw message send/poll/react/broadcast` |
### 扩展能力
| 模块 | 功能 | 关键命令 |
|------|------|----------|
| Skills | 列出/检查 agent 技能 | `openclaw skills list/info/check` |
| Plugins | 安装/启用/更新/卸载 | `openclaw plugins install/enable/update` |
| Hooks内部 | 事件驱动自动化 | `openclaw hooks list/enable/disable` |
| Webhooks外部 | HTTP 触发 agent | `POST /hooks/wake`, `POST /hooks/agent` |
| Cron | 定时任务 | `openclaw cron add/edit` |
### API 与集成
- **OpenAI 兼容 API**: `POST /v1/chat/completions`(需开启)
- **RPC 调用**: `openclaw gateway call <method>`
- **25+ 模型提供商**: Anthropic、OpenAI、Ollama、OpenRouter、Bedrock 等
## 关键配置结构
```
openclaw.json
├── identity # 名称/主题/表情
├── agents # agent 列表/默认值/workspace/model/skills
├── channels # 各渠道配置whatsapp/telegram/discord/slack...
├── session # 作用域/重置/维护
├── skills # 技能条目/加载/安装
├── plugins # 插件条目/允许/拒绝
├── tools # web/browser/canvas/media
├── gateway # 端口/绑定/认证/HTTP端点
├── hooks # webhook + 内部钩子
├── cron # 定时任务
├── acp # Agent Control Protocol
├── logging # 日志级别/脱敏
└── env # 环境变量
```
## Bootstrap 文件
放在 agent workspace 根目录:
- `AGENTS.md` - 操作指令 + 记忆
- `SOUL.md` - 人格/边界/语气
- `TOOLS.md` - 用户工具说明
- `BOOTSTRAP.md` - 一次性引导(运行后删除)
- `IDENTITY.md` - agent 名称/风格
- `USER.md` - 用户画像
## SKILL.md 格式(创建自定义技能)
```markdown
---
name: my-skill
description: 技能描述
requires:
bins: [node]
env: [API_KEY]
install:
- kind: node
package: my-package
---
# 技能说明和工具定义
```
## 常见工作流
1. **初始化**: `npm install -g openclaw@latest && openclaw onboard --install-daemon`
2. **添加渠道**: `openclaw channels add --channel telegram --token TOKEN`
3. **多 agent**: `openclaw agents add work --workspace ~/.openclaw/workspace-work`
4. **API 触发**: `curl -X POST http://127.0.0.1:18789/hooks/agent -H 'Authorization: Bearer TOKEN' -d '{"message":"..."}'`
5. **诊断**: `openclaw doctor --fix && openclaw status --deep`
## Related
- [[Claude Code 配置]]
- [[AI 工具链]]