elevate-skill
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWhen to invoke
何时调用
- User wants to share a project-local skill with other repos
- User says "elevate skill", "share this skill", "move skill to ai-skills"
- 用户希望将项目本地的skill共享给其他仓库使用
- 用户说出「elevate skill」、「share this skill」、「move skill to ai-skills」等表述
Steps
操作步骤
-
Discover local skills: List directories inwhose name is NOT a key in
.claude/skills/(if it exists). These are locally-authored project skills.skills-lock.json -
Ask which skill to elevate: Present the list and let the user choose.
-
Find ai-skills repo: Useif set, else try
$AI_SKILLS_REPO, else ask the user.~/projects/camacho/ai-skills -
Copy to ai-skills:bash
cp -r .claude/skills/<name> <ai-skills-path>/skills/<name>Verify the SKILL.md has correct frontmatter (matches folder name).name -
Commit + push in ai-skills:bash
cd <ai-skills-path> git add skills/<name> git commit -m "feat: add <name> skill" git push -
Remove local copy and install from repo:bash
rm -rf .claude/skills/<name> npx skills add <ai-skills-path> --skill <name> -a claude-code -y -
Commit in current project:bash
git add skills-lock.json .claude/skills/ git commit -m "chore: elevate <name> skill to ai-skills"
-
查找本地skill:列出目录下,名称不属于
.claude/skills/(若文件存在)键值的目录,这些就是本地编写的项目skill。skills-lock.json -
询问要升级的skill:展示本地skill列表供用户选择。
-
定位ai-skills仓库:如果设置了环境变量则使用对应路径,否则尝试默认路径
$AI_SKILLS_REPO,若两种路径都不可用则询问用户。~/projects/camacho/ai-skills -
复制到ai-skills仓库:bash
cp -r .claude/skills/<name> <ai-skills-path>/skills/<name>验证SKILL.md的前置元数据正确(字段与文件夹名称一致)。name -
在ai-skills仓库提交并推送代码:bash
cd <ai-skills-path> git add skills/<name> git commit -m "feat: add <name> skill" git push -
删除本地副本并从仓库安装该skill:bash
rm -rf .claude/skills/<name> npx skills add <ai-skills-path> --skill <name> -a claude-code -y -
在当前项目提交变更:bash
git add skills-lock.json .claude/skills/ git commit -m "chore: elevate <name> skill to ai-skills"
Discovery logic
查找逻辑
bash
undefinedbash
undefinedLocal skills = dirs in .claude/skills/ NOT tracked by lockfile
Local skills = dirs in .claude/skills/ NOT tracked by lockfile
if [ -f skills-lock.json ]; then
LOCKED=$(python3 -c "import json; print(' '.join(json.load(open('skills-lock.json'))['skills'].keys()))")
fi
for dir in .claude/skills/*/; do
name=$(basename "$dir")
if ! echo "$LOCKED" | grep -qw "$name"; then
echo "$name (local)"
fi
done
undefinedif [ -f skills-lock.json ]; then
LOCKED=$(python3 -c "import json; print(' '.join(json.load(open('skills-lock.json'))['skills'].keys()))")
fi
for dir in .claude/skills/*/; do
name=$(basename "$dir")
if ! echo "$LOCKED" | grep -qw "$name"; then
echo "$name (local)"
fi
done
undefined