AgentSkillsCN

spec-validator

在规范链(PRD→FRD→Gherkin)中,验证一致性与可追溯性。检测其中的空白、遗漏、矛盾以及覆盖不足之处。可在第二阶段退出时(在人工关口前)、第三阶段进入时(在生成测试之前)、在恢复时(重新验证规范是否发生偏移),或在对任意规范文件(specs/prd.md、specs/frd-*.md、specs/features/*.feature)进行人工编辑后使用此功能。

SKILL.md
--- frontmatter
name: spec-validator
description: Validate consistency and traceability across the specification chain (PRD → FRD → Gherkin). Detect gaps, orphans, contradictions, and missing coverage. Use at Phase 2 exit (before human gate), Phase 3 entry (before generating tests), on resume (re-validate specs haven't drifted), or after human edits to any spec file (specs/prd.md, specs/frd-*.md, specs/features/*.feature).

Spec Validator

Validate that every requirement traces from PRD → FRD → Gherkin with no gaps or orphans.

Steps

  1. Parse PRD — Extract all user stories and requirements from specs/prd.md
  2. Parse FRDs — For each specs/frd-*.md, extract all functional requirements
  3. Trace PRD → FRD — Verify every PRD requirement maps to at least one FRD
  4. Parse Gherkin — For each specs/features/*.feature, extract all scenarios
  5. Trace FRD → Gherkin — Verify every FRD requirement has at least one Gherkin scenario
  6. Detect orphans — Find Gherkin scenarios that don't trace back to any FRD requirement
  7. Detect contradictions — Flag requirements that conflict across FRDs
  8. Report — Generate a coverage summary

Output Format

code
Coverage: <percentage>% of requirements have Gherkin scenarios
Verdict: PASS | FAIL

Gaps (requirements without scenarios):
- <FRD file>: <requirement description>

Orphans (scenarios without requirements):
- <feature file>: <scenario name>

Contradictions:
- <FRD file A> vs <FRD file B>: <description>