← 返回 Skills 市场
376
总下载
1
收藏
2
当前安装
3
版本数
在 OpenClaw 中安装
/install skill-registry-unified
功能描述
一体化技能注册表 - 本地优先匹配,无匹配则自动搜索ClawHub并安全安装,新装技能自动注册到细分分类。
安全使用建议
This skill largely does what a registry/router would, but two things deserve attention before installing:
1) The README/description promises automatic install + registration of remote skills, but the provided code does not perform installation — it only searches and returns a 'toInstall' result. Expect behavior different from the description unless the agent or another skill performs installation.
2) The code runs 'npx clawdhub ...' to search ClawHub. npx can download and execute remote packages on demand, which is a real risk: review the 'clawdhub' CLI (its source and trustworthiness) before allowing this skill to run, or replace that call with a safe API-based search. Also be aware the vetting step is superficial (filename checks only) and may miss malicious content.
If you plan to use this skill:
- Audit the 'clawdhub' CLI/package and ensure your environment's npx behavior is acceptable.
- Consider restricting autonomous execution or requiring user confirmation before running remote searches or installs.
- Improve vetting before auto-install (content scans, signatures, or allowlisting) if you intend to enable auto-install behavior.
功能分析
Type: OpenClaw Skill
Name: skill-registry-unified
Version: 1.0.2
The skill bundle is a utility for managing and discovering other skills within the OpenClaw ecosystem. It provides functionality to scan local skills, update a central registry file (REGISTRY.md), and search for new skills on ClawHub using a sanitized search query. While the included security scanner (vetSkill in registry_unified.js) is rudimentary and contains a logic flaw where it validates non-existent remote skills as safe, there is no evidence of malicious intent or harmful behavior.
能力评估
Purpose & Capability
The description and SKILL.md promise a local-first registry that will 'search ClawHub and safe-install' and 'auto-register' new skills. The included code implements local scanning, registry generation, local matching, remote search and a basic vet check, but there is no code path that actually installs or registers a remote skill. That mismatch (claimed automatic install/register vs. actual behavior) is an incoherence.
Instruction Scope
Runtime instructions and code operate on the local skills folder and REGISTRY.md as expected. The vetter only checks for suspicious filenames (e.g., .env, id_rsa) rather than content, which is a weak vetting step. The skill also spawns an external process to query ClawHub (via npx), which goes beyond simple read-only inspection and can execute remote code.
Install Mechanism
There is no formal install spec (instruction-only), but the runtime uses child_process.spawn to run 'npx clawdhub ...'. npx may download and execute a package from the registry on demand — this can fetch and run arbitrary code from the network. The search relies on an external CLI rather than a safe API call, increasing execution risk.
Credentials
The skill requests no environment variables or credentials and accesses only local paths under '../../skills' and '../../REGISTRY.md', which are coherent with a registry/router. No unrelated secrets or config paths are requested.
Persistence & Privilege
always is false and the skill does not claim to alter other skills' configuration. scan-all-skills.js writes REGISTRY.md (local registry artifact), which is within scope. The skill can be invoked autonomously (platform default); combined with the npx execution behavior, that increases potential blast radius if allowed to run without user prompts.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install skill-registry-unified - 安装完成后,直接呼叫该 Skill 的名称或使用
/skill-registry-unified触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.2
- Removed some triggers for simplified skill matching.
- Trimmed and simplified the description and documentation for clarity.
- Reduced metadata tags to focus on core functionality.
- Retained key dependencies and the main routing logic.
v1.0.1
No file changes in this version.
- No code or documentation changes detected for version 1.0.1.
- Functionality and SKILL.md remain identical to the previous version (2.0.0).
- No user-facing updates in this release.
v1.0.0
# OpenClaw一体化技能注册表最终方案
**适配 ClawHub 官方分类・开箱即用**
---
## 一、方案概述
本方案实现 OpenClaw 智能体**全自动技能调度体系**,适配 ClawHub 官方细分分类,解决原分类过粗、匹配不精准的问题:
- 本地技能优先,毫秒级关键词匹配
- 本地无技能 → 自动搜索 ClawHub
- 安装前安全检查 + 用户确认
- 新装技能根据 tags 自动注册到细分分类
- 完全兼容官方 `REGISTRY.md` 格式
### 核心流程
1. 用户输入任意指令
2. 匹配本地 `REGISTRY.md` 触发词
3. 有匹配 → 直接执行技能
4. 无匹配 → 搜索远程技能 → 安全检查 → 用户确认 → 安装 → 自动注册到细分分类 → 执行
---
## 二、文件结构
```Plain Text
skills/
├── REGISTRY.md # 自动生成的官方格式技能注册表(细分分类)
└── skill-registry-unified/ # 一体化路由核心
├── SKILL.md # 技能元信息(官方格式)
├── registry_unified.js # 匹配+搜索+安装+注册主逻辑
└── scan-all-skills.js # 全量扫描生成注册表脚本
```
---
## 三、1. 注册表生成脚本 scan-all-skills.js
作用:扫描本地所有技能,自动生成**ClawHub 官方细分分类格式**的 `REGISTRY.md`。
```javascript
const fs = require('fs');
const path = require('path');
const yaml = require('js-yaml');
const SKILLS_DIR = path.resolve(__dirname, '../../skills');
const REGISTRY_PATH = path.resolve(__dirname, '../../REGISTRY.md');
const CATEGORIES = [
'开发与运维 | Development & DevOps',
'内容创作与多模态 | Content Creation & Multimodal',
'办公自动化 | Office Productivity',
'数据科学与分析 | Data Science & Analysis',
'搜索与研究 | Search & Research',
'营销与销售 | Marketing & Sales',
'视觉设计 | Visual Design',
'教育学习 | Education & Learning',
'AI与LLMs | AI & LLMs',
'智能家居与IoT | Smart Home & IoT',
'安全与合规 | Security & Compliance',
'通信与协作 | Communication & Collaboration',
'其他 | Others'
];
// 分类映射:根据技能tags匹配对应分类
const CATEGORY_MAP = {
// 开发与运维
'dev': '开发与运维 | Development & DevOps',
'code': '开发与运维 | Development & DevOps',
'github': '开发与运维 | Development & DevOps',
'coding': '开发与运维 | Development & DevOps',
'devops': '开发与运维 | Development & DevOps',
'test': '开发与运维 | Development & DevOps',
'deploy': '开发与运维 | Development & DevOps',
// 内容创作与多模态
'content': '内容创作与多模态 | Content Creation & Multimodal',
'write': '内容创作与多模态 | Content Creation & Multimodal',
'image': '内容创作与多模态 | Content Creation & Multimodal',
'video': '内容创作与多模态 | Content Creation & Multimodal',
'audio': '内容创作与多模态 | Content Creation & Multimodal',
'edit': '内容创作与多模态 | Content Creation & Multimodal',
'design': '内容创作与多模态 | Content Creation & Multimodal',
// 办公自动化
'office': '办公自动化 | Office Productivity',
'productivity': '办公自动化 | Office Productivity',
'notion': '办公自动化 | Office Productivity',
'calendar': '办公自动化 | Office Productivity',
'email': '办公自动化 | Office Productivity',
'todo': '办公自动化 | Office Productivity',
// 数据科学与分析
'data': '数据科学与分析 | Data Science & Analysis',
'analysis': '数据科学与分析 | Data Science & Analysis',
'excel': '数据科学与分析 | Data Science & Analysis',
'csv': '数据科学与分析 | Data Science & Analysis',
'sql': '数据科学与分析 | Data Science & Analysis',
'chart': '数据科学与分析 | Data Science & Analysis',
// 搜索与研究
'search': '搜索与研究 | Search & Research',
'research': '搜索与研究 | Search & Research',
'scrape': '搜索与研究 | Search & Research',
'crawl': '搜索与研究 | Search & Research',
'info': '搜索与研究 | Search & Research',
// 营销与销售
'marketing': '营销与销售 | Marketing & Sales',
'sales': '营销与销售 | Marketing & Sales',
'seo': '营销与销售 | Marketing & Sales',
'ads': '营销与销售 | Marketing & Sales',
'social': '营销与销售 | Marketing & Sales',
// 视觉设计
'visual': '视觉设计 | Visual Design',
'graphic': '视觉设计 | Visual Design',
'illustration': '视觉设计 | Visual Design',
'ui': '视觉设计 | Visual Design',
'ux': '视觉设计 | Visual Design',
// 教育学习
'education': '教育学习 | Education & Learning',
'learn': '教育学习 | Education & Learning',
'study': '教育学习 | Education & Learning',
'course': '教育学习 | Education & Learning',
// AI与LLMs
'ai': 'AI与LLMs | AI & LLMs',
'llm': 'AI与LLMs | AI & LLMs',
'gpt': 'AI与LLMs | AI & LLMs',
'claude': 'AI与LLMs | AI & LLMs',
'gemini': 'AI与LLMs | AI & LLMs',
// 智能家居与IoT
'iot': '智能家居与IoT | Smart Home & IoT',
'home': '智能家居与IoT | Smart Home & IoT',
'device': '智能家居与IoT | Smart Home & IoT',
'control': '智能家居与IoT | Smart Home & IoT',
// 安全与合规
'security': '安全与合规 | Security & Compliance',
'vet': '安全与合规 | Security & Compliance',
'audit': '安全与合规 | Security & Compliance',
'protect': '安全与合规 | Security & Compliance',
// 通信与协作
'communication': '通信与协作 | Communication & Collaboration',
'slack': '通信与协作 | Communication & Collaboration',
'team': '通信与协作 | Communication & Collaboration',
'chat': '通信与协作 | Communication & Collaboration'
};
function scanAllSkills() {
const skills = [];
fs.readdirSync(SKILLS_DIR).forEach(dir => {
const skillDir = path.join(SKILLS_DIR, dir);
const skillMdPath = path.join(skillDir, 'SKILL.md');
if (!fs.statSync(skillDir).isDirectory() || !fs.existsSync(skillMdPath)) return;
try {
const content = fs.readFileSync(skillMdPath, 'utf8');
const yamlStart = content.indexOf('---') + 3;
const yamlEnd = content.indexOf('---', yamlStart);
const meta = yaml.load(content.slice(yamlStart, yamlEnd));
// 确定技能分类
let category = '其他 | Others';
const tags = (meta.metadata?.tags || []).concat(meta.triggers || []).map(tag => tag.toLowerCase());
for (const tag of tags) {
if (CATEGORY_MAP[tag]) {
category = CATEGORY_MAP[tag];
break; // 匹配到第一个标签就确定分类
}
}
skills.push({
name: meta.name || dir,
triggers: meta.triggers || [],
description: meta.description || dir,
category: category
});
} catch (e) {
console.warn(`⚠️ 解析技能 ${dir} 失败:${e.message}`);
}
});
return skills;
}
function generateRegistry(skills) {
const byCat = {};
CATEGORIES.forEach(c => (byCat[c] = []));
skills.forEach(s => byCat[s.category]?.push(s));
let out = `# Skill Registry
> Last updated: ${new Date().toISOString().split('T')[0]}
> Usage: When user asks "what skills" / "有什么技能", read this file and summarize by category.
## Quick Commands | 快捷命令
| Command | Effect |
|---------|--------|
| /skills | List all skills by category |
| /skills keyword | Find related skills |
| /技能 | 列出所有技能(分类) |
| /技能 关键词 | 查找相关技能 |
`;
for (const cat of CATEGORIES) {
out += `## ${cat}\n\n`;
out += `| Skill | Triggers | Description |\n`;
out += `|-------|----------|-------------|\n`;
if (byCat[cat].length === 0) {
out += `| - | - | 暂无技能 |\n`;
} else {
byCat[cat].forEach(s => {
const ts = s.triggers.join('、');
out += `| ${s.name} | ${ts} | ${s.description} |\n`;
});
}
out += '\n';
}
out += `---
## Discovery Guide | 发现指南
When user asks about skills:
1. "All skills" → List by category (brief)
2. Specific domain → Return that category only
3. "How to use XX" → Read skills/XX/SKILL.md
---
## Adding New Skills | 添加新技能
1. Create skill directory under skills/
2. Write SKILL.md
3. Auto-added via: node scan-all-skills.js
4. ClawHub skills auto-register after install
`;
return out;
}
function main() {
const skills = scanAllSkills();
const content = generateRegistry(skills);
fs.writeFileSync(REGISTRY_PATH, content, 'utf8');
console.log(`✅ REGISTRY.md 已生成:${REGISTRY_PATH}`);
}
main();
```
---
## 四、2. 一体化技能包 skill-registry-unified
### 2.1 [SKILL.md](SKILL.md)
```markdown
---
name: skill-registry-unified
description: 一体化技能注册表 - 本地优先匹配,无匹配则自动搜索ClawHub并安全安装,新装技能自动注册到细分分类。Local First + Auto Search + Safe Install + Auto Register with Fine-grained Categories。
version: 2.0.0
metadata:
author: Custom
license: MIT
openclaw:
emoji: "📋🔍"
category: meta
tags: [registry, routing, auto-install, local, remote, security, fine-grained]
triggers:
- "*" # 全局触发(所有指令优先走该技能)
- "what skills"
- "list skills"
- "有什么技能"
- "你会什么"
- "/skills"
- "/技能"
---
# Skill Registry Unified | 一体化技能注册表(细分分类版)
本地优先匹配 + 自动扩展安装的一站式技能路由系统,适配ClawHub官方细分分类,精准归类技能。
## 核心逻辑
1. **本地优先**:扫描官方格式 `REGISTRY.md`,按触发词匹配本地技能(毫秒级响应)
2. **自动扩展**:本地无匹配时,调用 `find-skills-skill` 搜索ClawHub技能市场
3. **安全可控**:安装前强制 `skill-vetter` 安全扫描,需用户确认后执行安装
4. **精准分类**:新装技能根据tags自动归类到ClawHub官方细分分类,无需手动整理
## 依赖要求(必须提前安装)
```bash
openclaw skill install find-skills-skill
openclaw skill install skill-vetter
openclaw skill install clawdhub
npm install js-yaml # 用于解析SKILL.md的YAML格式
```
## 快速部署
```bash
# 1. 确保技能目录存在
mkdir -p skills/skill-registry-unified
# 2. 放入SKILL.md、registry_unified.js、scan-all-skills.js
# 3. 生成初始注册表
node skills/skill-registry-unified/scan-all-skills.js
# 4. 注册本技能
openclaw skill register skills/skill-registry-unified
# 5. 添加全局路由规则到RULES.md(最顶部)
echo "- 所有用户输入 → 优先执行 skill-registry-unified" >> RULES.md
```
## 核心流程
```mermaid
flowchart TD
A[用户输入任意指令] --> B[触发本技能]
B --> C{扫描本地REGISTRY.md触发词}
C -->|匹配成功| D[直接调用对应本地技能执行]
C -->|匹配失败| E[调用find-skills-skill搜索ClawHub]
E -->|未找到| F[使用OpenClaw通用能力执行]
E -->|找到相关技能| G[调用skill-vetter安全扫描]
G -->|扫描不通过| F
G -->|扫描通过| H[询问用户是否安装]
H -->|用户拒绝| F
H -->|用户同意| I[clawdhub安装技能]
I --> J[根据tags自动注册到对应细分分类]
J --> K[调用新安装的技能执行]
```
## 细分分类说明(适配 ClawHub 官方)
|分类|说明|代表技能|
|---|---|---|
|开发与运维|开发者工具、DevOps、代码相关|GitHub、代码审查、自动化部署|
|内容创作与多模态|文字、图片、视频、音频创作|文案生成、图像编辑、视频剪辑|
|办公自动化|办公协作、效率工具|Notion 管理、日历同步、邮件自动化|
|数据科学与分析|数据处理、分析、可视化|Excel 处理、SQL 查询、图表生成|
|搜索与研究|信息搜索、数据抓取、调研|深度搜索、网页爬虫、竞品分析|
|营销与销售|营销推广、销售辅助|SEO 优化、广告投放、客户管理|
|视觉设计|图形设计、UI/UX|海报设计、界面原型、插画生成|
|教育学习|学习辅助、课程管理|知识点总结、课程规划、错题整理|
|AI 与 LLMs|AI 模型接入、大语言工具|GPT/Claude/Gemini 接入、prompt 优化|
|智能家居与 IoT|智能设备控制、物联网|灯光控制、温度调节、设备监控|
|安全与合规|安全扫描、合规检查|漏洞扫描、密钥检测、合规审计|
|通信与协作|团队协作、消息处理|Slack 集成、团队聊天、任务同步|
|其他|未匹配到以上分类的技能|通用工具、小众场景技能|
## 使用示例
### 示例 1:本地匹配成功
- 用户输入:帮我统计 Excel 里的销售数据
- 系统行为:扫描到触发词「Excel」→ 匹配 data-science-skill → 直接执行
### 示例 2:本地无匹配,自动扩展
- 用户输入:帮我生成一份小红书文案
- 系统行为:本地无匹配 → 搜索 ClawHub → 找到 xhs-copywriter → 安全扫描 → 询问用户 → 安装 → 自动注册到「内容创作与多模态」分类 → 执行
## 最佳实践
1. 触发词尽量具体(如「小红书文案」而非「文案」),提升匹配精准度
2. 定期执行 `scan-all-skills.js` 全量更新注册表,确保本地技能分类准确
3. 开启 skill-vetter 严格模式,拒绝未签名技能,保障安全
4. 为自定义技能添加精准 tags,确保自动分类准确
5. 保留 [REGISTRY.md](REGISTRY.md) 备份,避免误操作丢失配置
```Plain Text
### 2.2 registry_unified.js(最终版核心)
```javascript
const fs = require('fs');
const { execSync } = require('child_process');
const path = require('path');
const yaml = require('js-yaml');
const CONFIG = {
REGISTRY_PATH: path.resolve(__dirname, '../../REGISTRY.md'),
SKILLS_DIR: path.resolve(__dirname, '../../skills')
};
// 分类映射:和scan-all-skills.js保持一致
const CATEGORY_MAP = {
'dev': '开发与运维 | Development & DevOps',
'code': '开发与运维 | Development & DevOps',
'github': '开发与运维 | Development & DevOps',
'coding': '开发与运维 | Development & DevOps',
'devops': '开发与运维 | Development & DevOps',
'test': '开发与运维 | Development & DevOps',
'deploy': '开发与运维 | Development & DevOps',
'content': '内容创作与多模态 | Content Creation & Multimodal',
'write': '内容创作与多模态 | Content Creation & Multimodal',
'image': '内容创作与多模态 | Content Creation & Multimodal',
'video': '内容创作与多模态 | Content Creation & Multimodal',
'audio': '内容创作与多模态 | Content Creation & Multimodal',
'edit': '内容创作与多模态 | Content Creation & Multimodal',
'design': '内容创作与多模态 | Content Creation & Multimodal',
'office': '办公自动化 | Office Productivity',
'productivity': '办公自动化 | Office Productivity',
'notion': '办公自动化 | Office Productivity',
'calendar': '办公自动化 | Office Productivity',
'email': '办公自动化 | Office Productivity',
'todo': '办公自动化 | Office Productivity',
'data': '数据科学与分析 | Data Science & Analysis',
'analysis': '数据科学与分析 | Data Science & Analysis',
'excel': '数据科学与分析 | Data Science & Analysis',
'csv': '数据科学与分析 | Data Science & Analysis',
'sql': '数据科学与分析 | Data Science & Analysis',
'chart': '数据科学与分析 | Data Science & Analysis',
'search': '搜索与研究 | Search & Research',
'research': '搜索与研究 | Search & Research',
'scrape': '搜索与研究 | Search & Research',
'crawl': '搜索与研究 | Search & Research',
'info': '搜索与研究 | Search & Research',
'marketing': '营销与销售 | Marketing & Sales',
'sales': '营销与销售 | Marketing & Sales',
'seo': '营销与销售 | Marketing & Sales',
'ads': '营销与销售 | Marketing & Sales',
'social': '营销与销售 | Marketing & Sales',
'visual': '视觉设计 | Visual Design',
'graphic': '视觉设计 | Visual Design',
'illustration': '视觉设计 | Visual Design',
'ui': '视觉设计 | Visual Design',
'ux': '视觉设计 | Visual Design',
'education': '教育学习 | Education & Learning',
'learn': '教育学习 | Education & Learning',
'study': '教育学习 | Education & Learning',
'course': '教育学习 | Education & Learning',
'ai': 'AI与LLMs | AI & LLMs',
'llm': 'AI与LLMs | AI & LLMs',
'gpt': 'AI与LLMs | AI & LLMs',
'claude': 'AI与LLMs | AI & LLMs',
'gemini': 'AI与LLMs | AI & LLMs',
'iot': '智能家居与IoT | Smart Home & IoT',
'home': '智能家居与IoT | Smart Home & IoT',
'device': '智能家居与IoT | Smart Home & IoT',
'control': '智能家居与IoT | Smart Home & IoT',
'security': '安全与合规 | Security & Compliance',
'vet': '安全与合规 | Security & Compliance',
'audit': '安全与合规 | Security & Compliance',
'protect': '安全与合规 | Security & Compliance',
'communication': '通信与协作 | Communication & Collaboration',
'slack': '通信与协作 | Communication & Collaboration',
'team': '通信与协作 | Communication & Collaboration',
'chat': '通信与协作 | Communication & Collaboration'
};
function loadLocalRegistry() {
if (!fs.existsSync(CONFIG.REGISTRY_PATH)) {
execSync(`node ${path.join(__dirname, 'scan-all-skills.js')}`, { stdio: 'ignore' });
}
const content = fs.readFileSync(CONFIG.REGISTRY_PATH, 'utf8');
const lines = content.split('\n');
const map = {};
let inTable = false;
lines.forEach(line => {
if (line.includes('| Skill | Triggers | Description |')) {
inTable = true;
return;
}
if (inTable && (line.startsWith('##') || line.startsWith('---'))) {
inTable = false;
return;
}
if (inTable && line.includes('|') && !line.includes('|---')) {
const parts = line.split('|').map(p => p.trim()).filter(Boolean);
if (parts.length >= 3) {
const skill = parts[0];
const triggers = parts[1].split('、').map(t => t.trim()).filter(Boolean);
triggers.forEach(t => map[t.toLowerCase()] = skill);
}
}
});
return map;
}
function matchLocalSkill(input) {
const map = loadLocalRegistry();
const lower = input.toLowerCase();
const sorted = Object.keys(map).sort((a, b) => b.length - a.length);
for (const t of sorted) {
if (lower.includes(t)) return map[t];
}
return null;
}
function searchRemote(input) {
try {
const res = execSync(`openclaw skill search "${input.replace(/"/g, '\\"')}"`, {
encoding: 'utf8', stdio: ['pipe', 'pipe', 'ignore']
});
const list = res.split('\n').filter(l => l.startsWith('- ')).map(l => l.slice(2).trim());
return list[0] || null;
} catch (e) {
return null;
}
}
function vet(skill) {
try {
const out = execSync(`openclaw skill vet ${skill} --strict`, {
encoding: 'utf8', stdio: ['pipe', 'pipe', 'ignore']
});
return out.includes('PASS') || out.includes('通过');
} catch (e) {
return false;
}
}
function ask(skill) {
const rl = require('readline').createInterface({ input: process.stdin, output: process.stdout });
return new Promise(resolve => {
rl.question(`安装 ${skill}?(y/n) `, a => {
rl.close();
resolve(a.toLowerCase() === 'y' || a.toLowerCase() === 'yes');
});
});
}
function install(skill) {
try {
execSync(`openclaw skill install ${skill}`, { stdio: 'inherit' });
return true;
} catch (e) {
return false;
}
}
function registerNewSkill(skillName) {
try {
const mdPath = path.join(CONFIG.SKILLS_DIR, skillName, 'SKILL.md');
if (!fs.existsSync(mdPath)) return;
const content = fs.readFileSync(mdPath, 'utf8');
const yamlStart = content.indexOf('---') + 3;
const yamlEnd = content.indexOf('---', yamlStart);
const meta = yaml.load(content.slice(yamlStart, yamlEnd));
// 确定技能分类
let category = '其他 | Others';
const tags = (meta.metadata?.tags || []).concat(meta.triggers || []).map(tag => tag.toLowerCase());
for (const tag of tags) {
if (CATEGORY_MAP[tag]) {
category = CATEGORY_MAP[tag];
break;
}
}
const trig = (meta.triggers || []).join('、');
const line = `| ${skillName} | ${trig} | ${meta.description || skillName} |\n`;
let reg = fs.readFileSync(CONFIG.REGISTRY_PATH, 'utf8');
const catIndex = reg.indexOf(`## ${category}`);
if (catIndex === -1) {
// 如果分类不存在,追加到最后
reg += `\n## ${category}\n\n| Skill | Triggers | Description |\n|-------|----------|-------------|\n${line}`;
} else {
// 找到分类表格的分隔线后插入
const sepIdx = reg.indexOf('|-------|----------|-------------|', catIndex) + '|-------|----------|-------------|'.length;
reg = reg.slice(0, sepIdx + 1) + line + reg.slice(sepIdx + 1);
}
// 更新最后修改时间
reg = reg.replace(/> Last updated: .*/, `> Last updated: ${new Date().toISOString().split('T')[0]}`);
fs.writeFileSync(CONFIG.REGISTRY_PATH, reg, 'utf8');
console.log(`✅ 技能 ${skillName} 已自动注册到分类:${category}`);
} catch (e) {
console.error(`❌ 自动注册技能失败:${e.message}`);
}
}
function run(skill, input) {
try {
execSync(`openclaw skill run ${skill} --input "${input.replace(/"/g, '\\"')}"`, { stdio: 'inherit' });
} catch (e) {
console.error(`❌ 执行技能 ${skill} 失败:${e.message}`);
console.log('🔄 降级到通用能力执行...');
execSync(`openclaw chat --input "${input.replace(/"/g, '\\"')}"`, { stdio: 'inherit' });
}
}
async function main(input) {
console.log('\n📋 一体化技能路由\n');
const local = matchLocalSkill(input);
if (local) {
run(local, input);
return;
}
const remote = searchRemote(input);
if (!remote) {
console.log('🔍 未找到远程技能,使用通用能力执行');
execSync(`openclaw chat --input "${input.replace(/"/g, '\\"')}"`, { stdio: 'inherit' });
return;
}
console.log(`🔍 找到远程技能:${remote}`);
if (!vet(remote)) {
console.log('🛡️ 安全检查不通过,放弃安装');
execSync(`openclaw chat --input "${input.replace(/"/g, '\\"')}"`, { stdio: 'inherit' });
return;
}
const ok = await ask(remote);
if (!ok) {
console.log('👤 用户拒绝安装,使用通用能力执行');
execSync(`openclaw chat --input "${input.replace(/"/g, '\\"')}"`, { stdio: 'inherit' });
return;
}
if (install(remote)) {
registerNewSkill(remote);
run(remote, input);
} else {
console.log('🔄 安装失败,降级到通用能力执行');
execSync(`openclaw chat --input "${input.replace(/"/g, '\\"')}"`, { stdio: 'inherit' });
}
}
if (require.main === module) {
main(process.argv[2] || '测试');
}
module.exports = { main };
```
---
## 五、快速部署 & 使用步骤(开箱即用)
### 1. 环境准备
```bash
# 安装Node.js依赖
npm install js-yaml
# 安装OpenClaw依赖技能
openclaw skill install find-skills-skill
openclaw skill install skill-vetter
openclaw skill install clawdhub
```
### 2. 部署技能包
```bash
# 1. 创建技能目录(已创建可跳过)
mkdir -p /home/user/.super_doubao/super-doubao-runtime/workspace/skills/skill-registry-unified
# 2. 放入所有文件(已放入可跳过)
# 将SKILL.md、registry_unified.js、scan-all-skills.js放入该目录
# 3. 生成初始注册表
node /home/user/.super_doubao/super-doubao-runtime/workspace/skills/skill-registry-unified/scan-all-skills.js
# 4. 注册一体化技能
openclaw skill register /home/user/.super_doubao/super-doubao-runtime/workspace/skills/skill-registry-unified
# 5. 添加全局路由规则(最高优先级)
echo "- 所有用户输入 → 优先执行 skill-registry-unified" >> /home/user/.super_doubao/super-doubao-runtime/workspace/RULES.md
```
### 3. 测试验证
```bash
# 测试本地匹配
openclaw chat --input "帮我做个PPT"
# 测试远程扩展
openclaw chat --input "帮我生成小红书文案"
```
---
## 六、核心总结
1. **细分分类适配**:完全贴合 ClawHub 官方 13 个细分分类,解决原分类过粗、匹配不精准的问题;
2. **自动分类注册**:根据技能 tags 自动归类,无需手动整理注册表;
3. **本地优先匹配**:毫秒级响应,无网络依赖;
4. **安全可控**:强制安全扫描 + 用户确认,避免恶意安装;
5. **全流程自动化**:用户只需输入指令,系统自动完成匹配→搜索→安装→注册→执行。
这套方案无需手动修改任何配置,部署后即可实现「用户输入任意指令,系统自动匹配合适技能并精准分类」的核心需求,同时兼顾安全性和可维护性。
> (注:文档部分内容可能由 AI 生成)
元数据
常见问题
skill-registry-unified 是什么?
一体化技能注册表 - 本地优先匹配,无匹配则自动搜索ClawHub并安全安装,新装技能自动注册到细分分类。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 376 次。
如何安装 skill-registry-unified?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install skill-registry-unified」即可一键安装,无需额外配置。
skill-registry-unified 是免费的吗?
是的,skill-registry-unified 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
skill-registry-unified 支持哪些平台?
skill-registry-unified 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 skill-registry-unified?
由 XV(@xuwei-stream)开发并维护,当前版本 v1.0.2。
推荐 Skills