story-validator
About
The story-validator skill checks user stories against the INVEST criteria to ensure quality. It identifies issues, provides actionable improvement suggestions, and can optionally auto-fix common problems. Developers should use it to validate story quality in the backlog or when preparing stories for development.
Documentation
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:
# Read YAML file cat stories/yaml-source/US-0001.yaml -
Run Validation:
python3 .claude/skills/story-validator/scripts/validate_story_invest.py --story-id US-0001 --output json -
Parse Results:
{ "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:
π 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):
# Read YAML # Update so_that field # Write back atomically # Regenerate markdownβ 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:
# If "backlog" specified: find stories/yaml-source -name "US-*.yaml" -exec grep -l "status: backlog" {} \; # If specific IDs: # Use provided list -
Validate Each Story:
for 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:
π 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):
π§ 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:
π― 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
Quick Install
/plugin add https://github.com/matteocervelli/llms/tree/main/story-validatorCopy and paste this command in Claude Code to install this skill
GitHub δ»εΊ
Related Skills
sglang
MetaSGLang is a high-performance LLM serving framework that specializes in fast, structured generation for JSON, regex, and agentic workflows using its RadixAttention prefix caching. It delivers significantly faster inference, especially for tasks with repeated prefixes, making it ideal for complex, structured outputs and multi-turn conversations. Choose SGLang over alternatives like vLLM when you need constrained decoding or are building applications with extensive prefix sharing.
llamaguard
OtherLlamaGuard is Meta's 7-8B parameter model for moderating LLM inputs and outputs across six safety categories like violence and hate speech. It offers 94-95% accuracy and can be deployed using vLLM, Hugging Face, or Amazon SageMaker. Use this skill to easily integrate content filtering and safety guardrails into your AI applications.
evaluating-llms-harness
TestingThis Claude Skill runs the lm-evaluation-harness to benchmark LLMs across 60+ standardized academic tasks like MMLU and GSM8K. It's designed for developers to compare model quality, track training progress, or report academic results. The tool supports various backends including HuggingFace and vLLM models.
langchain
MetaLangChain is a framework for building LLM applications using agents, chains, and RAG pipelines. It supports multiple LLM providers, offers 500+ integrations, and includes features like tool calling and memory management. Use it for rapid prototyping and deploying production systems like chatbots, autonomous agents, and question-answering services.
