codecamp

OpenClaw 创建 Skills

创建自定义 Skills 🛠

OpenClaw 被设计为易于扩展。"Skills"是为你的助手添加新功能的主要方式。

什么是 Skill?

Skill 是一个包含 SKILL.md 文件(为 LLM 提供指令和工具定义)的目录,可选包含一些脚本或资源。

分步指南:你的第一个 Skill

1. 创建目录

Skills 位于你的工作区中,通常是 ~/.openclaw/workspace/skills/。为你的 Skill 创建一个新文件夹:

mkdir -p ~/.openclaw/workspace/skills/hello-world

2. 定义 SKILL.md

在该目录中创建一个 SKILL.md 文件。此文件使用 YAML frontmatter 作为元数据,使用 Markdown 作为指令。

---
name: hello_world
description: A simple skill that says hello.
---


## Hello World Skill


When the user asks for a greeting, use the `echo` tool to say "Hello from your custom skill!".

3. 添加工具(可选)

你可以在 frontmatter 中定义自定义工具,或指示智能体使用现有的系统工具(如 bashbrowser)。

4. 刷新 OpenClaw

让你的智能体"刷新 skills"或重启 Gateway 网关。OpenClaw 将发现新目录并索引 SKILL.md

最佳实践

  • 简洁明了:指示模型做什么,而不是如何成为一个 AI。
  • 安全第一:如果你的 Skill 使用 bash,确保提示词不允许来自不受信任用户输入的任意命令注入。
  • 本地测试:使用 openclaw agent --message "use my new skill" 进行测试。

共享 Skills

你也可以在 ClawHub 上浏览和贡献 Skills。

OpenClaw 按智能体的沙箱 + 工具限制、优先级和示例
OpenClaw 斜杠命令:文本 vs 原生、配置和支持的命令
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

OpenClaw 消息渠道

OpenClaw 工具

OpenClaw 模型

OpenClaw 平台

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }