claude-skill-prereq-audit
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSkill Prerequisite Check
Skill 前置条件检查
Scan installed skills, discover their tool/MCP/auth dependencies via heuristic parsing, check if everything is installed and authenticated, and offer to fix issues interactively.
扫描已安装的Skill,通过启发式分析识别它们的工具/MCP/认证依赖项,检查所有组件是否已安装并完成认证,并提供交互式问题修复功能。
When to Use
使用场景
- Setting up a new machine
- After installing new skills
- Verifying environment is ready for all skills
- Debugging "tool not found" errors during skill execution
- 新机器初始化设置
- 安装新Skill之后
- 验证环境是否满足所有Skill的运行要求
- 排查Skill执行过程中出现的「工具未找到」错误
Arguments
参数解析
Parse from the user's invocation:
- Skill names: Any tokens after the command → filter to those skills only
- Default: scan all skills in and
~/.claude/skills/.claude/skills/
从用户的调用指令中解析:
- Skill名称:指令后的任意令牌 → 仅筛选这些指定的Skill
- 默认行为:扫描和
~/.claude/skills/目录下的所有Skill.claude/skills/
Workflow
工作流程
Phase 1: Discover Skills
阶段1:发现Skill
- Glob for and
~/.claude/skills/*/SKILL.md.claude/skills/*/SKILL.md - Follow symlinks
- If user specified skill names, filter the list to matching directory names
- Exclude this skill () from the scan list — its own SKILL.md contains tool references as parsing examples, not actual dependencies
skill-prereq-check - Read each SKILL.md file
- 匹配和
~/.claude/skills/*/SKILL.md路径下的文件.claude/skills/*/SKILL.md - 跟随符号链接
- 如果用户指定了Skill名称,将列表过滤为匹配的目录名称
- 排除本Skill()—— 它的SKILL.md中包含的工具引用是解析示例,而非实际依赖项
skill-prereq-check - 读取每个SKILL.md文件
Phase 2: Parse Prerequisites
阶段2:解析前置条件
For each SKILL.md, extract dependencies using these heuristics:
CLI tools:
- Extract command names (first token of each line) from fenced code blocks marked as ,
bash, orshellsh - Also scan sections and prose for backtick-quoted tool names followed by "CLI", "installed", or "required"
## Prerequisites - Ignore shell builtins and coreutils: ,
echo,cat,ls,mkdir,cd,grep,sed,awk,rm,cp,mv,date,wc,head,tail,sort,uniq,export,set,test,true,false,if,then,else,fi,for,do,done,while,case,esac,command,which,local,return,read,shift,printfdeclare - Ignore git subcommands: the tool is , not
gitgit commit - Deduplicate per skill
MCP servers:
- Scan for patterns — extract
mcp__<server>__as the MCP server name<server> - Also scan for or
<Name> MCP serverin prose — extract<Name> MCP toolslowercased<Name> - Deduplicate per skill
gh extensions:
- Scan for where
gh <word>is NOT a built-in gh command:<word>,pr,issue,release,api,auth,repo,project,run,extension,gist,ssh-key,gpg-key,secret,variable,codespace,label,ruleset,cache,attestation,status,browse,search,workflow,configalias - Record as gh extension dependency
Auth hints:
- Scan for ,
auth status,auth login,auth test,auth checkwithin 200 characters of a tool nameauthenticated - Mark that tool as needing an auth check
针对每个SKILL.md,使用以下启发式规则提取依赖项:
CLI工具:
- 从标记为、
bash或shell的代码块中提取每行的第一个令牌作为命令名称sh - 同时扫描章节和正文内容,查找用反引号包裹且后跟「CLI」、「已安装」或「必需」的工具名称
## Prerequisites - 忽略Shell内置命令和核心工具:,
echo,cat,ls,mkdir,cd,grep,sed,awk,rm,cp,mv,date,wc,head,tail,sort,uniq,export,set,test,true,false,if,then,else,fi,for,do,done,while,case,esac,command,which,local,return,read,shift,printfdeclare - 忽略Git子命令:工具为,而非
gitgit commit - 每个Skill的依赖项去重
MCP服务器:
- 扫描格式的内容 —— 提取
mcp__<server>__作为MCP服务器名称<server> - 同时扫描正文中的或
<Name> MCP server格式内容 —— 将<Name> MCP tools转换为小写形式提取<Name> - 每个Skill的依赖项去重
gh扩展:
- 扫描格式的内容,其中
gh <word>不是gh的内置命令:<word>,pr,issue,release,api,auth,repo,project,run,extension,gist,ssh-key,gpg-key,secret,variable,codespace,label,ruleset,cache,attestation,status,browse,search,workflow,configalias - 记录为gh扩展依赖项
认证提示:
- 扫描工具名称前后200个字符范围内的、
auth status、auth login、auth test、auth check内容authenticated - 将该工具标记为需要进行认证检查
Phase 3: Check Dependencies
阶段3:检查依赖项
Run checks for all discovered dependencies. Use parallel Bash calls where possible. Deduplicate check commands across skills — if multiple skills depend on the same tool, run the check once and reuse the result.
CLI tools:
- Run — if exit code 0, installed; otherwise missing
command -v <tool> - If auth hint exists for this tool, run (or use the Bash tool's timeout parameter set to 10000ms) and check exit code. If exit code != 0, try
timeout 10 <tool> auth status 2>&1. If both fail, mark auth as "FAIL". If the command times out, mark auth as "TIMEOUT". If no auth hint, mark as "—"timeout 10 <tool> auth check 2>&1
MCP servers:
- Use ToolSearch with query to check if any
+<server>tools are available in the sessionmcp__<server>__* - If tools found → installed = "yes". If auth tool was referenced in the skill (e.g. ), call it to verify. Otherwise auth = "—"
auth_test - If no tools found → installed = "no", auth = "—"
gh extensions:
- Run once (cache the result)
gh extension list - Check if each extension name appears as a suffix in any line of the output (e.g., the line contains or ends with the extension name)
/<extension-name>
对所有识别出的依赖项执行检查。尽可能使用并行Bash调用。跨Skill去重检查命令 —— 如果多个Skill依赖同一工具,仅执行一次检查并复用结果。
CLI工具:
- 执行—— 如果退出码为0,则已安装;否则为缺失
command -v <tool> - 如果该工具有认证提示,执行(或使用Bash工具的超时参数设置为10000ms)并检查退出码。如果退出码≠0,尝试执行
timeout 10 <tool> auth status 2>&1。如果两者都失败,标记认证状态为「FAIL」。如果命令超时,标记为「TIMEOUT」。如果没有认证提示,标记为「—」timeout 10 <tool> auth check 2>&1
MCP服务器:
- 使用ToolSearch,以为查询条件,检查会话中是否存在
+<server>格式的工具mcp__<server>__* - 如果找到工具 → 已安装状态为「yes」。如果Skill中引用了认证工具(如),调用该工具进行验证。否则认证状态为「—」
auth_test - 如果未找到工具 → 已安装状态为「no」,认证状态为「—」
gh扩展:
- 执行一次(缓存结果)
gh extension list - 检查每个扩展名称是否出现在输出的任意行的后缀中(例如,行中包含或以扩展名称结尾)
/<extension-name>
Phase 4: Present Results
阶段4:展示结果
Print a table grouped by skill:
undefined打印按Skill分组的表格:
undefinedPrerequisite Check
前置条件检查结果
| # | Skill | Tool | Type | Installed | Auth |
|---|---|---|---|---|---|
| 1 | slack-triage | slack | mcp | yes | yes |
| 2 | meeting-scheduler | gws | cli | yes | FAIL |
| 3 | daily-report | gh | cli | yes | yes |
| 4 | daily-report | slackcli | cli | no | — |
| 5 | oss-release | oss-watch | gh-ext | no | — |
Summary: N skills checked, M tools found, X issues
- "yes" = check passed
- "FAIL" = check ran and failed
- "—" = not applicable (not installed, or no auth pattern detected)
- Number each row for reference in the fix phase
If no issues found, print "All prerequisites satisfied." and stop.| 序号 | Skill | 工具 | 类型 | 已安装 | 认证状态 |
|---|---|---|---|---|---|
| 1 | slack-triage | slack | mcp | yes | yes |
| 2 | meeting-scheduler | gws | cli | yes | FAIL |
| 3 | daily-report | gh | cli | yes | yes |
| 4 | daily-report | slackcli | cli | no | — |
| 5 | oss-release | oss-watch | gh-ext | no | — |
摘要:已检查N个Skill,发现M个工具,存在X个问题
- "yes" = 检查通过
- "FAIL" = 检查执行失败
- "—" = 不适用(未安装或未检测到认证模式)
- 为每行编号,以便在修复阶段引用
如果未发现问题,打印「所有前置条件均已满足。」并终止流程。Phase 5: Interactive Fix
阶段5:交互式修复
If issues exist, ask: "Want me to fix any of these? (e.g. '2, 4' or 'all' or 'done')"
For each selected item, attempt the appropriate fix:
| Type | Issue | Fix Strategy |
|---|---|---|
| cli | not installed | Try |
| cli | auth FAIL | Run |
| mcp | not available | Tell user: "Add the |
| gh-ext | not installed | Run |
After each fix attempt, re-run the check for that item and show the updated row.
When all selected fixes are attempted, re-print the full table with updated results.
如果存在问题,询问:"是否需要我修复这些问题?(例如:'2, 4' 或 'all' 或 'done')"
针对每个选中的项,尝试执行相应的修复策略:
| 类型 | 问题 | 修复策略 |
|---|---|---|
| cli | 未安装 | 尝试执行 |
| cli | 认证失败 | 执行 |
| mcp | 不可用 | 告知用户:"请将 |
| gh-ext | 未安装 | 执行 |
每次修复尝试后,重新运行该项目的检查并展示更新后的行。
当所有选中的修复操作完成后,重新打印包含更新结果的完整表格。
Error Handling
错误处理
- If doesn't exist, report "No skills directory found at ~/.claude/skills/" and check only
~/.claude/skills/.claude/skills/ - If a tool's auth check hangs (>10s), kill it and mark as "TIMEOUT"
- If is not installed, suggest manual install instructions instead
brew
- 如果目录不存在,报告「在~/.claude/skills/路径下未找到Skill目录」并仅检查
~/.claude/skills/目录.claude/skills/ - 如果工具的认证检查超时(>10秒),终止进程并标记为「TIMEOUT」
- 如果未安装,改为建议手动安装说明
brew
Examples
示例
Example 1: Check all skills
User: "check prerequisites"
Action: Scan all skills, parse deps, check each, show tableExample 2: Check specific skills
User: "/skill-prereq-check slack-triage meeting-scheduler"
Action: Scan only those two skills, parse deps, check, show tableExample 3: Fix issues
User: (after seeing table) "fix 2, 5"
Action: Run `gws auth login` for item 2, `gh extension install` for item 5, re-check示例1:检查所有Skill
用户:"check prerequisites"
操作:扫描所有Skill,解析依赖项,执行检查,展示表格示例2:检查指定Skill
用户:"/skill-prereq-check slack-triage meeting-scheduler"
操作:仅扫描这两个Skill,解析依赖项,执行检查,展示表格示例3:修复问题
用户:(查看表格后)"fix 2, 5"
操作:为项目2执行`gws auth login`,为项目5执行`gh extension install`,重新检查