教程

OpenClaw Skills 开发指南:从零打造你的专属 AI 工作流插件

OpenClaw Skills 完整开发教程:Skills 工作原理、SKILL.md 文件格式、触发机制(关键词/描述匹配)、脚本和资源文件组织、发布到 ClaWHub 市场,以及 5 个实用 Skill 开发案例(天气/代码审查/日报生成/数据监控/自动翻译)。

2026/3/154分钟 阅读ClaudeEagle

Skills 是 OpenClaw 最强大的扩展机制。一个 Skill 就是一份 SKILL.md 文件——告诉 Claude 如何完成某类特定任务。本文带你从零开发一个 Skill,并介绍 5 个实用案例。

Skill 是什么

当你发送消息给 OpenClaw,它会:

  1. 扫描所有已安装的 Skills
  2. 匹配哪个 Skill 的描述和你的消息最相关
  3. 自动加载对应的 SKILL.md
  4. 按 SKILL.md 的指令执行任务

Skills 的优势:复用、可分享、不需要重复写提示词

Skill 文件结构

~/.openclaw/skills/my-skill/ SKILL.md # 核心文件(必须) scripts/ # 辅助脚本 helper.py templates/ # 模板文件 report.md README.md # 说明(发布时需要)

SKILL.md 格式

markdown
---
name: weather
description: Get current weather and forecasts for any location
triggers:
  - weather
  - forecast
  - temperature
version: 1.0.0
author: ClaudeEagle
---

# Weather Skill

## Instructions

When the user asks about weather:

1. Extract the location from the user message
2. Fetch weather data using: `curl wttr.in/{location}?format=j1`
3. Parse the JSON response
4. Format a clear weather report with:
   - Current temperature (Celsius)
   - Conditions (sunny, cloudy, rain...)
   - 3-day forecast
5. Reply in the same language as the user's message

## Example Responses

User: 上海今天天气怎么样?
Response: 上海当前天气:22°C,晴天...

触发机制说明

Skills 有两种触发方式:

1. 关键词触发:消息包含 triggers 列表里的词

2. 语义匹配:Claude 判断消息意图是否和 description 匹配

建议 description 写得越具体越好,减少误触发。

案例 1:代码审查 Skill

markdown
---
name: code-review
description: Review code snippets for bugs, security issues, and style problems
triggers: [review, code review, 代码审查, 看看这段代码]
---

# Code Review Skill

When user shares code for review:

1. Analyze for: bugs, security vulnerabilities, performance issues, style
2. Rate each issue: CRITICAL / HIGH / MEDIUM / LOW
3. Provide specific fix suggestions with code examples
4. End with a summary score (1-10) and top 3 improvements

Format:
## Issues Found
- [SEVERITY] Description (line X)
  Fix: `code`

## Summary
Score: X/10 | Key improvements: ...

案例 2:日报生成 Skill

markdown
---
name: daily-report
description: Generate a daily work summary report from git commits and notes
triggers: [日报, daily report, 今日总结, 工作报告]
---

# Daily Report Skill

When asked for a daily report:

1. Run: `git log --since='today 00:00' --author=$(git config user.email) --oneline`
2. Read any notes in ~/daily-notes/$(date +%Y-%m-%d).md if exists
3. Generate a structured report:
   - Completed tasks (from git commits)
   - In progress
   - Blockers
   - Plan for tomorrow
4. Save to ~/reports/$(date +%Y-%m-%d).md

案例 3:网站监控 Skill

markdown
---
name: site-monitor
description: Check if a website or API endpoint is up and responding correctly
triggers: [check site, 网站检查, 检查接口, is it up]
---

# Site Monitor Skill

When asked to check a URL:

1. Extract URL from message
2. Run: `curl -s -o /dev/null -w '%{http_code}|%{time_total}' {url}`
3. Check status code and response time
4. Report: UP/DOWN, status code, response time in ms
5. If DOWN, suggest possible causes

案例 4:自动翻译 Skill

markdown
---
name: translate
description: Translate text between Chinese and English (or other languages)
triggers: [翻译, translate, 英文翻译, 中文翻译]
---

# Translate Skill

1. Detect source language automatically
2. If source is Chinese -> translate to English
3. If source is English -> translate to Chinese
4. For technical content: preserve code blocks and technical terms
5. Provide brief explanation of key terms if needed

安装 Skill

bash
# 从 ClaWHub 安装
openclaw skill install weather
openclaw skill install code-review

# 列出已安装的 Skills
openclaw skill list

# 手动安装(把 Skill 目录放到)
~/.openclaw/skills/your-skill/

发布到 ClaWHub

bash
# 1. 确保 SKILL.md 有完整的 frontmatter
# 2. 添加 README.md(使用说明)
# 3. 发布
openclaw skill publish

发布后在 clawhub.com 上可见,其他用户可以一键安装。

Skills vs CLAUDE.md 的区别

SkillsCLAUDE.md
触发时机按需触发(消息匹配时)始终加载
范围可安装/分享/复用项目/个人专属
最适合可复用的工作流项目特定规则

来源:OpenClaw Skills - OpenClaw 官方文档

相关文章推荐

教程Claude Code Skills 自定义命令:打造你的团队专属 AI 工作流Claude Code Skills 自定义命令完整教程:Skills vs CLAUDE.md 使用场景对比、内置 Skills 速览(/batch/simplify/loop)、SKILL.md 文件格式与 Frontmatter 配置、四大实用 Skills 示例(代码审查/部署检查/功能开发/团队 OnBoarding)、传参方式、子代理执行与 Git 团队共享。2026/3/14教程Claude Code 插件开发指南:plugin.json 结构、Skills/Hooks/MCP 集成与官方市场提交Claude Code 插件开发完整指南:独立配置 vs 插件对比(命名空间/适用场景)、5 步快速创建(目录/plugin.json 清单字段/Skill/本地 --plugin-dir 测试/分享)、完整插件目录结构(.claude-plugin/commands/skills/agents/hooks/mcp/.lsp.json/settings.json)、各组件配置示例(Skills SKILL.md/LSP 服务器.lsp.json/默认 settings.json agent 键)、从独立配置迁移步骤对比表、三步调试方法,以及通过 claude.ai 和 Console 提交官方市场的方式。2026/3/8教程Claude Code 插件开发指南:从 plugin.json 到 Skills/Agents/Hooks 打包发布全流程Claude Code Plugin 开发完整指南:独立配置 vs Plugin 选型(短名称 vs 命名空间)、5 分钟创建第一个 Plugin(plugin.json Manifest + SKILL.md)、Plugin 目录结构(skills/agents/hooks/settings/lsp)、LSP 服务器集成、随 Plugin 发布默认 Hooks 设置、--plugin-dir 本地测试、从独立配置迁移(名称变化说明)、Git/npm 发布方式,以及 /plugin install/list/enable/disable/remove 用户命令。2026/3/6教程OpenClaw Standing Orders 完全指南:让 AI 记住你的长期规则和行为偏好OpenClaw Standing Orders(常驻指令)功能完整教程:Standing Orders 与 SOUL.md 的区别(动态运行时规则 vs 静态人格文件)、通过对话动态添加/查看/删除常驻指令、指令的持久化存储与跨会话生效机制、适合写入 Standing Orders 的内容类型(格式偏好/禁止行为/固定工作流)、与 Hooks 的协同使用、按渠道/Agent 设置不同的 Standing Orders,以及常驻指令的最佳实践(写清晰的规则、避免矛盾冲突、定期清理过时规则)。2026/3/26教程OpenClaw 多媒体处理完全指南:图片识别、音频转写与视频理解实战OpenClaw 多媒体处理(Media)完整教程:发送图片给 AI 进行视觉分析(OCR/物体识别/图表解读/代码截图)、音频消息自动转写为文字(Whisper/系统STT)、视频消息关键帧提取与理解、Node 摄像头实时拍照触发分析、媒体消息的渠道支持差异(各渠道的图片/音频/视频支持情况对比)、大文件处理策略(分割/压缩/超时设置)、媒体消息在不同 AI 模型上的能力对比(Claude Vision/GPT-4V/Gemini Pro Vision),以及本地媒体文件分析(read 工具读取图片路径)。2026/3/25教程OpenClaw TUI 完全指南:纯键盘操作的终端管理界面使用详解OpenClaw TUI(Terminal User Interface,终端用户界面)完整使用指南:TUI 与 Control UI(浏览器)的定位对比、适合 TUI 的场景(SSH 远程/无浏览器服务器/低带宽环境)、启动命令(openclaw tui)及参数、界面布局(Agents 面板/Sessions 面板/Channels 状态/Logs 实时流)、全键盘快捷键手册(导航/选择/搜索/刷新/退出)、在 TUI 中发送测试消息、实时日志过滤与搜索,以及 TUI 与 tmux/screen 配合使用的后台运行方案。2026/3/25