Files
openclaw-skill/chapters/07-skills.md
Selig 4c966a3ad2 Initial commit: OpenClaw Skill Collection
6 custom skills (assign-task, dispatch-webhook, daily-briefing,
task-capture, qmd-brain, tts-voice) with technical documentation.
Compatible with Claude Code, OpenClaw, Codex CLI, and OpenCode.
2026-03-13 10:58:30 +08:00

141 lines
5.5 KiB
Markdown
Raw Permalink 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.
# 7. Skill 庫說明
Skills 位置:`~/.openclaw/workspace/skills/` 或 OpenClaw 官方 skill 庫
### 7.1 行動任務 Skills
| Skill | 功能 | 觸發方式 |
|-------|------|---------|
| `assign-task` | 分析任務,分派給 VPS-A 或 VPS-B | 使用者描述任務 |
| `dispatch-webhook` | 發送 Webhook 到 VPS等待回應 | assign-task 呼叫 |
| `project-status` | 查詢進行中的專案狀態 | 使用者查詢 |
| `code-review-request` | 提交 code review 請求 | 開發完成後 |
### 7.2 生活安排 Skills
| Skill | 功能 | 觸發方式 |
|-------|------|---------|
| `daily-briefing` | 每日簡報(行程+天氣+待辦) | cron 08:00 |
| `calendar-check` | 查詢 Google Calendar | 使用者查詢 |
| `schedule-plan` | 安排行程 | 使用者指令 |
| `reminder-set` | 設定定時提醒 | 使用者指令 |
| `task-capture` | 快速記錄待辦 | 使用者指令 |
### 7.3 ClawHub Skills已安裝
| Skill | 功能 | 來源 | 備註 |
|-------|------|------|------|
| `skill-vetter` | 安裝前安全審查(檢查權限範圍、可疑模式、風險分級) | ClawHub | 純指引型,無需額外設定 |
| `tavily-tool` | Tavily 網頁搜尋/探索,附來源引用摘要 | ClawHub | 需 `TAVILY_API_KEY`(已設於 `gateway.env`,透過 `EnvironmentFile` 載入) |
> **ClawHub 帳號**`@selika`GitHub: sovaha@gmail.com登入方式`npx clawhub login --token <token> --no-browser`
> **Python 依賴**`tavily-python 0.7.23`(已安裝於 `~/.openclaw/venv/`
> **踩坑**2026-03-11Gateway service 原本沒有 `EnvironmentFile``gateway.env` 的變數不會進入 Gateway 進程。修復service 加 `EnvironmentFile=/home/selig/.config/openclaw/gateway.env`
> **踩坑**2026-03-11skill 用 symlink 分發到 agent workspace 會被 Gateway 安全機制擋掉(`Skipping skill path that resolves outside its configured root`),必須用 `cp -r` 複製
### 7.4 Bundled Skills已啟用
| Skill | 功能 | 依賴 CLI | 備註 |
|-------|------|---------|------|
| `coding-agent` | 分派 coding 任務給 Claude Code/Codex/OpenCode | `claude``~/.local/bin/claude` | 需 bash pty:true |
| `summarize` | 摘要 URL/影片/Podcast 內容 | `summarize``~/.local/bin/summarize` → nvm | `@steipete/summarize` npm 套件 |
> **注意**bundled skills 的 CLI 安裝在 nvm 路徑時,需 symlink 到 `~/.local/bin/` 才能被 Gateway 的 PATH 找到。
> Gateway service PATH`%h/.local/bin:/usr/local/bin:/usr/bin:/bin`
### 7.5 知識庫 Skills
| Skill | 功能 | 觸發方式 |
|-------|------|---------|
| `qmd-brain` | 第二大腦搜尋BM25 + pgvector 語意) | 搜尋、查找、recall、之前說過... |
#### qmd-brain 架構
```
使用者 Telegram 查詢
┌─────────────────────────────────────────────┐
│ qmd-brain skill │
│ 1. qmd search → BM25 全文搜尋 (SQLite) │
│ 2. embed_to_pg → 語意搜尋 (PostgreSQL) │
│ └─ CLIProxyAPI text-embedding-ada-002 │
└─────────────────────────────────────────────┘
夜間排程02:00
qmd embed → 更新本地索引
embed_to_pg embed → 更新 PG 向量庫
```
#### 相關路徑
```
/home/selig/apps/qmd-pg/
├── embed_to_pg.py # 向量寫入/搜尋 Python 腳本
├── nightly-embed.sh # 夜間排程腳本
└── venv/ # Python 虛擬環境
PostgreSQL:
database: qmd_brain
table: brain_documents (vector(1536), HNSW)
user: qmd_user
qmd:
collections: selig-home (/home/selig)
index: ~/.cache/qmd/index.sqlite
```
### 7.6 Skill 格式說明
每個 Skill 由兩個檔案組成:
**SKILL.mdFrontmatter + 說明)**
```yaml
---
name: skill-name # 必填kebab-case和資料夾同名
description: 一句話說明用途 # 必填,顯示在 skills list
triggers: # 必填,空陣列 = 僅供內部呼叫
- "關鍵字1"
- "關鍵字2"
tools: # 必填,宣告可用工具
- exec
- web_fetch
internal: false # 選填true = 對使用者隱藏
---
# Skill 標題
## 功能說明
詳細說明 Skill 的功能、輸入、輸出...
```
**handler.ts實作**
```typescript
export async function handler(ctx: any) {
const message = ctx.message?.text || ctx.message?.content || '';
// skill 邏輯...
return {
reply: '回覆文字(支援 Markdown',
metadata: { key: 'value' }, // 選填,結構化資料
files: ['/tmp/output.wav'], // 選填,附件檔案路徑
};
}
```
> 注意:不可 import 第三方 npm 套件skill 環境無 node_modules外部依賴改用 `execSync('curl ...')` 呼叫。
### 7.7 語音合成 Skilltts-voice
| Skill | 功能 | 觸發方式 |
|-------|------|---------|
| `tts-voice` | 文字轉語音LuxTTS Voice Cloning48kHz | tts、文字轉語音、語音合成、唸出來、說出來 |
- 呼叫本機 LuxTTS APIlocalhost:7860自動取得登入 cookie
- 支援修飾詞:慢速/快速/高品質
- 原始碼:`/home/selig/openclaw-skill/skills/tts-voice/`
### 7.8 Skill 開發指南
完整的 Skill 開發教學(含 SKILL.md 格式、handler.ts 寫法、觸發機制、context 物件、回傳格式、安裝驗證、實戰範例、常見踩坑)請參考:
`/home/selig/openclaw-skill/create-skill.md`