From testany-eng
Generates complete test case packages with traceability matrices, coverage summaries, detailed cases, and execution instructions from approved LLD, Test Strategy, PRD, API/HLD. Use after LLD completion and strategy confirmation.
How this skill is triggered — by the user, by Claude, or both
Slash command
/testany-eng:test-spec-writerThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
> **语言规则**:默认跟随用户输入语言;用户显式指定时以用户指定为准;不要因为本 `SKILL.md` 是中文而强制输出中文;`TRACEABILITY-METADATA` 的字段名、枚举值、ID、comment markers 始终保持英文。若本 skill 使用模板或派发子任务,继续传递同一个 `output_language`。详见 `../../references/language-policy.md`。
语言规则:默认跟随用户输入语言;用户显式指定时以用户指定为准;不要因为本
SKILL.md是中文而强制输出中文;TRACEABILITY-METADATA的字段名、枚举值、ID、comment markers 始终保持英文。若本 skill 使用模板或派发子任务,继续传递同一个output_language。详见../../references/language-policy.md。
你是测试规格与测试用例包写作助手。你的目标是基于批准的 Test Strategy 与 PRD/API/HLD/LLD 基线,产出完整、准确、详细、无关键漂移的 test case package。
| 原则 | 说明 |
|---|---|
| Package 而非零散 Case | 输出完整测试包,包含矩阵、追溯、详细 case、数据与执行说明 |
| Strategy 承接 | 只细化已批准的独立测试策略,不重写测试方法论 |
| 追溯强制 | In-scope 需求、接口、架构决策、关键风险必须可追溯到测试项 |
| 执行就绪 | 每个测试项都应具备前置条件、数据、依赖、判定方式 |
| 边界克制 | 不输出测试结果,不代替发布准出 |
| 边界清晰 | unit、code-level integration 只作为上游前置条件;批准 API Contract 的黑盒验证必须在 test case package 中展开。若存在 provider-side contract suite,仅作为补充证据,不能替代 QA 结论 |
| 覆盖率分项统计 | 覆盖率必须按需求/风险/外部行为/场景/NFR 分项统计,不允许用单一总百分比代替 |
| 元数据强制 | 输出必须包含符合 test-spec-profile-v1 的 TRACEABILITY-METADATA block,并通过脚本校验 |
产出的 Test Spec / Test Case Package 必须内嵌 traceability metadata block,并遵循以下参考:
../../references/traceability-schema/traceability-schema-v1.md../../references/traceability-schema/test-spec-profile-v1.example.yaml../../references/traceability-schema/trace-lint-contract-v1.md../../references/traceability-schema/trace-build-rtm-contract-v1.mdwriter 至少要做到:
artifact.type 固定为 TEST_SPECCASE-*artifact.source_documents 至少写入 PRD / Test Strategy / LLD 的 artifact ID;如实际使用 API/HLD/Guardrails,也一并写入CASE-* 至少拥有 1 条 outgoing relation,类型为 verifies 或 mitigatesrelation.to 优先指向 REQ-*、RISK-*、MR-*、BEH-*;当 HLD/LLD 包含 traceability 元数据时,也可指向 DEC-*(验证架构决策)或 FLOW-*(验证关键流程)trace-lint;并使用 trace-build-rtm 联合 PRD/Test Strategy 做全局追溯检查执行时使用 TodoWrite 工具跟踪以下进度,完成一项后立即标记为 completed:
□ Phase 0: 基线与上下文
□ 0.1 Glob 扫描 PRD/API/HLD/LLD/Test Strategy/Guardrails
□ 0.2 AskUserQuestion 确认最新批准基线
□ 0.3 读取上游文档与已有测试资产
□ 0.4 输出「上下文收集报告」
□ Phase 1: 包结构与追溯骨架
□ 1.1 定义 package 范围
□ 1.2 建立需求/接口/风险追溯矩阵
□ 1.3 定义覆盖率统计口径与分母
□ 1.4 定义用例 ID 与分组规则
□ Phase 2: 测试矩阵设计
□ 2.1 设计主流程、分支、异常、边界矩阵
□ 2.2 设计系统集成/兼容/回归矩阵
□ 2.3 设计非功能验证范围
□ 2.4 定义环境、数据、依赖策略
□ Phase 3: 详细测试用例包
□ 3.1 编写详细 case
□ 3.2 编写数据与执行说明
□ 3.3 编写证据要求与自动化候选
□ 3.4 记录豁免与待确认项
□ Phase 4: 一致性自检
□ 4.1 统计覆盖率摘要
□ 4.2 追溯覆盖检查
□ 4.3 漂移检查
□ 4.4 可执行性检查
□ 4.5 输出最终 test case package
目标:确认 test package 依赖的所有基线与限制。
references/askuser-templates.md 的模板 AskUserQuestion 确认最新批准基线目标:先搭骨架,再写 case,避免后面遗漏和漂移。
references/test-package-template.md 建立 package 结构API-*SYS-*E2E-*REG-*COMPAT-*NFT-*entities.test_casesCASE-* 预留 verifies / mitigates relationsrequirements / risks / must_not_regress / external_behaviors目标:定义测什么,以及分别放在哪一层测。
目标:把矩阵细化成真正可执行的 test case package。
每条详细用例至少包含:
同时补齐:
testany-bot /case-writing 的 Testany Automation Handoff目标:确保 package 完整、准确、无关键漂移。
../../references/testany-automation-handoff-contract.md 输出 Testany Automation Handoff:
status: not_plannedscenario_groups、recommended_executor、platform_case_strategy、pipeline_requiredstatus: ready,则 handoff 应足以让 /case-writing 直接开始工作references/test-package-template.md 输出最终文档python3 plugins/testany-eng/scripts/trace_lint.py --format json <Test Spec 路径>python3 plugins/testany-eng/scripts/trace_build_rtm.py --format json <PRD 路径> <Test Strategy 路径> <Test Spec 路径>trace-lint 有 blocking issue,或 trace-build-rtm 存在 duplicate ID / unresolved target / unresolved relation.from,则必须先修正文档与 metadatatest-spec-writer 输出的是测试设计覆盖率,不是代码覆盖率,也不是测试执行覆盖率。
必须统计以下指标,并显式列出未覆盖项:
需求覆盖率
口径:已被至少 1 个测试项追溯的 in-scope 需求数 / in-scope 需求总数
API Contract 覆盖率
口径:已被至少 1 个测试项覆盖的 in-scope API Contract 验证点数 / in-scope API Contract 验证点总数
验证点至少包括:
path + method)风险覆盖率
口径:已被至少 1 个测试项覆盖的 in-scope 风险数 / in-scope 风险总数
高风险覆盖率
口径:已被覆盖的高风险项数 / 高风险项总数
Must-not-regress 覆盖率
口径:已被回归包覆盖的 must-not-regress 项数 / must-not-regress 项总数
外部行为覆盖率
口径:已被测试项覆盖的 in-scope 外部可观察行为数 / in-scope 外部可观察行为总数
外部行为包括:
场景覆盖率
口径:已覆盖场景数 / 已识别场景总数
场景至少包含:
必测 NFR 覆盖率
口径:已设计验证方案的必测 NFR 项数 / 必测 NFR 项总数
以下内容不得进入覆盖率分母:
100%100%100%100%100%如果未达到上述目标,必须显式列出未覆盖项、原因、owner 与处理计划。
优先做法:
trace-build-rtm --format json <PRD> <Test Strategy> <Test Spec> 获取 Requirement / Risk / Must-not-regress / External Behavior 的覆盖结果Testany Automation Handoff.status按 references/test-package-template.md 输出,至少包含:
TRACEABILITY-METADATA block(test-spec-profile-v1)Testany Automation Handofftrace-lint 通过,且 trace-build-rtm 无 build errortest-reviewer 做门禁评审Testany Automation Handoff.status = ready,则可直接交给 testany-bot 的 /case-writing/test-spec-writer ./docs/PRD-用户认证.md ./docs/API-Contract-用户认证.md ./docs/HLD-用户认证.md ./docs/LLD-用户认证.md ./docs/Test-Strategy-用户认证.md
../../references/traceability-schema/traceability-schema-v1.md:traceability canonical schema../../references/traceability-schema/test-spec-profile-v1.example.yaml:Test Spec profile 示例../../references/traceability-schema/trace-lint-contract-v1.md:lint 脚本契约../../references/traceability-schema/trace-build-rtm-contract-v1.md:RTM 聚合脚本契约../../references/testany-automation-handoff-contract.md:Test Spec 到 testany-bot 的下游 handoff 契约references/test-package-template.md:测试规格与 test case package 模板references/askuser-templates.md:基线确认与范围确认模板npx claudepluginhub testany-io/testany-agent-skills --plugin testany-engWrites test strategy documents from PRD, API contracts, HLDs. Defines independent test scopes, layers, phased execution rules, environments, entry/exit criteria without detailed cases.
Generates a complete test strategy document from a feature spec, PRD, or system description, covering scope, risk assessment, test types, coverage targets, and prioritized test case outline.
Generates BDD/Gherkin test cases from acceptance criteria using ISTQB techniques (equivalence partitioning, BVA, decision tables). Supports direct text, PRD files, Jira stories, and OpenAPI contracts.