claude-skill-prereq-audit

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Skill 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
    ~/.claude/skills/
    and
    .claude/skills/
从用户的调用指令中解析:
  • Skill名称:指令后的任意令牌 → 仅筛选这些指定的Skill
  • 默认行为:扫描
    ~/.claude/skills/
    .claude/skills/
    目录下的所有Skill

Workflow

工作流程

Phase 1: Discover Skills

阶段1:发现Skill

  1. Glob for
    ~/.claude/skills/*/SKILL.md
    and
    .claude/skills/*/SKILL.md
  2. Follow symlinks
  3. If user specified skill names, filter the list to matching directory names
  4. Exclude this skill (
    skill-prereq-check
    ) from the scan list — its own SKILL.md contains tool references as parsing examples, not actual dependencies
  5. Read each SKILL.md file
  1. 匹配
    ~/.claude/skills/*/SKILL.md
    .claude/skills/*/SKILL.md
    路径下的文件
  2. 跟随符号链接
  3. 如果用户指定了Skill名称,将列表过滤为匹配的目录名称
  4. 排除本Skill(
    skill-prereq-check
    )—— 它的SKILL.md中包含的工具引用是解析示例,而非实际依赖项
  5. 读取每个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
    ,
    shell
    , or
    sh
  • Also scan
    ## Prerequisites
    sections and prose for backtick-quoted tool names followed by "CLI", "installed", or "required"
  • 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
    ,
    printf
    ,
    declare
  • Ignore git subcommands: the tool is
    git
    , not
    git commit
  • Deduplicate per skill
MCP servers:
  • Scan for
    mcp__<server>__
    patterns — extract
    <server>
    as the MCP server name
  • Also scan for
    <Name> MCP server
    or
    <Name> MCP tools
    in prose — extract
    <Name>
    lowercased
  • Deduplicate per skill
gh extensions:
  • Scan for
    gh <word>
    where
    <word>
    is NOT a built-in gh command:
    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
    ,
    config
    ,
    alias
  • Record as gh extension dependency
Auth hints:
  • Scan for
    auth status
    ,
    auth login
    ,
    auth test
    ,
    auth check
    ,
    authenticated
    within 200 characters of a tool name
  • Mark that tool as needing an auth check
针对每个SKILL.md,使用以下启发式规则提取依赖项:
CLI工具:
  • 从标记为
    bash
    shell
    sh
    的代码块中提取每行的第一个令牌作为命令名称
  • 同时扫描
    ## Prerequisites
    章节和正文内容,查找用反引号包裹且后跟「CLI」、「已安装」或「必需」的工具名称
  • 忽略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
    ,
    printf
    ,
    declare
  • 忽略Git子命令:工具为
    git
    ,而非
    git commit
  • 每个Skill的依赖项去重
MCP服务器:
  • 扫描
    mcp__<server>__
    格式的内容 —— 提取
    <server>
    作为MCP服务器名称
  • 同时扫描正文中的
    <Name> MCP server
    <Name> MCP tools
    格式内容 —— 将
    <Name>
    转换为小写形式提取
  • 每个Skill的依赖项去重
gh扩展:
  • 扫描
    gh <word>
    格式的内容,其中
    <word>
    不是gh的内置命令:
    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
    ,
    config
    ,
    alias
  • 记录为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:
  1. Run
    command -v <tool>
    — if exit code 0, installed; otherwise missing
  2. If auth hint exists for this tool, run
    timeout 10 <tool> auth status 2>&1
    (or use the Bash tool's timeout parameter set to 10000ms) and check exit code. If exit code != 0, try
    timeout 10 <tool> auth check 2>&1
    . If both fail, mark auth as "FAIL". If the command times out, mark auth as "TIMEOUT". If no auth hint, mark as "—"
MCP servers:
  1. Use ToolSearch with query
    +<server>
    to check if any
    mcp__<server>__*
    tools are available in the session
  2. If tools found → installed = "yes". If auth tool was referenced in the skill (e.g.
    auth_test
    ), call it to verify. Otherwise auth = "—"
  3. If no tools found → installed = "no", auth = "—"
gh extensions:
  1. Run
    gh extension list
    once (cache the result)
  2. Check if each extension name appears as a suffix in any line of the output (e.g., the line contains
    /<extension-name>
    or ends with the extension name)
对所有识别出的依赖项执行检查。尽可能使用并行Bash调用。跨Skill去重检查命令 —— 如果多个Skill依赖同一工具,仅执行一次检查并复用结果。
CLI工具:
  1. 执行
    command -v <tool>
    —— 如果退出码为0,则已安装;否则为缺失
  2. 如果该工具有认证提示,执行
    timeout 10 <tool> auth status 2>&1
    (或使用Bash工具的超时参数设置为10000ms)并检查退出码。如果退出码≠0,尝试执行
    timeout 10 <tool> auth check 2>&1
    。如果两者都失败,标记认证状态为「FAIL」。如果命令超时,标记为「TIMEOUT」。如果没有认证提示,标记为「—」
MCP服务器:
  1. 使用ToolSearch,以
    +<server>
    为查询条件,检查会话中是否存在
    mcp__<server>__*
    格式的工具
  2. 如果找到工具 → 已安装状态为「yes」。如果Skill中引用了认证工具(如
    auth_test
    ),调用该工具进行验证。否则认证状态为「—」
  3. 如果未找到工具 → 已安装状态为「no」,认证状态为「—」
gh扩展:
  1. 执行一次
    gh extension list
    (缓存结果)
  2. 检查每个扩展名称是否出现在输出的任意行的后缀中(例如,行中包含
    /<extension-name>
    或以扩展名称结尾)

Phase 4: Present Results

阶段4:展示结果

Print a table grouped by skill:
undefined
打印按Skill分组的表格:
undefined

Prerequisite Check

前置条件检查结果

#SkillToolTypeInstalledAuth
1slack-triageslackmcpyesyes
2meeting-schedulergwscliyesFAIL
3daily-reportghcliyesyes
4daily-reportslackcliclino
5oss-releaseoss-watchgh-extno
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工具类型已安装认证状态
1slack-triageslackmcpyesyes
2meeting-schedulergwscliyesFAIL
3daily-reportghcliyesyes
4daily-reportslackcliclino
5oss-releaseoss-watchgh-extno
摘要:已检查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:
TypeIssueFix Strategy
clinot installedTry
brew install <tool>
. If brew doesn't have it, search web for install instructions
cliauth FAILRun
<tool> auth login
(interactive)
mcpnot availableTell user: "Add the
<server>
MCP server to your Claude config. I can't auto-configure this."
gh-extnot installedRun
gh extension install <owner/repo>
— search GitHub for the extension first
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未安装尝试执行
brew install <tool>
。如果brew中没有该工具,搜索网络获取安装说明
cli认证失败执行
<tool> auth login
(交互式)
mcp不可用告知用户:"请将
<server>
MCP服务器添加到你的Claude配置中。我无法自动配置此项。"
gh-ext未安装执行
gh extension install <owner/repo>
—— 先在GitHub上搜索该扩展
每次修复尝试后,重新运行该项目的检查并展示更新后的行。
当所有选中的修复操作完成后,重新打印包含更新结果的完整表格。

Error Handling

错误处理

  • If
    ~/.claude/skills/
    doesn't exist, report "No skills directory found at ~/.claude/skills/" and check only
    .claude/skills/
  • If a tool's auth check hangs (>10s), kill it and mark as "TIMEOUT"
  • If
    brew
    is not installed, suggest manual install instructions instead
  • 如果
    ~/.claude/skills/
    目录不存在,报告「在~/.claude/skills/路径下未找到Skill目录」并仅检查
    .claude/skills/
    目录
  • 如果工具的认证检查超时(>10秒),终止进程并标记为「TIMEOUT」
  • 如果未安装
    brew
    ,改为建议手动安装说明

Examples

示例

Example 1: Check all skills
User: "check prerequisites"
Action: Scan all skills, parse deps, check each, show table
Example 2: Check specific skills
User: "/skill-prereq-check slack-triage meeting-scheduler"
Action: Scan only those two skills, parse deps, check, show table
Example 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`,重新检查