
Clawhub Sync
- 60 installs
- 543 repo stars
- Updated August 5, 2026
- cat-xierluo/legal-skills
Batch-sync locally developed skills to the ClawHub platform with gitignore filtering, allowlist control, and incremental or single-skill sync.
About
Publishes locally developed skills to the ClawHub platform in batches with smart .gitignore filtering, allowlist control, and incremental or single-skill sync. A developer uses it to publish skills to ClawHub or check publish status.
- Gitignore-aware filtering and allowlist control
- Incremental and single-skill sync modes
Clawhub Sync by the numbers
- 60 all-time installs (skills.sh)
- Ranked #307 of 782 Skill Development skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/cat-xierluo/legal-skills --skill clawhub-syncAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 60 |
|---|---|
| repo stars | ★ 543 |
| Last updated | August 5, 2026 |
| Repository | cat-xierluo/legal-skills ↗ |
What it does
Batch-sync locally developed skills to the ClawHub platform with gitignore filtering, allowlist control, and incremental or single-skill sync.
Files
ClawHub 同步工具
将本地开发的 Skills 批量同步到 ClawHub 平台。支持读取 .gitignore 智能忽略敏感文件和临时文件。
⚠️ ClawHub 许可证说明
ClawHub 平台强制使用 MIT-0 许可证(无需署名,允许商业使用)。
- MIT 许可证的 skill 可以同步
- CC-BY-NC 等限制性许可证与 MIT-0 冲突,不应同步
>
详见 ClawHub Skill Format
---
前置条件
SKILL.md frontmatter 需包含必要字段:
---
name: skill-name
description: 技能描述
version: "1.0.0" # 推荐但不强制
homepage: https://github.com/cat-xierluo/legal-skills # 自动设置
---使用方式
1. 登录 ClawHub(首次使用)
clawhub login2. 验证发布内容
执行 dry-run 检查配置是否正确,不实际发布:
clawhub sync --dry-run3. 同步技能
同步单个技能:
clawhub sync skills/<skill-name>同步所有技能:
clawhub sync --all注意:--all会受skills/clawhub-sync/config/sync-allowlist.yaml约束。如果存在白名单文件,只同步其中列出的 skill。
交互式选择同步:
用户可以指定要同步的技能列表,我会逐个执行同步命令。
---
单个 Skill 同步工作流
当需要同步指定的 skill(而非全部)时,使用此工作流。
前置检查
1. 检查登录状态
clawhub whoami2. 检查白名单
- 读取
skills/clawhub-sync/config/sync-allowlist.yaml - 确认目标 skill 在白名单中(未被
#注释)
3. 检查许可证
- 读取目标 skill 的 SKILL.md frontmatter 中的
license字段 - 只有 MIT 许可证的 skill 才能同步
- CC-BY-NC 等限制性许可证不应同步
版本检测
比较两个版本号:
| 来源 | 位置 | 格式 |
|---|---|---|
| 新版本 | skills/<skill-name>/SKILL.md frontmatter 的 version | "1.2.0" |
| 已记录版本 | skills/clawhub-sync/config/sync-records.yaml 中的 version | "1.1.0" |
版本比较逻辑(语义化版本):
new_version > recorded_version → 需要同步
new_version == recorded_version → 跳过(无变化)
new_version < recorded_version → 警告(版本回退?)
recorded_version 为 null → 需要同步(首次发布)执行同步
步骤 1:准备发布目录
bash skills/clawhub-sync/scripts/prepare-publish.sh skills/<skill-name>步骤 2:执行发布(使用 publish 命令)
clawhub publish /tmp/clawhub-publish-<skill-name> \
--slug <skill-name> \
--name "<Display Name>" \
--version "<新版本号>" \
--changelog "<变更说明>"⚠️ 必须指定 --slug 和 --name
- 临时目录名可能包含前缀(如 clawhub-publish-),导致发布时 slug 不正确- --slug <skill-name> 确保使用正确的 skill 标识符- --name "<Display Name>" 确保在 ClawHub 上显示正确的名称为什么用 `publish` 而不是 `sync`?
- clawhub sync 会扫描所有目录的 skills,可能遇到 slug 冲突- clawhub publish <path> 只发布指定路径的单个 skill,更精确步骤 3:更新同步记录
更新 skills/clawhub-sync/config/sync-records.yaml:
<skill-name>:
version: "<新版本号>"
last_sync: "<ISO 8601 时间>"
git_hash: "<当前 commit hash>"
status: synced
changelog_summary: "<变更说明>"
url: "https://clawhub.ai/skills/<skill-name>"
publish_id: "<从命令输出获取>"示例:同步 git-batch-commit
# 1. 检查白名单
grep "git-batch-commit:" skills/clawhub-sync/config/sync-allowlist.yaml
# 输出:git-batch-commit: # MIT
# 2. 比较版本
# SKILL.md: version: "1.2.0"
# sync-records.yaml: version: "1.1.0"
# 结论:1.2.0 > 1.1.0,需要同步
# 3. 准备发布
bash skills/clawhub-sync/scripts/prepare-publish.sh skills/git-batch-commit
# 4. 执行发布(使用 publish 命令)
clawhub publish /tmp/clawhub-publish-git-batch-commit \
--version "1.2.0" \
--changelog "添加 ClawHub 同步工作流"
# 5. 更新记录
# 编辑 sync-records.yaml,更新 git-batch-commit 条目失败处理
- 同步失败时记录
status: failed - 不重试,让用户决定后续操作
- 记录失败原因到
changelog_summary
---
同步策略
版本号处理
- 从技能的
CHANGELOG.md第一行提取版本号 - 格式要求:
## [x.y.z] - YYYY-MM-DD - 自动处理
v前缀(v1.0.0→1.0.0)
自动字段
| 字段 | 处理方式 |
|---|---|
homepage | 自动设置为 GitHub 仓库地址 |
version | 从 CHANGELOG.md 提取(如 SKILL.md 中未指定) |
同步范围控制(白名单机制)
配置文件: skills/clawhub-sync/config/sync-allowlist.yaml(skill 自包含)
优先级:白名单 > 默认忽略规则
- 如果
skills/clawhub-sync/config/sync-allowlist.yaml存在:只同步文件中列出的 skill - 如果
skills/clawhub-sync/config/sync-allowlist.yaml不存在:使用默认忽略规则(忽略 test/、private-skills/、node_modules/)
配置格式:
# legal-qa-extractor: # 带 # 表示不发布
legal-qa-extractor: # 无 # 表示发布
litigation-analysis:配置文件: skills/clawhub-sync/sync-allowlist.yaml(skill 自包含)
文件过滤规则
发布时会自动应用 .gitignore 过滤规则,确保敏感文件和临时文件不会被上传。
双重过滤机制:
1. 项目根目录 .gitignore - 自动检测 Git 仓库根目录的 .gitignore 2. 技能内部 .gitignore - 如果技能目录有自己的 .gitignore,会额外应用
默认排除(始终生效):
.git/- Git 目录node_modules/- Node.js 依赖__pycache__/- Python 缓存.DS_Store- macOS 系统文件
同步流程
每次同步前,会自动:
1. 创建临时目录 - 在 /tmp/clawhub-publish-<skill-name> 创建临时目录 2. 复制过滤后的文件 - 使用 rsync 遵循 .gitignore 规则复制文件 3. 发布到 ClawHub - 从临时目录执行发布命令 4. 清理临时目录 - 发布完成后自动清理
手动准备发布目录
如需手动检查将要发布的文件:
# 准备发布目录(不实际发布)
bash skills/clawhub-sync/scripts/prepare-publish.sh skills/trademark-assistant
# 检查临时目录内容
ls -la /tmp/clawhub-publish-trademark-assistant/安全最佳实践
发布前检查清单
- [ ] 确认
.gitignore包含所有敏感文件模式 - [ ] 使用
prepare-publish.sh检查将要发布的文件 - [ ] 不要在技能中包含 API keys、密码等
- [ ] 使用
.env.example代替.env文件
常见敏感文件
.env- 环境变量(使用.env.example作为模板)config.yaml- 配置文件(使用config.example.yaml作为模板)*.db,*.sqlite- 数据库文件logs/- 日志目录downloads/,output/- 输出目录
修复已发布的技能
如果发现已发布的技能包含敏感信息:
1. 立即更新 - 从技能目录中删除敏感文件 2. 更新 .gitignore - 确保未来不会再次包含 3. 重新发布 - 使用 clawnet publish 更新 ClawHub 上的技能 4. 联系 ClawHub 支持 - 如果需要删除旧版本
重要提醒:
- ClawHub 是公开平台:发布的技能任何人都可以访问
- 不要包含客户信息:案例文件、沟通记录等应排除
- 不要包含凭证:API keys、tokens 等应使用环境变量
常见问题
版本号未更新?
检查 CHANGELOG.md 格式:
## [1.0.0] - 2026-03-21
### 新增
- 新功能描述同步失败?
1. 运行 clawhub sync --dry-run 检查配置 2. 确认 SKILL.md frontmatter 格式正确 3. 检查登录状态:clawhub whoami
输入/输出
输入
- 必需:本地开发的 skill 目录
- 可选:指定技能名称列表、白名单配置
输出
- 同步结果报告(成功/失败列表)
- 错误信息(如有)
同步记录
每次同步后,会更新 config/sync-records.yaml 记录文件,便于溯源和增量同步。
记录字段
| 字段 | 说明 |
|---|---|
version | 同步时的版本号 |
last_sync | 最后同步时间 (ISO 8601) |
git_hash | 同步时的 commit hash |
status | synced / pending / failed |
changelog_summary | 变更摘要 |
url | ClawHub 发布地址 |
publish_id | ClawHub 内部 ID |
记录示例
trademark-assistant:
version: "1.5.0"
last_sync: "2026-03-24T16:42:00+08:00"
git_hash: "f5f0726"
status: synced
changelog_summary: "新增商标说明撰写、图形商标分析、商品清单生成"
url: "https://clawhub.ai/skills/trademark-assistant"
publish_id: "k97fmhvcnrh1tn2msya98nbxxd83gspe"用途
1. 增量同步:只同步 status: pending 或版本更新的 skill 2. 溯源:通过 git_hash 追溯发布时的代码状态 3. 快速访问:通过 url 直接访问 ClawHub 上的 skill 页面
[1.4.2] - 2026-06-12
变更
- 同步示例配置:将
skill-architect发布记录和白名单入口更新为skill-lint。
[1.4.1] - 2026-03-26
修复
- 发布命令添加
--slug参数:避免临时目录名导致的 slug 错误 - 发布命令添加
--name参数:确保 ClawHub 显示正确的名称 - 删除错误命名的 skills:
clawhub-publish-clawhub-sync、clawhub-publish-git-batch-commit
[1.4.0] - 2026-03-26
新增
- SKILL.md 新增「单个 Skill 同步工作流」章节
- 支持版本号检测:比较 SKILL.md frontmatter 与 sync-records.yaml 中的版本
- 支持前置检查:登录状态、白名单、许可证验证
- 支持增量同步:只同步版本号有更新的 skill
变更
- description 更新,增加「单个 skill 同步」功能说明
- 改用 `clawhub publish` 命令:避免
clawhub sync扫描其他目录导致的 slug 冲突
[1.3.0] - 2026-03-24
新增
- SKILL.md 新增「ClawHub 许可证政策」章节,详细说明 MIT-0 与其他许可证的兼容性
- 添加许可证兼容性对照表(MIT-0 vs CC-BY-NC)
- sync-allowlist.yaml 添加许可证标注,区分可同步/不可同步的 skill
变更
- 白名单中注释掉 CC-BY-NC 许可证的 skill(legal-*, patent-analysis, trademark-assistant 等)
- 仅保留 MIT 许可证的 skill 为可同步状态
删除
- 从 ClawHub 删除 trademark-assistant(许可证冲突)
[1.2.0] - 2026-03-24
新增
- 添加
scripts/prepare-publish.sh发布目录准备脚本 - 支持 .gitignore 双重过滤机制(项目根目录 + 技能内部)
- 使用 rsync 过滤敏感文件,- 添加安全最佳实践指南
[1.1.1] - 2026-03-23
变更
- 白名单配置文件迁移至 skill 内部(自包含)
- 配置路径:
.clawhub/sync-allowlist.yaml→skills/clawhub-sync/sync-allowlist.yaml - 配置路径:
.clawhub/sync-allowlist.yaml.example→skills/clawhub-sync/sync-allowlist.yaml.example - SKILL.md 文档路径同步更新
[1.1.0] - 2026-03-23
新增
- 支持
.clawhub/sync-allowlist.yaml白名单配置 - 批量同步时只同步白名单中列出的 skill
- 未列出的 skill 不会被同步(精确控制发布内容)
- 提供
sync-allowlist.yaml.example模板参考
变更
- 同步策略优先级:白名单文件存在时 > 默认忽略规则
[1.0.0] - 2026-03-21
新增
- 初版发布
- 支持登录、验证、同步单个/批量技能
- 版本号自动从 CHANGELOG.md 提取
- 自动设置 homepage 字段
- 忽略 test/、private-skills/ 等目录
# ClawHub 同步白名单配置文件
# 只同步这里列出的 skill,未列出的不会被同步
# 格式:skill 目录名(与 skills/ 下的目录名一致)
# 如需启用某个 skill,删除其所在行开头的 #
# ===== 法律相关 =====
legal-qa-extractor:
legal-text-format:
litigation-analysis:
legal-proposal-generator:
patent-analysis:
trademark-assistant:
# ===== 文档处理 =====
md2word:
mineru-ocr:
piclist-upload:
de-ai-polish:
# ===== 搜索与研究 =====
multi-search:
repo-research:
# ===== 媒体处理 =====
svg-article-illustrator:
funasr-transcribe:
wechat-article-fetch:
# ===== 效率工具 =====
skill-lint:
skill-manager:
git-batch-commit:
# ===== 暂不发布 =====
# 使用 # 注释掉不想发布的 skill
# clawhub-sync:
# douyin-batch-download:
# universal-media-downloader:
# minimax-web-search:
# minimax-image-understand:
# course-generator:
# agent-reach:
# github-star-manager:
# ClawHub 同步记录
# 记录每次同步的 skill 状态、版本和 git 信息
#
# 字段说明:
# version: 同步时的版本号
# last_sync: 最后同步时间 (ISO 8601)
# git_hash: 同步时的 commit hash
# status: synced / pending / failed
# changelog_summary: 变更摘要
# url: ClawHub 发布地址
# publish_id: ClawHub 内部 ID
records:
# ===== 法律相关 =====
legal-qa-extractor:
version: null
last_sync: null
git_hash: null
status: pending
changelog_summary: null
url: null
publish_id: null
litigation-analysis:
version: null
last_sync: null
git_hash: null
status: pending
changelog_summary: null
url: null
publish_id: null
trademark-assistant:
version: "1.5.0"
last_sync: "2026-03-24T16:42:00+08:00"
git_hash: "f5f0726"
status: synced
changelog_summary: "新增商标说明撰写、图形商标分析、商品清单生成、申请材料归档功能"
url: "https://clawhub.ai/skills/trademark-assistant"
publish_id: "k97fmhvcnrh1tn2msya98nbxxd83gspe"
# ===== 文档处理 =====
md2word:
version: null
last_sync: null
git_hash: null
status: pending
changelog_summary: null
url: null
publish_id: null
# ===== 效率工具 =====
skill-lint:
version: null
last_sync: null
git_hash: null
status: pending
changelog_summary: null
url: null
publish_id: null
MIT License
Copyright (c) 2025 杨卫薪律师(微信ywxlaw)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
#!/bin/bash
# prepare-publish.sh - 准备技能发布目录
# 用法: prepare-publish.sh <skill-path>
#
# 此脚本创建一个临时目录,只包含符合 .gitignore 规则的文件,
# 用于 ClawHub CLI 发布。
#
# 过滤规则(双重过滤):
# 1. 项目根目录的 .gitignore(如果存在)
# 2. 技能内部的 .gitignore(如果存在)
#
# 参数:
# skill-path - 技能目录路径(相对或绝对路径)
#
# 输出:
# 临时目录路径
set -e
# 颜色定义
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# 帮助信息
usage() {
echo "用法: prepare-publish.sh <skill-path>"
echo ""
echo "参数:"
echo " skill-path - 技能目录路径(相对或绝对路径)"
echo ""
echo "功能:"
echo " 创建临时目录用于 ClawHub 发布,自动应用 .gitignore 过滤规则。"
echo ""
echo "过滤规则(双重过滤):"
echo " 1. 项目根目录的 .gitignore(自动检测)"
echo " 2. 技能内部的 .gitignore(如果存在)"
echo ""
echo "示例:"
echo " prepare-publish.sh skills/trademark-assistant"
echo " prepare-publish.sh /path/to/skills/trademark-assistant"
exit 1
}
# 检查参数
if [ -z "$1" ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
usage
fi
SKILL_PATH="$1"
# 转换为绝对路径
if [ "${SKILL_PATH:0:1}" != "/" ]; then
SKILL_PATH="$(cd "$(dirname "$SKILL_PATH")" 2>/dev/null && pwd)/$(basename "$SKILL_PATH")"
fi
# 检查技能目录是否存在
if [ ! -d "$SKILL_PATH" ]; then
echo -e "${RED}错误: 技能目录不存在: $SKILL_PATH${NC}"
exit 1
fi
# 检查 SKILL.md 是否存在
if [ ! -f "$SKILL_PATH/SKILL.md" ] && [ ! -f "$SKILL_PATH/skill.md" ]; then
echo -e "${RED}错误: 技能目录中未找到 SKILL.md: $SKILL_PATH${NC}"
exit 1
fi
# 获取技能名称
SKILL_NAME=$(basename "$SKILL_PATH")
# 确定项目根目录(从技能路径向上查找包含 .git 的目录)
PROJECT_ROOT=""
CURRENT_DIR="$SKILL_PATH"
while [ "$CURRENT_DIR" != "/" ]; do
if [ -d "$CURRENT_DIR/.git" ]; then
PROJECT_ROOT="$CURRENT_DIR"
break
fi
CURRENT_DIR=$(dirname "$CURRENT_DIR")
done
if [ -z "$PROJECT_ROOT" ]; then
echo -e "${YELLOW}警告: 未找到 Git 仓库根目录,将只使用技能内部的 .gitignore${NC}"
fi
# 创建临时目录
TEMP_DIR="/tmp/clawhub-publish-$SKILL_NAME"
echo -e "${GREEN}准备发布目录: $TEMP_DIR${NC}"
# 清理旧的临时目录
rm -rf "$TEMP_DIR"
# 构建 rsync 参数
RSYNC_ARGS=(
-av # 归档模式,显示详细信息
--delete # 删除目标目录中多余的文件
--exclude='.git/' # 排除 Git 目录
--exclude='node_modules/' # 排除 node_modules
--exclude='__pycache__/' # 排除 Python 缓存
--exclude='.DS_Store' # 排除 macOS 系统文件
--exclude='**/.env' # 排除环境变量文件(防止凭证泄露)
--exclude='**/*.db' # 排除数据库文件
--exclude='**/*.sqlite' # 排除 SQLite 文件
--exclude='**/logs/' # 排除日志目录
--exclude='**/output/' # 排除输出目录
--exclude='**/downloads/' # 排除下载目录
--exclude='**/archive/' # 排除运行时缓存目录
)
# 检查项目根目录的 .gitignore
PROJECT_GITIGNORE=""
if [ -n "$PROJECT_ROOT" ] && [ -f "$PROJECT_ROOT/.gitignore" ]; then
PROJECT_GITIGNORE="$PROJECT_ROOT/.gitignore"
echo -e "${BLUE}[1] 使用项目根目录 .gitignore: $PROJECT_GITIGNORE${NC}"
fi
# 检查技能内部的 .gitignore
SKILL_GITIGNORE=""
if [ -f "$SKILL_PATH/.gitignore" ]; then
SKILL_GITIGNORE="$SKILL_PATH/.gitignore"
echo -e "${BLUE}[2] 使用技能内部 .gitignore: $SKILL_GITIGNORE${NC}"
fi
# 应用过滤规则
# 优先使用 git ls-files(100% 精确匹配 Git 追踪状态,避免 rsync 解析 gitignore 不完整导致敏感文件泄露)
# 仅在非 Git 环境下回退到 rsync + 硬编码排除规则
if [ -n "$PROJECT_ROOT" ]; then
RELATIVE_PATH="${SKILL_PATH#$PROJECT_ROOT/}"
RELATIVE_PATH="${RELATIVE_PATH%/}"
echo -e "${GREEN}复制文件到临时目录(git ls-files 模式)...${NC}"
COPIED=0
while IFS= read -r -d '' FILE; do
DEST="${FILE#$RELATIVE_PATH/}"
DEST_DIR="$TEMP_DIR/$(dirname "$DEST")"
mkdir -p "$DEST_DIR"
cp "$PROJECT_ROOT/$FILE" "$TEMP_DIR/$DEST"
COPIED=$((COPIED + 1))
done < <(cd "$PROJECT_ROOT" && git ls-files -z -- "$RELATIVE_PATH")
if [ "$COPIED" -eq 0 ]; then
echo -e "${RED}错误: git ls-files 未返回任何文件,确认技能已提交${NC}"
exit 1
fi
echo -e "${GREEN}已复制 $COPIED 个文件到临时目录${NC}"
else
if [ -n "$PROJECT_GITIGNORE" ] || [ -n "$SKILL_GITIGNORE" ]; then
[ -n "$PROJECT_GITIGNORE" ] && RSYNC_ARGS+=(--filter=":- $PROJECT_GITIGNORE")
[ -n "$SKILL_GITIGNORE" ] && RSYNC_ARGS+=(--filter=":- $SKILL_GITIGNORE")
else
echo -e "${YELLOW}警告: 未找到任何 .gitignore 文件,将只排除默认目录${NC}"
fi
echo -e "${GREEN}复制文件到临时目录(rsync 模式)...${NC}"
rsync "${RSYNC_ARGS[@]}" "$SKILL_PATH/" "$TEMP_DIR/"
fi
# 强制清理 rsync 可能遗漏的运行时目录(.gitignore 路径相对于项目根时 rsync 无法匹配)
for _DIR in archive output downloads logs; do
[ -d "$TEMP_DIR/$_DIR" ] && rm -rf "$TEMP_DIR/$_DIR" && echo -e "${YELLOW}强制移除: $_DIR/${NC}"
done
# 统计文件数量
FILE_COUNT=$(find "$TEMP_DIR" -type f | wc -l | tr -d ' ')
echo -e "${GREEN}已复制 $FILE_COUNT 个文件到临时目录${NC}"
# 列出被排除的重要文件类型(用于验证)
echo ""
echo -e "${BLUE}=== 临时目录内容预览 ===${NC}"
ls -la "$TEMP_DIR" | head -20
# 输出临时目录路径(最后一行)
echo ""
echo "$TEMP_DIR"