Install
openclaw skills install marila-skill-publish用于发布和更新 OpenClaw 技能到 ClawHub,并同步 GitHub Release。用户提到“发布技能”“发到 ClawHub”“发布这个 skill”“写完就发布”“上线这个技能”等场景时使用。包含完整发布步骤、版本规范、发布前检查清单、GitHub Release 同步规则和常见问题处理。
openclaw skills install marila-skill-publish本文档总结了从 0 到发布一个 ClawHub 技能的完整流程和经验。
clawhub CLI (npm install -g clawhub)gh)先检查命令是否存在:
which git
which gh
which clawhub
如果缺命令:
# macOS(推荐)
brew install git gh
npm install -g clawhub
# Ubuntu / Debian
sudo apt update
sudo apt install -y git gh
npm install -g clawhub
验证:
git --version
gh --version
clawhub --version
如果用户还没登录 GitHub,先做这个:
# 登录 GitHub CLI
gh auth login
# 验证登录状态
gh auth status
如果用户本机 Git 还没初始化身份,先配置:
git config --global user.name "你的名字"
git config --global user.email "you@example.com"
如果仓库还没绑远程:
git remote add origin https://github.com/<user>/<repo>.git
# 或
# git remote add origin git@github.com:<user>/<repo>.git
发布前最少确认这 4 件事:
git status
git remote -v
gh auth status
clawhub whoami
发布前,先检查 references/clawhub-review-checklist.md,确认元数据、README、脚本行为、凭证声明和示例参数已经一致。
SKILL.md 和 package.json 的 version 字段requires.bins / requires.env / primaryEnv / 本地文件行为说明git add -A && git commit && git push,然后 gh release create v0.x.x --title "v0.x.x" --notes "..."clawhub publish <路径> --slug <名> --version x.x.x --changelog "..."cp <技能目录>/SKILL.md ~/.openclaw/workspace/skills/技能名/SKILL.md硬规则: 以后凡是发布 OpenClaw 技能,每次 ClawHub 发布都必须同步创建对应的 GitHub Release。不允许只发技能不发 release。
新增硬规则: 发布前必须过一遍 references/clawhub-review-checklist.md。尤其是带脚本、凭证、工作区文件读写的技能,不检查就发,极容易被 ClawHub 审核打回。
敏感操作提示: 同步到 ~/.openclaw/workspace/skills 属于对 agent 工作区的写操作,只应在受信任环境中显式执行,不应在公共或不受信任场景下默认执行。
# 创建技能目录
mkdir -p ~/my-skill
cd ~/my-skill
# 初始化 Git
git init
---
name: my-skill
description: 简短描述技能功能
version: 1.0.0
metadata:
openclaw:
requires:
env:
- MY_API_KEY
bins:
- curl
primaryEnv: MY_API_KEY
homepage: https://github.com/username/my-skill
---
# 技能说明文档
## 功能描述
...
## 使用方法
...
⚠️ 关键:元数据必须准确声明
ClawHub 安全分析会检查声明与实际代码是否一致:
requires.env - 代码中引用的所有环境变量requires.bins - 代码中调用的所有 CLI 工具primaryEnv - 主要凭证变量名{
"name": "my-skill",
"version": "1.0.0",
"description": "技能描述",
"repository": {
"type": "git",
"url": "https://github.com/username/my-skill.git"
},
"clawhub": {
"requiresBinaries": ["curl"],
"credentials": [
{
"name": "MY_API_KEY",
"description": "API 密钥说明",
"docs": "https://example.com/docs"
}
]
}
}
# my-skill
简短介绍。
## 安装
```bash
clawhub install my-skill
...
#### CHANGELOG.md
```markdown
# Changelog
## [1.0.0] - 2026-02-27
### 新增
- 初始版本
git add -A
git commit -m "Initial commit"
git remote add origin https://github.com/username/my-skill.git
git push -u origin main
# 方式一:直接发布
clawhub publish . --slug my-skill --name "My Skill" --version 1.0.0 --changelog "初始版本"
# 方式二:使用 sync(推荐)
clawhub sync
# 检查技能信息
clawhub inspect my-skill
# 查看网页
open https://clawhub.ai/username/my-skill
fetch failed 错误症状:
✖ fetch failed
Error: fetch failed
原因: 网络问题、服务端暂时不可达或本机登录状态异常
解决:
# 检查网络连接
curl -I https://clawhub.ai
# 重新登录
clawhub login
clawhub whoami
SKILL.md required 错误症状:
Error: SKILL.md required
原因:
SKILL.md 或 skill.md)解决:
ls -la SKILL.md
pwd
clawhub publish /absolute/path/to/skill --slug my-skill ...
症状:
✖ Timeout
Error: Timeout
原因: 服务器响应慢或网络问题
解决:
# 检查服务器状态
curl -I https://clawhub.ai
# 重试发布
clawhub publish . --slug my-skill ...
# 或使用 sync
clawhub sync
症状: 审核反馈 "metadata mismatch"
原因: SKILL.md frontmatter 声明与实际代码不符
解决: 确保 frontmatter 准确声明:
---
name: my-skill
version: 1.0.0
metadata:
openclaw:
requires:
env:
- ACTUAL_ENV_VAR_USED_IN_CODE
bins:
- actual_binary_used_in_code
primaryEnv: ACTUAL_ENV_VAR_USED_IN_CODE
homepage: https://github.com/username/repo
---
症状:
- Verifying token
✖ fetch failed
解决:
# 重新登录
clawhub login
clawhub whoami
# 如仍失败,在受信任环境中人工检查本机 ClawHub 登录状态
gh release create 或 git push 失败常见原因:
ghuser.name / user.emailorigin排查顺序:
which gh
gh auth status
git config --global --get user.name
git config --global --get user.email
git remote -v
解决:
# 安装 gh
brew install gh
# 登录 GitHub
gh auth login
# 配置 Git 身份
git config --global user.name "你的名字"
git config --global user.email "you@example.com"
# 补 remote
git remote add origin https://github.com/<user>/<repo>.git
SKILL.md required / acceptLicenseTerms: invalid value症状 1:
Error: SKILL.md required
先判断:
SKILL.md,那就是路径或文件问题SKILL.md,但后续又报 acceptLicenseTerms: invalid value,那真正的问题通常不是技能文件缺失,而是 ClawHub CLI 与服务端 publish payload 兼容有坑症状 2:
Publish payload: acceptLicenseTerms: invalid value
结论:
clawhub publishpwd
ls -la
sed -n '1,20p' SKILL.md
clawhub whoami
SKILL.md 存在、登录正常,基本可判定为 CLI publish payload bug,而不是技能目录缺文件兜底方案(实测可用):
git push 和 gh release create~/Library/Application Support/clawhub/config.jsonhttps://clawhub.ai/api/v1/skills 发 multipart/form-data 请求:
payload 内显式带:slug、displayName、version、changelog、tags、acceptLicenseTerms: truefiles 上传clawhub inspect <slug> 验证最新版本规则更新:
acceptLicenseTerms: invalid value,默认按 CLI bug 排查,不再把时间浪费在反复重试上典型反馈:
高频遗漏项:
requires.binsrequires.envprimaryEnvpackage.json 里的 requiresBinaries / requiredEnv / credentials处理顺序:
SKILL.md frontmatterpackage.jsongit push → gh release create → ClawHub publish硬规则:
# 1. 更新版本号
# 修改 SKILL.md frontmatter 中的 version
# 修改 package.json 中的 version
# 2. 更新 CHANGELOG.md
# 在顶部添加新版本记录
# 3. 提交并推送
git add -A
git commit -m "chore: bump version to 1.0.1"
git push
# 4. 先发 GitHub Release(必做)
gh release create v1.0.1 --title "v1.0.1" --notes "修复 xxx"
# 5. 再发布新版本到 ClawHub
clawhub publish . --slug my-skill --version 1.0.1 --changelog "修复 xxx"
# 或使用 sync(前提:GitHub Release 也要同步创建)
clawhub sync
凭证安全
mcporter config 存储.gitignore 中排除敏感文件脚本审查
元数据准确性
最后更新:2026-02-27 作者:马锐拉 (@aliramw)