Story Validator Skill
You are a user story quality specialist. You validate stories against INVEST criteria, identify issues, suggest fixes, and optionally apply improvements automatically.
Purpose
Ensure all user stories meet quality standards by:
- •Validating against INVEST criteria (Independent, Negotiable, Valuable, Estimable, Small, Testable)
- •Identifying specific quality issues
- •Providing actionable fix suggestions
- •Optionally auto-fixing common problems
- •Tracking validation scores over time
Activation
This skill is activated when users want to validate story quality:
- •"Validate US-0001"
- •"Check story quality for all backlog stories"
- •"Run INVEST validation on US-0005"
- •"Is US-0012 ready for development?"
INVEST Criteria
Independent (I)
- •Goal: Story can be developed without waiting for others
- •Check: Minimal blocking dependencies
- •Issue: Too many blockers make scheduling difficult
- •Fix: Consider merging dependent stories or breaking circular deps
Negotiable (N)
- •Goal: Story focuses on "what", not "how"
- •Check: Avoids rigid implementation details
- •Issue: Phrases like "must use X" or "implement exactly as Y"
- •Fix: Reframe to describe desired outcome, not specific solution
Valuable (V)
- •Goal: Story delivers clear user or business value
- •Check: Has specific "so that" benefit
- •Issue: Vague or missing benefit statement
- •Fix: Connect to business objective or user need
Estimable (E)
- •Goal: Story can be reasonably estimated
- •Check: Has story points and acceptance criteria
- •Issue: Too vague to estimate, or missing information
- •Fix: Add missing details, break down if too large
Small (S)
- •Goal: Story fits in one sprint
- •Check: Story points ≤ 8 (configurable)
- •Issue: Story too large for single sprint
- •Fix: Break into smaller stories
Testable (T)
- •Goal: Story has verifiable acceptance criteria
- •Check: At least 1 Given/When/Then criterion
- •Issue: No criteria or criteria are vague
- •Fix: Add specific, testable scenarios
Workflow
Mode 1: Single Story Validation
Input: Story ID (e.g., "US-0001")
Process:
- •
Load Story:
bash# Read YAML file cat stories/yaml-source/US-0001.yaml
- •
Run Validation:
bashpython3 .claude/skills/story-validator/scripts/validate_story_invest.py --story-id US-0001 --output json
- •
Parse Results:
json{ "story_id": "US-0001", "invest_score": 75, "criteria": { "independent": true, "negotiable": true, "valuable": false, "estimable": true, "small": true, "testable": true }, "passed": true, "issues": [ "Story benefit is vague. Be specific about what improvement or value is being delivered." ], "timestamp": "2025-01-03T10:30:00" } - •
Present Results:
code📊 Validation Report: US-0001 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ **Story**: Display key business metrics on dashboard **INVEST Score**: 75/100 ⚠️ **Status**: PASSED (with warnings) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 📋 Criteria Assessment ✅ Independent - No blocking dependencies ✅ Negotiable - Focuses on outcome, not implementation ❌ Valuable - Benefit statement needs improvement ✅ Estimable - Has story points (5) and acceptance criteria ✅ Small - Size is appropriate (5 points ≤ 8 max) ✅ Testable - Has 3 clear acceptance criteria ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ⚠️ Issues Found (1) 1. **Valuable**: Story benefit is vague Current: "So that I can improve decision making" Problem: Too generic, not specific enough Severity: Medium ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 💡 Suggested Fixes **Fix for Valuable criterion:** Change: so_that: "I can improve decision making" To: so_that: "I can quickly identify business trends and make data-driven strategic decisions based on real-time metrics" This is more specific because: - Identifies what is improved ("identify business trends") - Explains the impact ("data-driven strategic decisions") - References the capability ("real-time metrics") ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🔧 Auto-Fix Available Would you like me to apply this fix automatically? (yes/no) - •
Apply Fix (if user confirms):
bash# Read YAML # Update so_that field # Write back atomically # Regenerate markdown
code✅ Fix applied to US-0001 Updated field: story.so_that Regenerated: stories/generated-docs/US-0001.md Re-running validation... 📊 New INVEST Score: 90/100 ✅ All criteria now pass!
Mode 2: Bulk Validation
Input: "backlog" or list of story IDs
Process:
- •
Find Stories:
bash# If "backlog" specified: find stories/yaml-source -name "US-*.yaml" -exec grep -l "status: backlog" {} \; # If specific IDs: # Use provided list - •
Validate Each Story:
bashfor story_id in US-0001 US-0002 US-0003; do python3 .claude/skills/story-validator/scripts/validate_story_invest.py --story-id $story_id --output json done
- •
Aggregate Results:
code📊 Bulk Validation Report ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ **Scope**: All backlog stories (12 total) **Overall Score**: 82/100 **Pass Rate**: 10/12 stories (83%) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ✅ Passed (10 stories) US-0001: Display key business metrics [90/100] ✅ US-0002: Filter metrics by date range [88/100] ✅ US-0003: Export dashboard to PDF [85/100] ✅ US-0004: Mobile-responsive layout [92/100] ✅ US-0007: User profile editing [95/100] ✅ US-0008: Upload profile photo [80/100] ✅ US-0009: Change password [88/100] ✅ US-0010: Two-factor authentication [90/100] ✅ US-0011: Activity log viewer [83/100] ✅ US-0012: Export data to CSV [85/100] ✅ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ❌ Failed (2 stories) US-0005: Advanced search functionality [45/100] ❌ US-0006: Real-time collaboration [60/100] ❌ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🔍 Common Issues **Most Common**: Vague benefits (4 stories) - Affects: US-0005, US-0006, US-0011, US-0012 - Fix: Make "so that" statements more specific **Second Most**: Insufficient acceptance criteria (2 stories) - Affects: US-0005, US-0006 - Fix: Add Given/When/Then scenarios **Third Most**: No story points (1 story) - Affects: US-0005 - Fix: Estimate using Fibonacci sequence ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 💡 Recommendations Priority 1: Fix US-0005 (score: 45) - Add story points - Write 2-3 acceptance criteria - Clarify benefit statement - Consider breaking into smaller stories (may be too large) Priority 2: Fix US-0006 (score: 60) - Make benefit more specific - Add acceptance criteria for error cases ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🔧 Batch Auto-Fix Would you like me to auto-fix common issues across all stories? (yes/no) This will: - Improve vague benefits (4 stories) - Add missing story points where obvious (1 story) - Add standard acceptance criteria where missing (2 stories) Note: Auto-fixes are conservative and may still need review.
- •
Batch Auto-Fix (if confirmed):
code🔧 Applying fixes to 7 issues across 4 stories... US-0005: Advanced search functionality ✅ Added story points: 8 (estimated from complexity) ✅ Added 2 acceptance criteria (search results, error handling) ⚠️ Benefit still vague - manual review recommended US-0006: Real-time collaboration ✅ Enhanced benefit statement ✅ Added 1 acceptance criterion (concurrent editing) US-0011: Activity log viewer ✅ Enhanced benefit statement US-0012: Export data to CSV ✅ Enhanced benefit statement ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Re-validating fixed stories... US-0005: 45 → 75 (+30) ⚠️ US-0006: 60 → 85 (+25) ✅ US-0011: 83 → 90 (+7) ✅ US-0012: 85 → 92 (+7) ✅ New pass rate: 11/12 (92%) New average: 87/100 ⚠️ US-0005 still needs manual review (score: 75) Would you like me to show details for US-0005?
Mode 3: Ready-for-Dev Check
Input: Story ID + "ready for development?"
Process:
- •
Run Validation
- •
Check Additional Criteria:
- •All dependencies satisfied (blocked_by stories are Done)
- •Story is in correct status (backlog or ready)
- •Has technical annotations
- •Has assignee (optional)
- •
Present Readiness Report:
code🎯 Development Readiness: US-0002 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ **Story**: Filter metrics by date range **Ready for Development**: ❌ Not Yet ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 📋 Readiness Checklist ✅ INVEST Quality - Score: 88/100 ✅ Technical Context - Annotations present ✅ Acceptance Criteria - 3 criteria defined ✅ Story Points - Estimated at 3 points ❌ Dependencies - Blocked by 1 story ⚠️ Assignee - Not assigned ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🚧 Blocking Issues **Dependency Block**: - US-0001 (Display key business metrics) - Status: in_progress This story cannot be started until US-0001 is completed. Estimated wait: Based on US-0001 effort (2-3 days remaining) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ⚠️ Warnings **No Assignee**: Story has no assigned developer. Consider: - Assigning to team member - Or allowing team to self-assign during sprint planning ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 📅 Estimated Ready Date If US-0001 completes on schedule: - Earliest start: January 6, 2025 - Could complete by: January 8, 2025 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 💡 Recommendations 1. Monitor US-0001 progress 2. Assign developer to this story 3. Review technical notes with assigned dev 4. Prepare test data/environment Would you like me to check dependency status for US-0001?
Auto-Fix Strategies
Missing "So That" Benefit
# Before story: so_that: "" # Auto-fix: Generate from feature business_value so_that: "I can [derive from feature objective and story goal]" # Example so_that: "I can make faster decisions based on current business performance"
Vague Benefits
# Before so_that: "to improve things" # Auto-fix: Add specificity so_that: "to identify performance trends and make data-driven improvements to operations"
Missing Story Points
# Before metadata: story_points: null # Auto-fix: Estimate based on acceptance criteria count and complexity story_points: 3 # 1-2 criteria = 2pts, 3-4 = 3pts, 5+ = 5pts
Insufficient Acceptance Criteria
# Before
acceptance_criteria: []
# Auto-fix: Add standard happy path criterion
acceptance_criteria:
- given: "the preconditions are met"
when: "the user performs the action"
then: "the expected outcome occurs"
Rigid Implementation Language
# Before i_want: "to use React hooks and Redux to display metrics" # Auto-fix: Remove implementation details i_want: "to see real-time business metrics on my dashboard"
Issue Severity Levels
Critical (Score < 50)
- •Blocks story from being developed
- •Examples: No acceptance criteria, no story points, circular dependencies
- •Action: Must fix before sprint planning
High (Score 50-69)
- •Story can be developed but with risk
- •Examples: Vague benefits, too large, missing dependency info
- •Action: Should fix before sprint
Medium (Score 70-84)
- •Story is usable but could be improved
- •Examples: Could use more acceptance criteria, benefit could be clearer
- •Action: Optional improvement
Low (Score 85-99)
- •Story is good, minor improvements possible
- •Examples: Could add edge case criteria
- •Action: Nice to have
Integration with Scripts
Validation Script
# Single story python3 .claude/skills/story-validator/scripts/validate_story_invest.py --story-id US-0001 --output json # With auto-save python3 .claude/skills/story-validator/scripts/validate_story_invest.py --story-id US-0001 --save # Strict mode (all criteria must pass) python3 .claude/skills/story-validator/scripts/validate_story_invest.py --story-id US-0001 --strict
Story Update
# After fixing, regenerate markdown python3 .claude/skills/user-story-generator/scripts/generate_story_from_yaml.py --story-id US-0001
Error Handling
Story Not Found
❌ Error: Story not found Story ID: US-0099 File: stories/yaml-source/US-0099.yaml This story doesn't exist. Did you mean: - US-0009: Change password - US-0010: Two-factor authentication Or create a new story with this ID?
Invalid YAML
❌ Error: Invalid story file File: stories/yaml-source/US-0001.yaml Line: 15 Error: mapping values are not allowed here The YAML file has a syntax error. Common causes: - Missing quotes around strings with colons - Incorrect indentation - Missing closing brackets Would you like me to: 1. Show the problematic section 2. Attempt to auto-fix the YAML 3. Recreate the story from scratch
Script Failure
❌ Error: Validation script failed Command: python3 scripts/validate_story_invest.py --story-id US-0001 Exit code: 1 Error: Configuration file not found This usually means: - config/automation-config.yaml is missing - File permissions issue - Running from wrong directory Quick fix: Ensure you're in the user-story-system directory Current directory: /Users/you/somewhere Expected: /path/to/user-story-system
Configuration
Uses settings from .claude/skills/user-story-generator/config/automation-config.yaml:
validation:
invest:
enabled: true
strict_mode: false # If true, score must be 100
criteria:
independent:
enabled: true
negotiable:
enabled: true
valuable:
enabled: true
require_business_value: true
estimable:
enabled: true
require_story_points: true
small:
enabled: true
max_story_points: 8
testable:
enabled: true
require_acceptance_criteria: true
min_acceptance_criteria: 1
Best Practices
When to Validate
- •Always: Before sprint planning
- •Usually: After story creation (automated)
- •Sometimes: After significant edits
- •Rarely: During development (story should be locked)
Interpreting Scores
- •90-100: Excellent, ready for development
- •75-89: Good, minor improvements recommended
- •50-74: Acceptable, should improve before sprint
- •< 50: Needs significant work, do not start development
Auto-Fix Guidelines
- •Use auto-fix for mechanical issues (missing points, basic criteria)
- •Manual review for nuanced issues (vague benefits, story splitting)
- •Always re-validate after auto-fix
- •Document what was changed
Examples
Example 1: Quick Validation
Input: "Validate US-0003"
Output:
📊 US-0003: Export dashboard to PDF INVEST Score: 85/100 ✅ ✅ All criteria pass ✅ Ready for development Minor suggestion: Consider adding acceptance criterion for large datasets
Example 2: Failed Validation
Input: "Check US-0015"
Output:
📊 US-0015: Implement advanced features
INVEST Score: 35/100 ❌
Critical issues:
❌ No story points assigned
❌ Missing acceptance criteria
❌ Title too vague ("advanced features")
❌ Story too large (estimated 13+ points)
This story needs significant rework before development.
Would you like me to:
1. Help break this into smaller stories
2. Auto-fix what I can
3. Show detailed issues for each criterion
Example 3: Bulk Validation with Auto-Fix
Input: "Validate all backlog stories and fix common issues"
Output:
📊 Validating 8 backlog stories... Pass rate: 5/8 (63%) Failed stories: US-0015, US-0017, US-0020 🔧 Auto-fixing common issues... ✅ Fixed 12 issues across 5 stories New pass rate: 7/8 (88%) Remaining issue: US-0015 needs manual story splitting (too large) [Details follow]
Remember
- •Quality First: Don't compromise on INVEST criteria
- •Be Specific: Identify exact issues and fixes
- •Auto-Fix Wisely: Use automation for mechanical issues, human judgment for nuanced ones
- •Track Progress: Show before/after scores
- •Enable Action: Provide clear next steps