skill-inventory-auditor
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSkill Inventory Auditor
技能清单审计工具
Find and remove duplicate skills across installed skill directories.
查找并移除已安装技能目录中的重复技能。
Repo Sync Before Edits (mandatory)
编辑前同步仓库(必填)
Before removing skills from git-tracked directories, sync the current branch with remote:
bash
branch="$(git rev-parse --abbrev-ref HEAD)"
git fetch origin
git pull --rebase origin "$branch"If the working tree is not clean, stash first, sync, then restore:
bash
git stash push -u -m "pre-sync"
branch="$(git rev-parse --abbrev-ref HEAD)"
git fetch origin && git pull --rebase origin "$branch"
git stash popIf is missing, pull is unavailable, or rebase/stash conflicts occur, stop and ask the user before continuing.
origin从Git跟踪的目录中移除技能前,请将当前分支与远程仓库同步:
bash
branch="$(git rev-parse --abbrev-ref HEAD)"
git fetch origin
git pull --rebase origin "$branch"如果工作树未清理,请先暂存,同步后再恢复:
bash
git stash push -u -m "pre-sync"
branch="$(git rev-parse --abbrev-ref HEAD)"
git fetch origin && git pull --rebase origin "$branch"
git stash pop如果缺少、无法拉取或出现变基/暂存冲突,请停止操作并询问用户后再继续。
originWorkflow
工作流程
Phase 1: Scan
阶段1:扫描
Run the duplicate scanner with scope (default) unless the user specifies otherwise:
bothbash
python3 {SKILL_DIR}/scripts/scan_inventory.py --scope both --project-dir {cwd}Scopes: (, ), (), or .
global~/.claude/skills/~/.agents/skills/project.claude/skills/bothParse the JSON output. If the script fails, report the error and stop.
使用默认的范围运行重复项扫描器,除非用户指定其他范围:
bothbash
python3 {SKILL_DIR}/scripts/scan_inventory.py --scope both --project-dir {cwd}范围选项:(、)、()或。
global~/.claude/skills/~/.agents/skills/project.claude/skills/both解析JSON输出。如果脚本运行失败,报告错误并停止操作。
Phase 2: Report Duplicates
阶段2:报告重复项
If no duplicates are found, say so and stop.
For each duplicate group:
- Present a table with skill name, location, version, and description excerpt
- Show the similarity score between descriptions
- Explain why they were flagged (same name or similar description)
- Recommend which to keep based on:
- Higher version number
- More descriptive name
- Richer feature set (more scripts/files)
- Location preference (project-local skills may override global)
Ask the user which skills to keep/remove for each group. Wait for confirmation.
如果未找到重复项,告知用户并停止操作。
对于每个重复组:
- 展示包含技能名称、位置、版本和描述摘要的表格
- 显示描述之间的相似度得分
- 说明标记为重复项的原因(名称相同或描述相似)
- 根据以下因素推荐保留哪一个:
- 更高的版本号
- 更具描述性的名称
- 更丰富的功能集(更多脚本/文件)
- 位置偏好(项目本地技能可能覆盖全局技能)
询问用户每个组中保留/移除哪些技能,等待确认。
Phase 3: Remove Duplicates
阶段3:移除重复项
Present a summary of planned removals, then ask for confirmation.
Symlink removal (preserves the source):
bash
rm {symlink_path}Directory removal:
bash
rm -rf {directory_path}Safety rules:
- Always confirm before executing removals
- Print exactly what will be deleted
- Never remove skills from the project source repository (e.g., in a git repo)
skills/ - When removing a symlink, only the link is deleted — the source remains intact
After removals, rerun the scanner to verify no duplicates remain.
展示计划移除的摘要,然后请求确认。
移除符号链接(保留源文件):
bash
rm {symlink_path}移除目录:
bash
rm -rf {directory_path}安全规则:
- 执行移除操作前必须确认
- 准确打印将被删除的内容
- 绝不移除项目源仓库中的技能(例如Git仓库中的目录)
skills/ - 移除符号链接时,仅删除链接本身——源文件保持完整
移除完成后,重新运行扫描器以验证无重复项残留。
Expected Output
预期输出
After the audit completes, the skill presents:
Skill Inventory Audit — 2 duplicate group(s) found
Group 1: "release-manager"
| Location | Version | Description excerpt |
|-----------------------------------|---------|----------------------------------|
| ~/.claude/skills/release-manager | 2.3.1 | Automate the full release... |
| .claude/skills/release-manager | 2.1.0 | Complete release automation... |
Recommendation: keep ~/.claude/skills/release-manager (higher version)
Similarity: exact name match
Removed: .claude/skills/release-manager
Rescan: 0 duplicates remaining.审计完成后,技能将展示如下内容:
技能清单审计 — 发现2个重复组
组1: "release-manager"
| 位置 | 版本 | 描述摘要 |
|-------------------------------|--------|-----------------------------------|
| ~/.claude/skills/release-manager | 2.3.1 | 自动化完整发布流程... |
| .claude/skills/release-manager | 2.1.0 | 完整的发布自动化... |
推荐保留: ~/.claude/skills/release-manager(版本更高)
相似度: 名称完全匹配
已移除: .claude/skills/release-manager
重新扫描: 无重复项残留。Edge Cases
边缘情况
- Symlink pointing to the same source as another entry: Do not flag as a duplicate. The scanner excludes cross-linked entries that resolve to the same path; treat them as a single shared installation.
- Skill with no file: If a directory in a skills folder lacks a
skill.md, skip it during scanning and report it separately as an unrecognized entry. Do not attempt to remove it automatically.skill.md - Scanner script not found: If is missing (e.g., the skill was installed without its scripts), report the missing dependency and stop. Do not attempt to scan manually.
scripts/scan_inventory.py
- 指向同一源的符号链接: 不标记为重复项。扫描器会排除解析到同一路径的交叉链接条目,将其视为单个共享安装。
- 无文件的技能: 如果技能文件夹中的目录缺少
skill.md,扫描时跳过该条目,并单独报告为未识别条目。不要自动尝试移除它。skill.md - 扫描器脚本未找到: 如果缺少(例如技能安装时未包含脚本),报告缺失的依赖项并停止操作。不要尝试手动扫描。
scripts/scan_inventory.py
Acceptance Criteria
验收标准
- All configured skill directories (global and project) are scanned
- Each duplicate group is presented with a table showing location, version, and description excerpt
- A keep/remove recommendation is provided for each group based on version and feature richness
- No skills are removed without explicit user confirmation
- Source repositories are never touched — only installed copies in ,
~/.claude/skills/, or~/.agents/skills/are eligible for removal.claude/skills/ - A rescan is run after removals to confirm zero duplicates remain
- 扫描所有配置的技能目录(全局和项目)
- 每个重复组都展示包含位置、版本和描述摘要的表格
- 根据版本和功能丰富度为每个组提供保留/移除建议
- 未经用户明确确认,绝不移除技能
- 绝不触碰源仓库——仅允许移除、
~/.claude/skills/或~/.agents/skills/中的已安装副本.claude/skills/ - 移除完成后重新扫描,确认无重复项残留
Step Completion Reports
步骤完成报告
After completing each major step, output a status report in this format:
◆ [Step Name] ([step N of M] — [context])
··································································
[Check 1]: √ pass
[Check 2]: √ pass (note if relevant)
[Check 3]: × fail — [reason]
[Check 4]: √ pass
[Criteria]: √ N/M met
____________________________
Result: PASS | FAIL | PARTIALAdapt the check names to match what the step actually validates. Use for pass, for fail, and to add brief context. The "Criteria" line summarizes how many acceptance criteria were met. The "Result" line gives the overall verdict.
√×—完成每个主要步骤后,按以下格式输出状态报告:
◆ [步骤名称] ([第N步/共M步] — [上下文])
··································································
[检查项1]: √ 通过
[检查项2]: √ 通过(如有相关可添加说明)
[检查项3]: × 未通过 — [原因]
[检查项4]: √ 通过
验收标准: √ 已满足N/M项
____________________________
结果: 通过 | 未通过 | 部分通过根据步骤实际验证的内容调整检查项名称。使用表示通过,表示未通过,添加简要上下文。"验收标准"行总结已满足的验收标准数量。"结果"行给出整体结论。
√×—Phase-specific checks
阶段特定检查
Phase 1 — Scan
◆ Scan (step 1 of 3 — inventory collection)
··································································
Global skills scanned: √ pass (~/.claude/skills/, ~/.agents/skills/)
Project skills scanned: √ pass (.claude/skills/)
Duplicates identified: √ pass (N duplicate groups found)
____________________________
Result: PASS | FAIL | PARTIALPhase 2 — Report
◆ Report (step 2 of 3 — findings presentation)
··································································
Findings presented: √ pass (table shown per duplicate group)
Severity classified: √ pass (exact name match | similar description)
Removal plan ready: √ pass (keep/remove recommendations made)
____________________________
Result: PASS | FAIL | PARTIALPhase 3 — Cleanup
◆ Cleanup (step 3 of 3 — duplicate removal)
··································································
Duplicates removed: √ pass (N skills removed)
No side effects: √ pass (source repos untouched)
Inventory verified: √ pass (rescan: 0 duplicates remaining)
____________________________
Result: PASS | FAIL | PARTIAL阶段1 — 扫描
◆ 扫描(第1步/共3步 — 清单收集)
··································································
全局技能已扫描: √ 通过 (~/.claude/skills/, ~/.agents/skills/)
项目技能已扫描: √ 通过 (.claude/skills/)
已识别重复项: √ 通过(发现N个重复组)
____________________________
结果: 通过 | 未通过 | 部分通过阶段2 — 报告
◆ 报告(第2步/共3步 — 结果展示)
··································································
结果已展示: √ 通过(每个重复组均显示表格)
已分类严重程度: √ 通过(名称完全匹配 | 描述相似)
移除计划已准备: √ 通过(已给出保留/移除建议)
____________________________
结果: 通过 | 未通过 | 部分通过阶段3 — 清理
◆ 清理(第3步/共3步 — 重复项移除)
··································································
重复项已移除: √ 通过(已移除N个技能)
无副作用: √ 通过(源仓库未被触碰)
清单已验证: √ 通过(重新扫描: 无重复项残留)
____________________________
结果: 通过 | 未通过 | 部分通过Important Notes
重要说明
- This skill only removes installed copies (in ,
~/.claude/skills/, or~/.agents/skills/). It never touches source repositories..claude/skills/ - Symlinks between and
~/.claude/skills/pointing to the same target are shared installations, NOT duplicates. The scanner excludes these automatically.~/.agents/skills/
- 本技能仅移除已安装的副本(位于、
~/.claude/skills/或~/.agents/skills/)。绝不会触碰源仓库。.claude/skills/ - 和
~/.claude/skills/之间指向同一目标的符号链接属于共享安装,而非重复项。扫描器会自动排除这些链接。~/.agents/skills/