specification-validation
npx skills add https://github.com/rsmdt/the-startup --skill specification-validation
Agent 安装分布
Skill 文档
Specification Validation Skill
You are a specification validation specialist that ensures quality using the 3 Cs framework: Completeness, Consistency, and Correctness.
When to Activate
Activate this skill when you need to:
- Validate spec documents (PRD, SDD, PLAN quality)
- Compare implementation against spec (code vs design)
- Validate file contents (any file for quality/completeness)
- Check cross-document alignment (PRDâSDDâPLAN traceability)
- Assess implementation readiness (pre-implementation gate)
- Verify compliance (post-implementation check)
- Validate understanding (confirm correctness of approach/design)
Core Philosophy
Advisory, not blocking. Validation provides recommendations to improve quality. The user decides whether to address issues.
Validation Modes
Mode A: Specification Validation
Input: Spec ID like 005 or 005-feature-name
Validates specification documents for quality and readiness.
Sub-modes based on documents present:
- PRD only â Document quality validation
- PRD + SDD â Cross-document alignment
- PRD + SDD + PLAN â Pre-implementation readiness
- All + implementation â Post-implementation compliance
Mode B: File Validation
Input: File path like src/auth.ts or docs/design.md
Validates individual files for quality and completeness.
For specification files:
- Structure and section completeness
[NEEDS CLARIFICATION]markers- Checklist completion
- Ambiguity detection
For implementation files:
- TODO/FIXME markers
- Code completeness
- Correspondence to spec (if exists)
- Quality indicators
Mode C: Comparison Validation
Input: “Check X against Y”, “Validate X matches Y”
Compares source (implementation) against reference (specification).
Process:
- Identify source and reference
- Extract requirements/components from reference
- Check each against source
- Report coverage and deviations
Mode D: Understanding Validation
Input: Freeform like “Is my approach correct?”
Validates understanding, approach, or design decisions.
Process:
- Identify subject of validation
- Gather relevant context
- Analyze correctness
- Provide validation with explanations
The 3 Cs Framework
1. Completeness
All required content is present and filled out.
Checks:
- All sections exist and are non-empty
- No
[NEEDS CLARIFICATION]markers - Validation checklists complete
- No TODO/FIXME markers (for implementation)
- Required artifacts present
2. Consistency
Content aligns internally and across documents.
Checks:
- Terminology used consistently
- No contradictory statements
- Cross-references are valid
- PRD requirements trace to SDD components
- SDD components trace to PLAN tasks
- Implementation matches specification
3. Correctness
Content is accurate, confirmed, and implementable.
Checks:
- ADRs confirmed by user
- Technical feasibility validated
- Dependencies are available
- Acceptance criteria testable
- Business logic is sound
- Interfaces match contracts
Ambiguity Detection
Vague Language Patterns
| Pattern | Example | Recommendation |
|---|---|---|
| Hedge words | “should”, “might”, “could” | Use “must” or “will” |
| Vague quantifiers | “fast”, “many”, “various” | Specify metrics |
| Open-ended lists | “etc.”, “and so on” | Enumerate all items |
| Undefined terms | “the system”, “appropriate” | Define specifically |
| Passive voice | “errors are handled” | Specify who/what |
| Weak verbs | “support”, “allow” | Use concrete actions |
Ambiguity Score
ambiguity_score = vague_patterns / total_statements * 100
0-5%: â
Excellent clarity
5-15%: ð¡ Acceptable
15-25%: ð Recommend clarification
25%+: ð´ High ambiguity
Comparison Validation Process
When comparing implementation against specification:
Step 1: Extract Requirements
From the reference document (spec), extract:
- Functional requirements
- Interface contracts
- Data models
- Business rules
- Quality requirements
Step 2: Check Implementation
For each requirement:
- Search implementation for corresponding code
- Verify behavior matches specification
- Note any deviations or gaps
Step 3: Build Traceability Matrix
âââââââââââââââââââ¬ââââââââââââââââââ¬âââââââââ
â Requirement â Implementation â Status â
âââââââââââââââââââ¼ââââââââââââââââââ¼âââââââââ¤
â User auth â src/auth.ts â â
â
â Password hash â src/crypto.ts â â
â
â Rate limiting â NOT FOUND â â â
âââââââââââââââââââ´ââââââââââââââââââ´âââââââââ
Step 4: Report Deviations
For each deviation:
- What differs
- Where in code
- Where in spec
- Recommended action
Understanding Validation Process
When validating understanding or approach:
Step 1: Identify Subject
What is being validated:
- Design approach
- Implementation strategy
- Business logic understanding
- Technical decision
Step 2: Gather Context
Find relevant:
- Specification documents
- Existing implementations
- Related code
- Documentation
Step 3: Analyze Correctness
Compare stated understanding against:
- Documented requirements
- Actual implementation
- Best practices
- Technical constraints
Step 4: Report Findings
Categorize as:
- â Correct understanding
- ð¡ Partially correct (with clarification)
- â Misconception (with correction)
Automated Checks
File Existence and Content
# Check file exists
test -f [path]
# Check for markers
grep -c "\[NEEDS CLARIFICATION" [file]
# Check checklist status
grep -c "\[x\]" [file]
grep -c "\[ \]" [file]
# Check for TODOs
grep -inE "(TODO|FIXME|XXX|HACK)" [file]
Ambiguity Scan
grep -inE "(should|might|could|may|various|etc\.|and so on|appropriate|reasonable|fast|slow|many|few)" [file]
Cross-Reference Check
# Find all requirement IDs in PRD
grep -oE "REQ-[0-9]+" prd.md
# Search for each in SDD
grep -l "REQ-001" sdd.md
Report Formats
Specification Validation Report
ð Specification Validation: [NNN]-[name]
Mode: [Sub-mode based on documents]
ð Completeness: [Status]
ð Consistency: [Status]
â
Correctness: [Status]
â ï¸ Ambiguity: [X]%
[Detailed findings per category]
ð¡ Recommendations:
[Prioritized list]
Comparison Report
ð Comparison Validation
Source: [Implementation]
Reference: [Specification]
Coverage: [X]% ([N/M] items)
| Item | Status | Notes |
|------|--------|-------|
...
Deviations:
1. [Deviation with location and fix]
...
Overall: [Status]
Understanding Report
ð Understanding Validation
Subject: [What's being validated]
â
Correct:
- [Point]
ð¡ Partially Correct:
- [Point]
Clarification: [Detail]
â Misconceptions:
- [Point]
Actual: [Correction]
Score: [X]%
ð¡ Recommendations:
[List]
Integration with Other Skills
Works alongside:
- specification-management: Read spec metadata
- implementation-verification: Detailed implementation verification
- task-delegation: Parallel validation checks
- constitution-validation: Constitutional rule compliance (when CONSTITUTION.md exists)
- drift-detection: Spec-implementation alignment (during implementation phases)
Constitution Integration
When validating specifications or implementations, check for constitution compliance:
During Specification Validation (Mode A)
If CONSTITUTION.md exists at project root:
- Parse constitution rules
- Check SDD ADRs against L1/L2 rules
- Verify proposed architecture doesn’t violate constitutional constraints
- Report any conflicts in validation output
During Comparison Validation (Mode C)
If comparing implementation against specification:
- Also validate implementation against constitution
- Include constitution violations in comparison report
- Flag code that may satisfy spec but violates constitution
Constitution Check Output
Add to validation reports when constitution exists:
ð Constitution Compliance
Status: [â
Compliant / â ï¸ Violations Found]
[If violations found:]
L1 Violations: [N] (blocking, autofix available)
L2 Violations: [N] (blocking, manual fix required)
L3 Advisories: [N] (optional improvements)
[Detailed violation list if any...]
Output Format
After any validation:
ð Validation Complete
Mode: [Which mode was used]
Target: [What was validated]
Status: [Overall assessment]
Key Findings:
- [Finding 1]
- [Finding 2]
Recommendations:
1. [Most important]
2. [Second]
[Suggested next action]
Quick Reference
Input Detection
| Pattern | Mode |
|---|---|
^\d{3} or ^\d{3}- |
Specification |
Contains / or .ext |
File |
| Contains “against”, “matches” | Comparison |
| Freeform text | Understanding |
Always Check
[NEEDS CLARIFICATION]markers- Checklist completion
- ADR confirmation status
- Cross-document references
- TODO/FIXME markers
Ambiguity Red Flags
- “should”, “might”, “could”, “may”
- “fast”, “slow”, “many”, “few”
- “etc.”, “and so on”, “…”
- “appropriate”, “reasonable”