AI创想

标题: OpenClaw 中的 Skills 机制与复现 [打印本页]

作者: 米落枫    时间: 2026-4-14 09:44
标题: OpenClaw 中的 Skills 机制与复现
作者:小超同学你好
摘要:OpenClaw 通过 Skills 与 ClawHub 扩展智能体能力,技能以「目录 + SKILL.md / manifest.json」形式存放在工作区 skills/ 下,并在 openclaw.json 中注册;安装/更新/移除技能时会同步更新 SKILLS.md,使智能体在下一轮推理中可见新能力。本文说明 OpenClaw 的 skills 机制、如何更新 skills,并结合 LangGraph 7. 技能 Skills 的 Agent Skills 规范,在 demo_codes 中复现「注册表 + SKILLS.md 同步」的流程。
关键词:OpenClaw;Skills;ClawHub;SKILLS.md;openclaw.json;技能更新;Agent Skills
参考:

1 OpenClaw 中的 Skills 是什么?

OpenClaw 默认只能对话;Skills 是给智能体增加能力的扩展单元,类似「手机上的 App」:
与 LangGraph 7. 技能 Skills 中的 Agent Skills 一致:技能以文件夹 + SKILL.md(或 OpenClaw 的 manifest.json)形式存在,包含元数据和使用说明;智能体通过发现 → 选择 → 加载 → 使用来调用。

2 三种能力类型:Built-in Tools / Skills / Plugins

类型含义来源
Built-in Tools核心能力(文件、Shell、web_fetch 等)随 OpenClaw 默认提供(约 20 个)
SkillsOpenClaw 原生扩展格式ClawHub 或自建,符合 AgentSkills 规范
Plugins基于 MCP 的集成任意 MCP 兼容服务器
对多数用户而言,Skills 是扩展能力的主要方式。

3 ClawHub 与技能的安装/更新/移除

3.1 ClawHub

ClawHub 是 OpenClaw 的社区技能市场(类似 npm 对 JavaScript),截至 2026 年初已托管 5,700+ 社区技能。支持按分类、热度、时间浏览,以及安装、更新、移除。
3.2 安装

在 OpenClaw 的对话界面里输入:
  1. /skills install @author/skill-name
复制代码
安装后:
  1. {"skills":{"@niceperson/brave-web-search":{"enabled":true,"config":{"apiKey":"${BRAVE_API_KEY}"}}}}
复制代码
3.3 如何更新 Skills(重要)

更新通过命令完成:
  1. /skills update @author/skill-name
  2. /skills update --all
复制代码
注意:更新前应查看 changelog;技能更新可能改变行为、增加权限或破坏现有工作流。
3.4 移除
  1. /skills remove @author/skill-name
复制代码
会从工作区删除该技能目录,并从 openclaw.json 的 skills 中移除对应项;同样会重新生成 SKILLS.md,不再包含该技能。

4 SKILLS.md 与技能更新

4.1 SKILLS.md 的作用

SKILLS.md 属于 OpenClaw 的「记忆/能力可见性」设计:
这样能力列表是透明、可审计、可版本管理的。
4.2 更新流程小结

操作对工作区的影响对 openclaw.json对 SKILLS.md
install在 skills/ 下新增技能目录在 skills 中增加一项(enabled、config 等)写入/追加该技能的能力描述
update用最新版本覆盖该技能目录内容一般保留原有配置根据当前已安装技能重新生成或更新描述
remove删除该技能目录从 skills 中删除该项重新生成,不再包含该技能
因此,OpenClaw 更新 skills 的机制可以概括为:

5 与 LangGraph 7. 技能 Skills(LangGraph Agent Skills)的对应关系

概念LangGraph 7. 技能 Skills(本仓库)OpenClaw
技能形态文件夹 + SKILL.md(YAML frontmatter + 正文)文件夹 + SKILL.md 或 manifest.json + index.js/index.py
技能库位置skills_library/工作区 skills/
注册/配置无统一注册表,仅扫描目录openclaw.json 的 skills 段(enabled、config、sandbox 等)
能力可见性发现时读 SKILL.md frontmatterSKILLS.md 由安装器维护,列出已安装技能及能力
发现→选择→加载→使用有(skill_loader)同思路,Agent 读 SKILLS.md 与 SKILL.md 执行
安装/更新/移除需手动放文件`/skills install
这里,我们写了一个例子, 在 LangGraph 7. 技能 Skills 的「发现→选择→加载→使用」基础上,复现 OpenClaw 的:

6 openclaw skills 复现内容概览

通过该 demo 可直接体验:安装或更新技能后,SKILLS.md 如何被更新,以及 Agent 如何通过 SKILLS.md + SKILL.md 使用这些能力。
6.1 列出仓库中可安装技能

我们通过
  1. python main.py list
复制代码
可以罗列clawhub_store文件夹中包含的所有skills(注意,clawhub_store文件夹这里用来模拟cloawhub)。比如:
  1. 可安装技能(clawhub_store):
  2.   - algorithmic-art  (algorithmic-art): Creating algorithmic art using p5.js with seeded randomness ...
  3.   - brand-guidelines  (brand-guidelines): Applies Anthropic's official brand colors and typography to ...
  4.   - canvas-design  (canvas-design): Create beautiful visual art in .png and .pdf documents using...
  5.   - claude-api  (claude-api): Build apps with the Claude API or Anthropic SDK. TRIGGER whe...
  6.   - doc-coauthoring  (doc-coauthoring): Guide users through a structured workflow for co-authoring d...
  7.   - docx  (docx): Use this skill whenever the user wants to create, read, edit...
  8.   - frontend-design  (frontend-design): Create distinctive, production-grade frontend interfaces wit...
  9.   - internal-comms  (internal-comms): A set of resources to help me write all kinds of internal co...
  10.   - mcp-builder  (mcp-builder): Guide for creating high-quality MCP (Model Context Protocol)...
  11.   - pdf  (pdf): Use this skill whenever the user wants to do anything with P...
  12.   - pptx  (pptx): Use this skill any time a .pptx file is involved in any way ...
  13.   - skill-creator  (skill-creator): Create new skills, modify and improve existing skills, and m...
  14.   - slack-gif-creator  (slack-gif-creator): Knowledge and utilities for creating animated GIFs optimized...
  15.   - summarize  (summarize): Use this skill when the user wants to summarize, condense, o...
  16.   - theme-factory  (theme-factory): Toolkit for styling artifacts with a theme. These artifacts ...
  17.   - web-artifacts-builder  (web-artifacts-builder): Suite of tools for creating elaborate, multi-component claud...
  18.   - webapp-testing  (webapp-testing): Toolkit for interacting with and testing local web applicati...
  19.   - xlsx  (xlsx): Use this skill any time a spreadsheet file is the primary in...
复制代码
6.2 安装技能

我们可以通过
  1. python main.py install[skill-name]
复制代码
来安装skill。在这里,我们模拟安装skills为:从clawhub_store文件夹中找到对应的skill文件夹,然后复制黏贴到skills文件夹中。在实际应用,其实逻辑也是一样的。比如,我们在terminal中运行:
  1. python main.py install skill-creator
复制代码
返回:
  1. 已安装技能: skill-creator,并已更新 openclaw.json 与 SKILLS.md。
复制代码
6.3 移除技能

我们可以通过
  1. python main.py remove [skill-name]
复制代码
来删除已经安装的 skill。
6.4 openclaw.json 与 SKILLS.md

我们来看一下 openclaw.json 与 SKILLS.md 的内容:
openclaw.json
  1. {"skills":{"summarize":{"enabled":true,"config":{}},"docx":{"enabled":true,"config":{}},"skill-creator":{"enabled":true,"config":{}}}}
复制代码
SKILLS.md
  1. # Installed Skills
  2. 本文档由 openclaw 风格安装器自动生成,列出当前已启用技能及其能力。
  3. 安装/更新/移除技能后会更新此文件。
  4. ## 技能列表
  5. - **docx** (`docx`)
  6.   - Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', or requests to produce ...
  7. - **skill-creator** (`skill-creator`)
  8.   - Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill...
  9. - **summarize** (`summarize`)
  10.   - Use this skill when the user wants to summarize, condense, or extract key points from text. Preserve important information and source references when relevant.
复制代码
在此案例的源码中,openclaw.json 与 SKILLS.md 的调用与作用如下。
openclaw.json
SKILLS.md
因此,openclaw.json 决定「哪些技能已安装、是否启用、配置是什么」并驱动发现时的过滤;SKILLS.md 则是对「当前已启用技能及其能力」的同步快照,供下一轮推理或人工查看。
6.5 代码的实际运行

比如:
  1. python main.py run "请总结下面这段话:问题(50 字内)
  2. ReAct、Plan-and-Execute、Graph 等主流 Agent 架构,上手难度、调试成本、工程落地门槛差异在哪?新手该如何循序渐进?
  3. 问题描述(≥200 字,偏技术讨论向)
  4. 本问题旨在从实际开发与工程落地视角,对比当前主流的 Agent 架构(包括但不限于 ReAct、Plan-and-Execute、Graph 等)在上手难度、学习曲线、调试复杂度、状态管理、可扩展性等方面的真实差异。重点关注不同架构对新手的友好程度、是否需要复杂的中间件支持、在长流程与多工具调用场景下的稳定性与可观测性,以及从 Demo 到生产环境的改造成本。通过对比各架构的适用场景、坑点与最佳实践,帮助开发者明确学习顺序、技术选型依据,以及在实际项目中优先采用哪种架构更易落地、更易维护、更易迭代。"
复制代码
返回:
  1. 用户任务:请总结下面这段话:问题(50 字内)
  2. ReAct、Plan-and-Execute、Graph 等主流 Agent 架构,上手难度、调试成本、工程落地门槛差异在...
  3. 选中技能:summarize
  4. 已加载技能正文(约 598 字符)
  5. 正在使用技能执行任务...--- 执行结果 ---
  6. 问题总结(50字内):
  7. 对比ReAct、Plan-and-Execute、Graph等Agent架构的上手难度、调试成本与工程落地门槛,为新手提供循序渐进的学习与选型路径。
复制代码

7 小结


原文地址:https://blog.csdn.net/zyctimes/article/details/159088437




欢迎光临 AI创想 (https://www.llms-ai.com/) Powered by Discuz! X3.4