AgentSkillsCN

Validators

验证者

SKILL.md

Validators Skill

Purpose

Validate Relentless documents (spec.md, plan.md, tasks.md, checklist.md, constitution.md) to ensure they follow required structure and contain all mandatory sections.

When to Use

Run validation after generating any document to catch structural issues early:

  1. After /relentless.specify → validate spec.md
  2. After /relentless.plan → validate plan.md
  3. After /relentless.tasks → validate tasks.md
  4. After /relentless.checklist → validate checklist.md
  5. After /relentless.constitution → validate constitution.md

Usage

Validate Single Document

bash
# Auto-detect type from filename
.claude/skills/validators/scripts/validate.sh path/to/spec.md

# Force specific type
.claude/skills/validators/scripts/validate.sh --type=spec path/to/document.md

Validate All Documents in Feature

bash
.claude/skills/validators/scripts/validate.sh relentless/features/001-feature-name

Individual Validators

bash
# Validate spec
.claude/skills/validators/scripts/validate-spec.sh path/to/spec.md

# Validate plan
.claude/skills/validators/scripts/validate-plan.sh path/to/plan.md

# Validate tasks
.claude/skills/validators/scripts/validate-tasks.sh path/to/tasks.md

# Validate checklist
.claude/skills/validators/scripts/validate-checklist.sh path/to/checklist.md

# Validate constitution
.claude/skills/validators/scripts/validate-constitution.sh path/to/constitution.md

Validation Rules

spec.md

RuleTypeDescription
TitleERRORMust have # Feature Specification: [Name]
User ScenariosERRORMust have ## User Scenarios & Testing
User StoriesERRORMust have ### User Story N sections
PrioritiesERRORMust have Priority: P1, P2, etc.
Given/When/ThenERRORMust have TDD acceptance format
RequirementsERRORMust have ## Requirements section
FR-XXXERRORMust have functional requirements with FR-XXX format
Test StrategyERRORMust have ## Test Strategy section
Success CriteriaERRORMust have ## Success Criteria section

plan.md

RuleTypeDescription
TitleERRORMust have # Technical Plan: [Name]
Technical ContextERRORMust have ## Technical Context
Constitution ComplianceERRORMust have ## Constitution Compliance
ImplementationERRORMust have ## Implementation or ## Architecture
Test SpecificationsERRORMust have ## Test section
Quality GatesERRORMust have ## Quality Gates

tasks.md

RuleTypeDescription
TitleERRORMust have # Implementation Tasks: [Name]
PhasesERRORMust have ## Phase N sections
US TagsERRORMust have [US-XXX] tags
US HeadingsERRORMust have ### [US-XXX] Title format
Task CheckboxesERRORMust have - [ ] task items
ComplexityWARNShould have **Complexity**: simple/medium/complex/expert
PRD FormatERRORMust be convertible to prd.json

checklist.md

RuleTypeDescription
TitleERRORMust have # [Type] Checklist: [Name]
Quality GatesERRORMust have ## 0. Quality Gates (typecheck, lint, test)
TDD ComplianceERRORMust have ## 1. TDD Compliance
Routing ComplianceERRORMust have ## 2. Routing Compliance
CHK ItemsERRORMust have at least 5 CHK-XXX items
CheckboxesERRORMust have - [ ] or - [x] checkboxes

constitution.md

RuleTypeDescription
Title + VersionERRORMust have # Constitution vX.Y.Z
PrinciplesERRORMust have ## Principle N sections
MUST RulesERROREach principle must have ### MUST section with rules
SHOULD RulesERROREach principle must have ### SHOULD section with rules

Exit Codes

  • 0 - All validations passed
  • 1 - Validation errors found (document is incomplete)
  • 2 - Usage error (bad arguments)

Output Format

code
━━━ Validating Spec: path/to/spec.md ━━━
ℹ Checking document structure...
✓ Title found: Feature Name
✓ Feature branch documented
...
✗ ERROR: Missing Given/When/Then acceptance scenarios
⚠ WARNING: No edge cases documented
...

━━━ Validation Summary for spec.md ━━━
  Passed:   12
  Warnings: 2
  Errors:   1

VALIDATION FAILED: 1 error(s) found

Integration with Skills

Skills should run validation after generating documents:

bash
# In skill workflow after creating spec.md
echo "Validating generated spec..."
if ! .claude/skills/validators/scripts/validate-spec.sh "$FEATURE_PATH/spec.md"; then
  echo "Validation failed - please fix errors before proceeding"
  exit 1
fi

Troubleshooting

"VALIDATION FAILED" after document generation

  1. Review the specific ERROR messages
  2. Edit the document to add missing sections
  3. Re-run validation
  4. Repeat until all errors are fixed

False Positives

Some warnings may not apply to your specific document. Warnings don't fail validation - they're recommendations.

Adding Custom Validators

Create a new script in .claude/skills/validators/scripts/ following the pattern:

bash
#!/usr/bin/env bash
source "$SCRIPT_DIR/common.sh"
# ... your validation logic using check_section, check_min_count, etc.
print_summary "your-doc-type"