SuperAPI AI 工具集

validating-setup-commands

智能体与模型

查看项目

更新于 10-15 17:18

技能介绍

用途:在创建 worktree 或执行任务之前,校验项目根目录的 CLAUDE.md 是否记录了 Worktree 所需的依赖安装命令。Worktree 在执行任务前需要安装依赖,因此项目必须在 CLAUDE.md 中定义 setup 命令;该技能通过提前校验,避免任务执行阶段出现“command not found”等难以排查的失败。

主要能力与校验流程:1) 检查仓库根目录是否存在 CLAUDE.md,缺失则报错并退出;通过 REPO_ROOT=$(git rev-parse --show-toplevel) 获取根目录。2) 解析文档中的 ### Setup 段落,提取必填的 install 命令,以及可选的 postinstall 命令(命令需写在反引号中)。3) 校验成功后输出检测到的命令并返回给调用方,供后续 worktree 安装依赖使用。

期望的 CLAUDE.md 格式:在 ## Development Commands 下包含 ### Setup,并写 - install: npm install,可选 - postinstall: npx prisma generate。文中给出的多语言示例包括 npm install、pip install -r requirements.txt、cargo build、go mod download、bundle install。

适用场景与限制:适用于 /spectacular:spec、/spectacular:execute 等会创建 worktree 的命令,应在创建任何 worktree 之前调用;postinstall 为可选,仅部分项目需要 codegen。校验失败时会给出明确的错误信息与应添加的格式示例,需先在 CLAUDE.md 中补充 Setup 段落再重试。