用途:building-tests 用于构建并运行应用的已提交测试,测试围绕用户期望编写,不按平台划分;其中 segment 指一个参与者在某一界面上表达的一种意图。
主要能力:
- 提供 Setup 表格,逐项规定前置条件、是否必需、适用时机、完成标准与操作方式,涵盖 Node.js 22+、测试根路径、根标记文件、堆栈配置、各界面框架技能、界面运行时、运行器、包文件、依赖安装和固定规则。
- 通过 test-contract.md 定义契约;测试根目录默认 tests/,需包含携带 test-contract.md 的 index.md 标记;index.md 的 frontmatter 需填写 backend、health 和 surfaces。
- 为 index.md 中每个 surfaces 安装对应框架的通用技能,要求仅教框架机制,不教测试结构。
- 使用 assets/runner/ 提供运行器,并复制 assets/package.json 与 assets/gitignore 到测试根目录。
- 固定规则:当变更影响用户流程、后端状态或路由时,需在同一工作中运行 building-tests 的 Update 配方,并将该规则写入根 AGENTS.md 及存在时的根 CLAUDE.md。
使用方式:
- 按 Workflow 依次执行 Setup 行:满足完成标准则跳过;user 类型在必需时停止并打印方法,可选时继续;ask 类型填写请求中已回答项,其余一并询问并记录;auto 与 static 类型直接运行。
- 读取 test-contract.md,匹配一条 Recipes 行,打开其 Read 列的所有文档。
- 仅在诊断失败运行时才手动驱动应用。
配方:
- Set up:如“Set up building-tests”“Is building-tests ready?”,执行 Setup 全部行并报告各状态。
- Create:如“Create tests for booking”“Add a journey for the order lifecycle”“Add an accessibility property”,读取 creating-tests.md。
- Update:如“Update the tests for this change”“Mark the decline case ready”,或在流程、状态、路由变更后按固定规则执行,读取 updating-tests.md。
- Run:如“Run the booking tests”“Run the order-lifecycle journey”“Why is this test failing?”,读取 executing-tests.md。
- Configure CI:如“Run the tests in CI”“Add the tests workflow”“Run the mobile tests nightly”,读取 configuring-ci.md。
- Review coverage:如“What isn't tested?”“Show test coverage”“Which drafts need confirming?”,读取 reviewing-coverage.md。
适用场景:需要为应用建立、更新、运行已提交测试,配置 CI 测试工作流,或审查测试覆盖率与待确认草稿时。
限制:资料未提供具体收费、价格、平台支持范围、测试效果或性能承诺;部分运行时安装命令依框架文档而定,资料仅给出示例;缺失事实暂未提供。