elevate-skill

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

When 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

操作步骤

  1. Discover local skills: List directories in
    .claude/skills/
    whose name is NOT a key in
    skills-lock.json
    (if it exists). These are locally-authored project skills.
  2. Ask which skill to elevate: Present the list and let the user choose.
  3. Find ai-skills repo: Use
    $AI_SKILLS_REPO
    if set, else try
    ~/projects/camacho/ai-skills
    , else ask the user.
  4. Copy to ai-skills:
    bash
    cp -r .claude/skills/<name> <ai-skills-path>/skills/<name>
    Verify the SKILL.md has correct frontmatter (
    name
    matches folder name).
  5. Commit + push in ai-skills:
    bash
    cd <ai-skills-path>
    git add skills/<name>
    git commit -m "feat: add <name> skill"
    git push
  6. 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
  7. Commit in current project:
    bash
    git add skills-lock.json .claude/skills/
    git commit -m "chore: elevate <name> skill to ai-skills"
  1. 查找本地skill:列出
    .claude/skills/
    目录下,名称不属于
    skills-lock.json
    (若文件存在)键值的目录,这些就是本地编写的项目skill。
  2. 询问要升级的skill:展示本地skill列表供用户选择。
  3. 定位ai-skills仓库:如果设置了
    $AI_SKILLS_REPO
    环境变量则使用对应路径,否则尝试默认路径
    ~/projects/camacho/ai-skills
    ,若两种路径都不可用则询问用户。
  4. 复制到ai-skills仓库:
    bash
    cp -r .claude/skills/<name> <ai-skills-path>/skills/<name>
    验证SKILL.md的前置元数据正确(
    name
    字段与文件夹名称一致)。
  5. 在ai-skills仓库提交并推送代码:
    bash
    cd <ai-skills-path>
    git add skills/<name>
    git commit -m "feat: add <name> skill"
    git push
  6. 删除本地副本并从仓库安装该skill:
    bash
    rm -rf .claude/skills/<name>
    npx skills add <ai-skills-path> --skill <name> -a claude-code -y
  7. 在当前项目提交变更:
    bash
    git add skills-lock.json .claude/skills/
    git commit -m "chore: elevate <name> skill to ai-skills"

Discovery logic

查找逻辑

bash
undefined
bash
undefined

Local 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
undefined
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
undefined