我的 Skill
sync-skill-to-claude
将 Codex Skill 转换为 Claude 可识别的 Skill,并生成可上传的安装包。
- 同步到 Claude Desktop
- 导出 Skill
- 生成 Claude 安装包
把它带到你的 Codex。
执行前需在本机配置 gitlab-personal SSH 身份,并拥有私有仓库访问权限。
显示安装命令
set -euo pipefail
skill_name='sync-skill-to-claude'
source_url='git@gitlab-personal:seven-grove/tools/personal-codex-skills.git'
source_ref='854e8cc87916742fc7cef130b8263342af8614f6'
source_subdirectory='skills/sync-skill-to-claude'
temp_root=$(mktemp -d)
backup_root="${CODEX_HOME:-$HOME/.codex}/skills-backups"
target_root="${CODEX_HOME:-$HOME/.codex}/skills"
backup_path=""
install_complete="0"
restore_previous() {
if [ "$install_complete" != "1" ]; then
rm -rf "$target_root/$skill_name"
if [ -n "$backup_path" ] && [ -d "$backup_path" ]; then
mv "$backup_path" "$target_root/$skill_name"
fi
fi
}
cleanup() { rm -rf "$temp_root"; }
trap 'restore_previous; cleanup' EXIT
git clone --filter=blob:none --no-checkout "$source_url" "$temp_root/repo"
git -C "$temp_root/repo" checkout "$source_ref" -- "$source_subdirectory"
test -f "$temp_root/repo/$source_subdirectory/SKILL.md"
mkdir -p "$target_root" "$backup_root"
if [ -e "$target_root/$skill_name" ]; then
backup_path="$backup_root/$skill_name-$(date +%Y%m%d-%H%M%S)"
mv "$target_root/$skill_name" "$backup_path"
fi
cp -R "$temp_root/repo/$source_subdirectory" "$target_root/$skill_name"
test -f "$target_root/$skill_name/SKILL.md"
install_complete="1"
printf 'Installed %s\n' "$target_root/$skill_name"
if [ -n "$backup_path" ]; then printf 'Backup %s\n' "$backup_path"; fi