Skill: Craft Factory State
"Factories are a DSL for building state."
The Standard
- States Over Arrays: Use expressive methods, not inline arrays.
- Chain for Composition: Multiple states combine to tell a story.
- Name by Intent:
revised()notwithRevisionCount(1).
The Anti-Patterns
| Don't | Do | Why |
|---|---|---|
| Inline arrays | Named states | Readability |
| Generic names | Intent-revealing names | Clarity |
| Deep nesting in tests | withDeepHierarchy() state |
Encapsulation |
| Repeat setup | Extract to state | DRY |
Real-World Examples
See examples.md.