sync-skills

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Overview

概述

Discovers all skills in
dotfiles/.claude/skills/
, then updates two files to stay in sync:
  • dotfiles/.claude/CLAUDE.md
    -- the
    ## Skills
    section
  • dotfiles/hal_dotfiles.json
    -- the
    copies
    entries for skill directories
Finally runs
hal sync
to deploy changes.
扫描
dotfiles/.claude/skills/
目录下的所有技能,然后更新两个文件以保持同步:
  • dotfiles/.claude/CLAUDE.md
    ——
    ## Skills
    章节
  • dotfiles/hal_dotfiles.json
    —— 技能目录对应的
    copies
    条目
最后运行
hal sync
以部署变更。

Instructions

操作步骤

  1. Find the project root: Use Glob to locate
    dotfiles/.claude/skills/*/SKILL.md
    . The project root is the repo containing
    dotfiles/
    .
  2. Read each SKILL.md frontmatter: For every skill found, extract
    name
    and
    description
    from the YAML frontmatter.
  3. Update
    dotfiles/.claude/CLAUDE.md
    :
    • Find the
      ## Skills
      section (starts with
      ## Skills
      heading).
    • Replace everything from
      ## Skills
      up to the next
      ##
      heading (or end of file) with a regenerated list.
    • Include all discovered skills.
    • Format each entry as:
      - \
      /name` -- description`
    • Sort entries alphabetically by name.
    • Keep a blank line after the heading and after the last entry.
  4. Update
    dotfiles/hal_dotfiles.json
    :
    • Read the current file and parse the
      copies
      array.
    • Replace all
      .claude/skills/*
      entries with entries for each discovered skill directory (regardless of
      user-invocable
      ).
    • Format each entry as:
      {"dest": "{{HOME}}/.claude/skills/<name>/", "src": ".claude/skills/<name>/"}
    • Sort skill entries alphabetically by name.
    • Preserve all non-skill entries in
      copies
      (and the entire
      links
      array) exactly as-is.
  5. Run
    hal sync
    to deploy the updated files.
  6. Report what changed: list any skills added or removed from each file.
  1. 定位项目根目录:使用Glob匹配
    dotfiles/.claude/skills/*/SKILL.md
    文件。项目根目录是包含
    dotfiles/
    的代码仓库。
  2. 读取每个SKILL.md的前置元数据:对于找到的每个技能,从YAML前置元数据中提取
    name
    description
    字段。
  3. 更新
    dotfiles/.claude/CLAUDE.md
    :
    • 找到
      ## Skills
      章节(以
      ## Skills
      标题开头)。
    • ## Skills
      到下一个
      ##
      标题(或文件末尾)之间的所有内容替换为重新生成的技能列表。
    • 包含所有已发现的技能。
    • 每个条目的格式为:
      - \
      /name` -- 描述`
    • 按名称字母顺序排序条目。
    • 标题后和最后一个条目后保留空行。
  4. 更新
    dotfiles/hal_dotfiles.json
    :
    • 读取当前文件并解析
      copies
      数组。
    • 将所有
      .claude/skills/*
      条目替换为每个已发现技能目录对应的条目(无论是否支持
      user-invocable
      )。
    • 每个条目的格式为:
      {"dest": "{{HOME}}/.claude/skills/<name>/", "src": ".claude/skills/<name>/"}
    • 按名称字母顺序排序技能条目。
    • 完全保留
      copies
      数组中的所有非技能条目以及整个
      links
      数组不变。
  5. **运行
    hal sync
    **以部署更新后的文件。
  6. 报告变更内容:列出每个文件中添加或移除的技能。