openclaw-plugin

创建和管理 OpenClaw 插件使用 before_prompt_build hook。触发词:'create plugin'、'add hook'、'inject context'、'modify gateway'。适用于使用 hook 系统扩展 OpenClaw 功能。

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "openclaw-plugin" with this command: npx skills add kofna3369/chinese-openclaw-plugin

🔌 OpenClaw 插件技能

使用 before_prompt_build hook 创建和管理插件

信息
版本1.0.0 — 2026-05-07
状态运行中

1. 目的和范围

目标

使用 OpenClaw hook 系统创建和管理插件。

使用时机

触发器行动
"创建插件"初始化新插件
"添加 hook"注册新 hook
"注入上下文"使用 hook 注入上下文
"修改网关"配置网关

2. Hook 系统

可用 Hooks

Hook触发时机用途
before_prompt_build构建提示前注入上下文、修改消息
after_response响应后日志、监控
on_error错误时错误处理

Hook 位置

~/.openclaw/plugins/<plugin-name>/
├── plugin.json       # 插件配置
├── hooks/
│   └── before_prompt_build.js
└── README.md

3. 创建插件

步骤 1:创建目录

mkdir -p ~/.openclaw/plugins/<plugin-name>/hooks

步骤 2:创建 plugin.json

{
  "name": "plugin-name",
  "version": "1.0.0",
  "hooks": [
    {
      "name": "before_prompt_build",
      "file": "hooks/before_prompt_build.js"
    }
  ],
  "description": "插件描述"
}

步骤 3:创建 Hook 文件

// hooks/before_prompt_build.js
module.exports = async function(context) {
  // 添加上下文
  context.systemMessage = "你的系统消息";
  
  // 或修改用户消息
  // context.messages[0].content = "修改后的内容";
  
  return context;
};

4. 注册插件

# 启用插件
openclaw plugin enable <plugin-name>

# 禁用插件
openclaw plugin disable <plugin-name>

# 列出所有插件
openclaw plugin list

5. 插件示例

上下文注入插件

// hooks/before_prompt_build.js
module.exports = async function(context) {
  // 添加时间上下文
  const now = new Date();
  context.systemMessage += `\n当前时间:${now.toISOString()}`;
  
  return context;
};

消息修改插件

module.exports = async function(context) {
  // 检查用户消息
  if (context.messages[0].content.includes("密码")) {
    // 添加安全警告
    context.messages[0].content += "\n\n⚠️ 安全提示:请勿分享敏感信息";
  }
  
  return context;
};

6. 边缘情况

情况处理方法
Hook 抛出错误记录错误,继续执行
插件冲突禁用冲突插件
Hook 无效检查语法和路径
插件加载失败检查 plugin.json 格式

In Altum Per Plugin. 🔌 OpenClaw 插件 v1.0

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

Dex

Manage your Dex personal CRM — search, create, and update contacts, log interaction notes, set follow-up reminders, organize contacts with tags and groups, a...

Registry SourceRecently Updated
5620ocruzv
General

pumpmarket skill

Predict pump.fun token graduations (YES/NO) on Solana mainnet via PumpMarket parimutuel betting markets.

Registry SourceRecently Updated
General

maxhub-weibo

微博/Weibo平台微博热搜、话题、用户与博文数据采集。当用户提到微博、weibo、热搜、超话、话题等相关需求时激活此Skill。

Registry SourceRecently Updated
General

Context Resume

Reconstructs your full working context when you return to a task after an interruption — meeting, lunch, sleep, weekend, or three-week vacation. Not session...

Registry SourceRecently Updated