Skip to main content
ClaudeWave
ES, Spanish
Skill288 estrellas del repoactualizado 7d ago

openclaw-deploy

The openclaw-deploy skill automates the deployment of OpenClaw, an AI chatbot framework, on remote Linux servers. Users should employ this skill when they need to install OpenClaw on a server, configure AI model API keys (such as GLM, DeepSeek, or Claude), integrate chat platforms like Telegram or Discord, and optionally enable browser automation capabilities through a guided setup process that checks system requirements and manages dependencies.

Instalar en Claude Code
Copiar
git clone --depth 1 https://github.com/majiayu000/spellbook /tmp/openclaw-deploy && cp -r /tmp/openclaw-deploy/skills/openclaw-deploy ~/.claude/skills/openclaw-deploy
Después abre una sesión nueva de Claude Code; el skill carga automáticamente.

SKILL.md

# OpenClaw 远程一键部署

在远程 Linux 服务器上自动部署 OpenClaw + AI 模型 + 聊天频道。

---

## 第零步:输出傻瓜教程

**skill 启动后,必须先输出以下准备清单**,让用户知道需要什么,然后再用 AskUserQuestion 收集信息:

```markdown
# OpenClaw 一键部署

欢迎!部署前你需要准备以下东西:

| 序号 | 准备什么 | 说明 | 必需? |
|------|----------|------|--------|
| 1 | 一台 Linux 服务器 | 最低 1GB 内存 + 500MB 磁盘,支持 SSH 登录 | 必需 |
| 2 | SSH 免密登录 | 确保本机能 `ssh user@host` 直接连上 | 必需 |
| 3 | AI 模型 API Key | 智谱GLM / DeepSeek / OpenAI / Claude / Kimi / 通义 任选 | 必需 |
| 4 | 聊天频道 Bot Token | Telegram(@BotFather) 或 Discord 或 飞书,也可以暂不配 | 可选 |
| 5 | 代理地址 | 中国大陆服务器 + 海外频道(Telegram/Discord)时需要 | 视情况 |
| 6 | 浏览器控制 | 让 Bot 能操控浏览器搜索/截图/填表,需额外安装 Playwright | 可选 |
```

---

## 第一步:收集信息

用 AskUserQuestion 收集($ARGUMENTS 已提供的跳过)。分两轮问:

### 第一轮(必填 3 项):

用 AskUserQuestion 同时问以下 3 个问题:

1. **SSH 连接信息**(header: "SSH 连接")
   - 选项根据上下文动态生成(如之前用过的服务器),兜底选项"其他服务器"
2. **AI 模型**(header: "AI 模型")
   - 智谱 GLM-5(国产,无需代理)
   - DeepSeek(国产,无需代理)
   - OpenAI GPT-4o(需代理或海外服务器)
   - Anthropic Claude(需代理或海外服务器)
3. **聊天频道**(header: "聊天频道")
   - Telegram(需 Bot Token,中国大陆需代理)
   - Discord(需 Bot Token)
   - 飞书(需 Bot Token)
   - 暂不配置
4. **浏览器控制**(header: "浏览器")
   - 启用(Bot 可操控浏览器搜索/截图/填表)
   - 暂不配置

### 第二轮(根据第一轮结果追问):

- 如果用户没提供 API Key → 问 API Key
- 如果选了聊天频道 → 问 Bot Token
  - 如果用户没有 Bot Token → 给出创建教程:
    - Telegram:找 @BotFather,发 `/newbot`
    - Discord:去 discord.com/developers 创建 Application → Bot
    - 飞书:去 open.feishu.cn 创建自建应用
- 如果选了 Telegram/Discord 且服务器在中国大陆 → 问代理地址
  - 自动判断:如果 SSH 到服务器后 `curl -s --connect-timeout 3 https://api.telegram.org` 失败,则判定需要代理

---

## 第二步:环境检查

SSH 连接到服务器,**单条命令**获取全部信息:

```bash
ssh <SSH_ARGS> "echo '=== CPU ===' && nproc && echo '=== 内存 ===' && free -h && echo '=== 磁盘 ===' && df -h / && echo '=== 系统 ===' && uname -a && echo '=== Node.js ===' && node -v 2>/dev/null || echo '未安装' && echo '=== npm ===' && npm -v 2>/dev/null || echo '未安装' && echo '=== 包管理器 ===' && which pacman apt yum dnf 2>/dev/null && echo '=== OpenClaw ===' && openclaw --version 2>/dev/null || echo '未安装'"
```

**最低要求**:1GB RAM + 500MB 磁盘。不满足则告知用户并停止。

---

## 第三步:安装 Node.js(如未安装)

根据检测到的包管理器:

| 包管理器 | 命令 |
|----------|------|
| pacman (Arch) | `pacman -S --noconfirm nodejs npm` |
| apt (Debian/Ubuntu) | `curl -fsSL https://deb.nodesource.com/setup_22.x \| bash - && apt install -y nodejs` |
| dnf (RHEL/Fedora) | `dnf install -y nodejs npm` |
| yum (CentOS) | `curl -fsSL https://rpm.nodesource.com/setup_22.x \| bash - && yum install -y nodejs` |

安装后验证:`node -v && npm -v`,确认 Node.js >= 22。

---

## 第四步:安装 OpenClaw

```bash
curl -fsSL https://openclaw.ai/install.sh | bash
```

> **重要**:安装脚本会尝试启动交互式 onboarding wizard,在非 TTY 环境会报 `/dev/tty: No such device or address` 错误。**这是正常的**,OpenClaw 本体已安装成功。

验证:`openclaw --version`

---

## 第五步:写入配置文件

**直接写 `~/.openclaw/openclaw.json`**,不用交互式 wizard。

### 模型配置模板

```json
{
  "models": {
    "mode": "merge",
    "providers": {
      "<PROVIDER_NAME>": {
        "baseUrl": "<BASE_URL>",
        "apiKey": "<API_KEY>",
        "api": "openai-completions",
        "models": [
          {
            "id": "<MODEL_ID>",
            "name": "<DISPLAY_NAME>",
            "reasoning": false,
            "input": ["text"],
            "contextWindow": 128000,
            "maxTokens": 32000
          }
        ]
      }
    }
  },
  "agents": {
    "defaults": {
      "model": {
        "primary": "<PROVIDER_NAME>/<MODEL_ID>"
      },
      "memorySearch": {
        "enabled": false
      }
    }
  },
  "gateway": {
    "mode": "local"
  }
}
```

### 常见模型参考

| Provider 名 | MODEL_ID | baseUrl |
|-------------|----------|---------|
| zhipu | glm-5 | `https://open.bigmodel.cn/api/paas/v4` |
| openai | gpt-4o | `https://api.openai.com/v1` |
| deepseek | deepseek-chat | `https://api.deepseek.com/v1` |
| kimi | moonshot-v1-128k | `https://api.moonshot.cn/v1` |
| qwen | qwen-max | `https://dashscope.aliyuncs.com/compatible-mode/v1` |
| anthropic | claude-sonnet-4-5-20250929 | `https://api.anthropic.com/v1` |

> **注意**:Anthropic 模型的 `api` 字段应为 `"anthropic-messages"` 而非 `"openai-completions"`。

写入后立即修复权限:

```bash
mkdir -p ~/.openclaw/agents/main/sessions ~/.openclaw/credentials
chmod 700 ~/.openclaw
chmod 600 ~/.openclaw/openclaw.json
```

---

## 第六步:启动网关(systemd)

按顺序执行:

```bash
# 安装 systemd 服务
openclaw gateway install

# 启用 linger(退出 SSH 后服务不会停)
loginctl enable-linger $(whoami)

# 启动
export XDG_RUNTIME_DIR=/run/user/$(id -u)
systemctl --user start openclaw-gateway.service
```

等待 3 秒后验证:

```bash
systemctl --user status openclaw-gateway.service | head -10
```

确认 `Active: active (running)`。

### 轮换 device token

网关首次启动后,轮换 operator token 修复可能的认证问题:

```bash
# 先获取 device ID
DEVICE_ID=$(openclaw devices list 2>&1 | grep -oP '[a-f0-9]{40,}')
# 轮换 token
openclaw devices rotate --role operator --device "$DEVICE_ID"
```

---

## 第七步:配置聊天频道(如需要)

根据用户选择的频道执行对应配置。

### 7a. 设置频道

**Telegram:**
```bash
openclaw config set channels.telegram.enabled true
openclaw config set channels.telegram.botToken '<BOT_TOKEN>'
openclaw config set channels.telegram.dmPolicy pairing
```

**Discord:**
```bash
openclaw config set channels.discord.enabled true
openclaw config set channels.discord.botToken '<BOT_TOKEN>'
openclaw config set channels.discord.dmPolicy pairing
```

**飞书:**
```bash
openclaw config set channels.feishu.enabled true
openclaw config set channels.feishu.token '<BOT_TOKEN>'
openclaw config set channels.feishu.dmPolicy pairing
```

### 7b. 配置代理(中国大陆服务器 + 海外频道时必须)

> **适用场景**:服务器在中国大陆,且频道是 Telegram 或 Discord(需访问海外 API)。
> 飞书是国内服务,不需要代理。

先测试是否需要代理(自动判断):

```bash
# Telegram
curl -s --connect-timeout 3 https://api.telegram.org/bot<BOT_TOKEN>/getMe
# Discord
curl -s --connect-timeout 3 https://discord.com/api/v10/users/@me -H "Authorization: Bot <BOT_TOKEN>"
```

如果超时/失败,说明需要代理。用用户提供的代理测试:

```bash
export http_proxy='<PROXY_URL>' && export https_proxy='<PROXY_URL>'
curl -s --connect-timeout 5 https://api.telegram.org/bot<BOT_TOKEN>/getMe
```

确认返回成功后,写入 systemd override。

> **重要**:proxy.conf 必须**一次性写完所有环境变量**(代理 + no_proxy + DISPLAY),
agentsmd-optimizeSkill

Audit AND optimize a CLAUDE.md / AGENTS.md instruction file — score it against the five high-leverage patterns, flag anti-patterns, then apply approved fixes in place. Use when the user says 优化 CLAUDE.md / 优化 AGENTS.md / optimize my agent doc / 帮我改 claudemd, or after an audit when they want the fixes applied (not just reported).

agentsmd-scaffoldSkill

Generate or update repository-specific AGENTS.md instruction files from real repo evidence. Use when asked to create, design, scaffold, split, or improve root or scoped AGENTS.md files for Codex/Claude/agent workflows, especially when a repo needs directory-specific rules, validation commands, generated-file boundaries, or a short agent onboarding router.

api-designSkill

REST/GraphQL/gRPC API design best practices. Use when designing APIs, defining contracts, handling versioning. Covers OpenAPI 3.2, GraphQL Federation, gRPC streaming.

app-ui-designSkill

Mobile app UI design expert for iOS and Android. Use when designing app interfaces, creating design systems, ensuring accessibility, or following platform guidelines. Covers Material Design 3, Human Interface Guidelines, color theory, typography, and 2025 trends.

app-user-story-qaSkill

End-to-end app feature inventory and user-story testing workflow with a canonical tracker. Use when the user asks to audit every feature, derive expected behavior from code, test user journeys, or explicitly fix and retest documented UX or logistical defects.

architecture-foundationSkill

Design architecture foundations before implementation. Use when asked to design or refactor architecture, choose Rust/Go crate, package, module, runtime, workflow, or service boundaries, compare mature project architecture, prevent stacked one-off PRs, audit migration debt in existing repos, or produce a spec before coding.

architecture-researchSkill

Evidence-driven architecture research for understanding real systems and making technical decisions. Use when doing architecture landscape studies, source-backed system archaeology, build-vs-buy or adopt/adapt/build decisions, open-source and commercial comparisons, revisiting an earlier architecture choice, or handling requests such as 架构调研, 架构选型, 竞品架构, 技术尽调, 同类方案, 开源替代, how is X built, and what should we learn from X. Do not use for small mechanical changes, market-only discovery, or detailed design after the technology direction is already fixed.

ask-opencliSkill

Ask Grok or Gemini via opencli (browser-session based, no API cost). Use when the user says "问 grok", "问 gemini", "ask grok", "ask gemini", "用 grok 查", "grok 怎么看", "让 gemini 分析", or wants a second opinion from Grok/Gemini without paying API tokens. Routes to opencli which drives the already-logged-in Chrome session.