Review and Iterate: Living Specifications
Overview
Specifications are living documents that evolve with understanding. This article explains how to continuously refine specifications after Example Mapping.
Goal: Maintain specifications that reflect both intended behavior and actual behavior as understanding deepens through implementation, usage, and feedback.
The Specification Lifecycle
Specifications evolve through continuous cycles of review and refinement.
When to Review Specifications
Review Triggers
- After Implementation - Did spec match reality?
- When Tests Fail - Spec wrong or code wrong?
- Requirements Change - New regulations, processes, features
- Regular Cadence - Weekly (active), Monthly (maintenance), Quarterly (comprehensive)
- Before Extensions - Refresh understanding, check drift
- Bugs/defects - Is specification incomplete, did we miss corner cases?
Signs of Specification Debt
- 🚩 Scenarios always pass but don't verify behavior
- 🚩 Ambiguous steps with multiple interpretations
- 🚩 Gap between spec language and code reality
- 🚩 Scenarios test implementation details, not behavior
- 🚩 File unchanged >6 months while code evolved
- 🚩 >30 scenarios in single file
- 🚩 Technical jargon instead of domain language
After Example Mapping
Immediate (Same Day)
- [ ] Write
specification.featurewith Rules and Scenarios - [ ] Document Ubiquitous Language terms
- [ ] Create
issues.mdfor pink cards - [ ] Share with stakeholders for review
Short-term (1-2 Days)
- [ ] Incorporate stakeholder feedback
- [ ] Refine ambiguous scenarios
- [ ] Add missing edge cases
- [ ] Resolve pink card questions
During Implementation (1 Week)
- [ ] Implement step definitions
- [ ] Discover edge cases via unit testing → Add scenarios
- [ ] Refine vague steps → Update spec
- [ ] Keep synchronized - commit spec with code
After Implementation
- [ ] Retrospective: Did spec match build?
- [ ] Refactor for clarity
- [ ] Remove redundant scenarios
- [ ] Document lessons learned
Continuous Iteration Practices
Weekly (Active Development)
Focus: Synchronize specs with code
- Review failing scenarios
- Add discovered edge cases
- Refine step wording
- 30-min team review: new scenarios, ambiguous language, missing coverage
Monthly (Maintenance)
Focus: Prevent drift
- Check scenario relevance
- Verify language matches code
- Consolidate similar scenarios
- Update evolved terminology
- Verify traceability (specs/ ↔ src/)
Quarterly (Comprehensive)
Focus: Major refactoring
- Review all specs in module
- Split files >20 scenarios
- Update to current Ubiquitous Language
- Remove outdated scenarios
- Run Event Storming to validate domain
Metrics: Files >20 scenarios, unchanged >6 months, no assertions, duplicate patterns
Feedback Loops
From Implementation to Specification
| Discovery | Action |
|---|---|
| Missing acceptance criteria | Add new Rule: block |
| Ambiguous steps | Refine with concrete examples |
| Edge cases | Add @ov scenarios for error cases |
| Wrong assumptions | Revise preconditions |
| Incomplete verification | Add Then/And steps |
From Production to Specification
Bug-Driven Process:
- Write scenario that would have caught bug
- Verify scenario fails (regression test)
- Fix code until passes
- Keep scenario in suite
Specification Refactoring
When to Refactor
- File >20 scenarios
- Multiple distinct concerns in one file
- Duplicate logic patterns
- Language evolved but specs haven't
- Scenarios test implementation, not behavior
- Duplicated similar steps that can be combined for reuse
How to Refactor
- Identify cohesive sub-features
- Create focused
.featurefiles (10-15 scenarios each) - Move related scenarios with Rules and @ac tags
- Delete old monolithic file
- Update step definitions if needed
Example: Split validation.feature (40 scenarios) → format-validation.feature, completeness-validation.feature, business-rule-validation.feature, edge-case-validation.feature (10 each)
Review Ceremonies
Weekly Specification Review
Duration: 30 min | Attendees: Developers, QA, Product Owner
| Time | Activity |
|---|---|
| 10 min | Review new/changed scenarios |
| 10 min | Discuss ambiguous language |
| 5 min | Identify missing coverage |
| 5 min | Refactor verbose scenarios |
Practical Review Process
Step 1: Gather specs to review
# Find recently changed specs
git log --oneline --since="1 week ago" -- specs/
# Find large files (>500 lines)
find specs/ -name "*.feature" -exec wc -l {} \; | awk '$1 > 500'
# Find stale specs (>6 months unchanged)
find specs/ -name "*.feature" -mtime +180
Step 2: Check for red flags
For each spec file, verify:
- [ ] Scenarios have meaningful assertions
- [ ] Language matches domain glossary
- [ ] No implementation details exposed
- [ ] Scenarios test behavior, not code
- [ ] File size is manageable (<30 scenarios)
Step 3: Validate with stakeholders
- Can Product Owner read and understand?
- Do scenarios match expected behavior?
- Are edge cases covered?
- Is language consistent with business terms?
Step 4: Document actions
For each issue found:
- Create task or ticket
- Assign owner
- Set deadline
- Track to completion
Three Amigos (Before New Features)
Duration: 45-60 min | Attendees: Business, Development, Testing
- Review existing related specs (15 min)
- Identify needed updates (10 min)
- Mini Example Mapping (20 min)
- Update specifications together (15 min)
Specification Health Metrics
Red Flags 🚩
- Scenarios unchanged >6 months while code evolved
- All scenarios always passing (not testing anything)
- Testing implementation: "database updated", "cache cleared"
-
30 scenarios in single file
- Technical jargon: "POST to /api/users", "response code 201"
Green Indicators ✅
- Specs committed with code changes
- Scenarios catch regression bugs
- Business can read and validate
- Clear traceability: spec → step → code
- Consistent Ubiquitous Language
Handling Specification Changes
Process
- Update scenario in
specification.feature - Update step definitions in
src/*/tests/ - Run tests - verify passing
- Update production code if behavior changed
- Commit spec and code together
Breaking changes: Tag old scenario @deprecated, add new scenario, implement, remove deprecated.
Integration with Other Practices
Ubiquitous Language Evolution: Event Storming identifies terms → Update glossary → Refactor specs → Update step definitions → Rename code. See: Ubiquitous Language
Event Storming Updates: Quarterly workshops reveal new domain understanding → Identify changed events → Find affected specs → Update scenarios → Refactor code. See: Event Storming
Risk Control Reviews: Risk changes → Update specs/risk-controls/ → Update user scenarios with @risk-control:<name>-<id> → Verify implementation → Generate evidence. See: Risk Controls
Common Pitfalls
❌ "We'll clean up specs later" - They never get cleaned ✅ Refactor immediately when issues found
❌ Specs as write-once documentation ✅ Specs as living, evolving understanding
❌ Only developers maintain specs ✅ Whole team collaborates on health
❌ Never remove old scenarios ✅ Regular pruning of outdated content
Tools and Automation
Health Checks
# Large files (>500 lines)
find specs/ -name "*.feature" -exec wc -l {} \; | awk '$1 > 500 {print}'
# Old specs (unchanged >6 months)
find specs/ -name "*.feature" -mtime +180
# Count scenarios per feature
grep -r "Scenario:" specs/ | cut -d: -f1 | uniq -c | sort -rn
Automation
- Lint Gherkin for style consistency
- Verify Feature IDs match across specs/ and src/
- Check @risk-control:[name]-[id] tag integrity
- Validate Rule → Scenario → @ac tag links
Summary
Key Principles
- Specifications are living documents - Evolve with understanding, refine through feedback, update as domain changes
- Review regularly - Weekly (active), Monthly (maintenance), Quarterly (comprehensive)
- Implementation improves specs - Reveals edge cases, uncovers missing scenarios, adds regression tests
- Whole team maintains health - Product Owner, Developers, QA, Security all contribute
- Refactor aggressively - Split large files, consolidate duplicates, remove outdated, improve clarity
Remember: The goal is executable, maintainable specifications that guide development - not bureaucratic overhead. Specifications that evolve with understanding are more valuable than perfect specs written once.
See Also
- Three-Layer Approach - Continuous workflow
- Example Mapping - Where specifications begin
- Ubiquitous Language - Language evolution
- Event Storming - Domain discovery
- BDD Fundamentals - Writing scenarios
- Risk Controls - Compliance reviews
Quick Reference
- Spec Quality Checklist - Health indicators
Tutorials | How-to Guides | Explanation | Reference
You are here: Explanation — understanding-oriented discussion that clarifies concepts.