/dev-workflow:openclaw-agent-builderfrom dev-workflow
Create, configure, and edit OpenClaw agents from a host machine (locally or over SSH). This skill MUST be used whenever the user wants to add a new OpenClaw agent, build an agent for a business or organization (customer service, internal helpdesk, booking bot, etc.), scaffold agent workspace files (SOUL.md / AGENTS.md / IDENTITY.md / USER.md), wire channels (LINE / WhatsApp / Discord / Telegram / Slack and others) and bindings, set up an agent knowledge base (RAG), harden an agent against prompt injection and identity confusion, or edit / reconfigure / retune an existing OpenClaw agent. MUST trigger on any mention of OpenClaw agents, openclaw.json, agent bindings, agent workspace, "add an agent", "build a bot", "編一個 agent", "做一個客服 bot" — and also whenever ~/.openclaw or an openclaw.json file is present in the working host even if OpenClaw is not named.
Ships in dev-workflow. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
一份在 OpenClaw host 上操作的 runbook。它讓你訪談使用者的需求,把一個新 agent 從零建立起來(workspace 檔案 + config + channel + binding + RAG 知識庫),安全防線 預設就配置好;也支援安全地編輯現有 agent。
設計前提:Claude 以 operator 身分在跑著 OpenClaw 的機器上工作 —— 本機 Claude Code,
或 SSH 進去的遠端 host。它有完整的檔案系統與 openclaw CLI 存取。這是建立 agent 最
乾淨的路徑:不受 in-agent sandbox / tool-policy 限制,且能跑官方驗證與稽核指令。
OpenClaw 的「一個 agent」不是一條 workflow,而是一個完整隔離的人格範圍, 由三樣東西構成:
因此「新增一個 agent」實際上是五個動作:
openclaw.json 的 agents.list[] 加一筆bindings[] 加一條把 channel/peer 路由到該 agentId你的產出是「一組檔案 + 一段 config patch」,不是程式碼。
路徑速查(依現行文件;實際以 host 上為準)
- Config:
~/.openclaw/openclaw.json(JSON5)- State dir:
~/.openclaw- Workspace:
~/.openclaw/workspace或~/.openclaw/workspace-<agentId>- Agent dir:
~/.openclaw/agents/<agentId>/agent- Sessions:
~/.openclaw/agents/<agentId>/sessions
這是每次任務的第一件事,先於訪談、先於任何其他步驟。 在問使用者想做什麼 agent 之前,要先確定「這個 OpenClaw 跑在哪裡,你要怎麼連上去」。
開門就問使用者:
「要操作的 OpenClaw 是跑在這台機器(本機),還是要SSH 連到別台?」
若是遠端,向使用者問齊連線資訊:
~/.ssh/config 裡的 Host 別名。處理憑證的規則:
openclaw.json、寫進 log,也不要在後續回覆裡複述出來。sshpass 之類方式做非互動連線;理解密碼會短暫出現在指令中,
操作完不要留存。先測試連線再往下走:
ssh <target> "openclaw --version"
連得上、openclaw 也回得出版本,才算 0A 完成。連不上就先解決連線,不要硬往下做。
確定目標後,本 runbook 後面所有
openclaw …指令都在那台目標機器上執行 —— 本機就直接跑;SSH 就透過連線跑(ssh <target> "openclaw …")。檔案的讀寫 (workspace 檔、openclaw.json)也都針對目標機器。
確定能在目標機器上操作後,做以下檢查(本機直接跑,遠端透過 SSH 跑):
openclaw --version —— CLI 可用、版本為何openclaw status —— gateway 是否在跑、session 狀態cat ~/.openclaw/openclaw.json —— 讀現有設定(知道現有 agent / 路由 / channel)ls ~/.openclaw/ —— 看現有 workspace 與 agents 目錄這份 runbook 的內容是依 OpenClaw 公開文件整理的。版本之間 CLI 旗標與 config 鍵名 可能不同。所以:
openclaw <command> --help 驗證,不要照抄 runbook。session.dmScope、dmPolicy、bindings 等)以 openclaw config schema 或目標機器上的官方文件為準;本 runbook 的鍵名是起點,不是定論。寧可多問 / 多驗證一句,不要寫錯設定。
你此刻是 host 上的高權限 operator。請守住兩條界線:
tools.allow/deny、sandbox、dmPolicy 一律套 references/security-hardening.md
的強化預設,與你自己的權限分開思考。Phase 0 確定操作哪台 OpenClaw(本機 / SSH)→ 建立連線 → 驗證脈絡
Phase 1 選模式:建立新 agent / 編輯現有 agent
─────────────────────────────────────────────
建立新 agent:
Phase 2 訪談(6 題 + 私人/服務型分岔)
Phase 3 提出計畫 → 取得確認(先計畫,後執行)
Phase 4 產出檔案(workspace 檔 + config patch + 知識庫)
Phase 5 部署(備份 → 套用 → channel 登入 → 重啟)
Phase 6 驗收(doctor / security audit / 綁定與探測 / 試訊)
─────────────────────────────────────────────
編輯現有 agent:
見「編輯現有 agent」一節
讀完現有 config 後,問使用者:要建立新 agent還是編輯現有的。
如果是編輯,列出 agents.list[] 現有的 agent 給對方挑,然後跳到「編輯現有 agent」。
刻意只問 6 題。每題使用者沒明確回答的,就套最嚴格的預設,不臨場放寬。 若對話脈絡裡已經有答案,直接沿用、不要重問,只跟使用者確認。
第 1 題(分岔題,最重要):這是哪一種 agent?
這題決定後面所有模板與安全預設的走向。兩者的差異見下方「兩種 agent 型態」。
第 2 題:這個 agent 要做什麼?服務對象是誰? 請對方同時講清楚「服務範圍」與「明確不做的事」。這會變成 AGENTS.md 裡的 in-scope / out-of-scope 清單,是「應用邊界」防線的基礎。
第 3 題:接哪個 channel? LINE / WhatsApp / Discord / Telegram / Slack / 其他。
可複數。細節見 references/channels.md。
第 4 題:有哪些工作相關資料要當知識庫(RAG)?
文件形式、機密程度、會不會更新。細節見 references/knowledge-rag.md。
第 5 題:名字、語氣、emoji? → IDENTITY.md。
第 6 題:誰是授權使用者?它需要動工具還是純問答?
tg:<id>、Discord guild/role
等),不是名字。這點是「身份」防線的關鍵,務必問到具體識別碼。tools 收到最緊;要查資料/寄信/執行 → 才逐項放行對應工具。訪談完,把答案複述一次給使用者確認,再進 Phase 3。
dmPolicy: "pairing",allowFrom 只放主人的識別碼。main 即可(只有一個人)。一個 agent 服務很多不特定的人,這是正確的設計,不需要「一人一 agent」。重點:
session.dmScope: "per-channel-peer",讓每位顧客各自
獨立 session,A 顧客的對話不會被 B 顧客看到。預設的 main 會讓所有人共用一個
對話脈絡 —— 服務型 agent 絕對不能用 main。dmPolicy 視情況:要對公眾開放才用 "open"(並理解風險),半開放
用 "allowlist"。在寫入任何檔案或改 config 之前,先把完整計畫攤給使用者看:
openclaw.json 的 diff(新增的 agents.list 項目、bindings、channel 帳號)得到明確同意後才進 Phase 4。這條規則不可省略。
cram-support、home)。確認不與
agents.list[] 既有 id 衝突。~/.openclaw/workspace-<agentId>/references/file-templates.md 的模板,依第 1 題挑
私人版或服務型版:SOUL.md、AGENTS.md、IDENTITY.md、USER.md。
references/security-hardening.md 的四道防線
區塊。這不是選配。BOOTSTRAP.md:它只在全新、不含任何 bootstrap 檔的 workspace 才會
被 OpenClaw 自動產生。只要你預先把 SOUL.md/AGENTS.md 寫好,它就不會冒出來
—— 這正是「預先配置好的 agent」要的效果。也可在 config 設 skipBootstrap: true。references/knowledge-rag.md 建 knowledge/。assets/openclaw-config.patch.json5 當骨架,產出要併進
openclaw.json 的 agents.list 項目、bindings、必要時的 session.dmScope。
channel 帳號設定見 references/channels.md。依 references/operations.md 的「建立流程」執行:
cp ~/.openclaw/openclaw.json ~/.openclaw/openclaw.json.bak-<timestamp>openclaw.json;改完驗證 JSON5 能解析)openclaw channels login …openclaw gateway restart 或對應指令)依 references/operations.md 的「驗收」一節:
openclaw doctor —— 會抓出有風險 / 設錯的 DM policyopenclaw security audit —— 安全稽核openclaw agents list --bindings —— 確認 agent 與路由openclaw channels status --probe —— 確認 channel 連線把驗收結果回報給使用者。若 doctor / audit 有警告,先處理再交付。
編輯一個運作中的 agent 會立即影響線上行為,所以比建立更需要謹慎。
流程:
agents.list[] / bindings[] 設定,先讓使用者看現況。cp 一份 .bak;改 workspace 檔前也先留一份副本。agents list --bindings。常見的編輯類型,與要碰的地方:
| 想改的東西 | 動到哪裡 | 注意 |
|---|---|---|
| 人格、語氣 | SOUL.md / IDENTITY.md | 立即影響回應風格 |
| 服務範圍(能/不能做) | AGENTS.md 的 in/out-of-scope | 重寫清單,別只加不減 |
| 換接的 channel | bindings[] + channels.<ch>.accounts | 最具體的 binding 勝出 |
| 誰能用它 / 授權名單 | dmPolicy + allowFrom | 身份的真正閘門在這 |
| 多顧客對話會互串 | session.dmScope 設 per-channel-peer | 服務型 agent 必檢查 |
| 換 model | agents.list[].model | |
| 工具權限 | agents.list[].tools.allow/deny | 放寬要極保守 |
| 加 / 換知識庫 | workspace/knowledge/ | 見 knowledge-rag.md |
| 收緊 / 放寬隔離 | agents.list[].sandbox | |
| 補上安全防線 | SOUL.md / AGENTS.md | 老 agent 常缺,見下 |
安全健檢(編輯時順手做): 很多既有 agent 是早期手刻的,可能缺四道防線中的
某幾道。編輯時對照 references/security-hardening.md 檢查一遍,缺的就補上 ——
尤其是服務型 agent 有沒有設 dmScope、有沒有把「名字 ≠ 身份」寫進 SOUL.md。
references/file-templates.md —— SOUL/AGENTS/IDENTITY/USER 的完整模板,
含私人版與服務型版兩套。Phase 4 產檔時讀。references/security-hardening.md —— 四道防線(防提示注入、應用邊界、隱私、
身份錨點)的可貼上區塊與說明。產 SOUL/AGENTS 時必讀;編輯時健檢也讀。references/channels.md —— 各 channel 的帳號設定、bindings、dmPolicy、
session.dmScope。第 3 題之後讀。references/knowledge-rag.md —— 知識庫資料夾結構、注入標記、機密分級。
第 4 題有資料時讀。references/operations.md —— host 操作細節:備份、編輯 openclaw.json、CLI
序列、建立流程、編輯流程、驗收、回滾。Phase 5/6 與編輯流程都讀。assets/openclaw-config.patch.json5 —— config patch 骨架。agents.create/update/delete、agents.files.get/set、config.patch、
skills.install 等方法。一個 web builder 平台可以走那套協定做到同樣的事。屆時
本 skill 的訪談流程、模板、安全強化邏輯可直接成為平台的「產生器核心」。What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub timlai666/skills --plugin dev-workflow4 skills in this plugin
/db-engineeringUniversal database engineering rules covering migration discipline, audit logging, soft delete, performance, and data integrity. This skill MUST be loaded before any database work, and MUST NOT be skipped because a schema change looks small or obvious. Triggers on: 任何資料庫相關工作, 建表, 改 schema, 寫 migration, DB design, database development, 設計資料庫, 改 DB 結構, 加欄位, 加索引, 改 table, SQL, 寫 trigger, 設計 API 的 DB 層, 查詢很慢, N+1, 效能優化, 資料完整性, CASCADE, 外鍵, 新增 table, 刪除資料, backup, 環境分離, dev prod 分開/openclaw-opsOperate, configure, and debug a running OpenClaw installation from a host machine (locally or over SSH). Covers the whole runtime surface **except** building agent personalities/workspaces — channels, gateway, daemon/service, config (`openclaw.json`), models + auth, cron, hooks, plugins, sandbox, sessions, security audit, doctor, reset, uninstall. This skill MUST be invoked on any mention of `openclaw` CLI commands, `~/.openclaw`, `openclaw.json`, "restart gateway", "add a channel", "check why my bot isn't responding", "openclaw doctor", "channels status", "ssh into the OpenClaw box", and similar — also whenever a host has `~/.openclaw/openclaw.json` and OpenClaw work is implied even if not named. MUST hand off to **openclaw-agent-builder** for any work that creates or edits an agent's workspace files (SOUL.md / AGENTS.md / IDENTITY.md / USER.md / RAG knowledge / `agents.list[]` entries / `bindings[]`).Other plugins' skills for the same job