Awesome-claude-code create-test-builder
Generates Test Data Builder and Object Mother patterns for PHP 8.4. Creates fluent builders with sensible defaults and factory methods for test data creation.
install
source · Clone the upstream repo
git clone https://github.com/dykyi-roman/awesome-claude-code
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/dykyi-roman/awesome-claude-code "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/create-test-builder" ~/.claude/skills/dykyi-roman-awesome-claude-code-create-test-builder && rm -rf "$T"
manifest:
skills/create-test-builder/SKILL.mdsource content
Test Data Builder Generator
Generates Test Data Builder and Object Mother patterns for test data creation.
Patterns
Test Data Builder
Fluent interface for constructing test objects with customizable properties.
When to use:
- Complex objects with many properties
- Need to customize specific properties per test
- Want to express test intent clearly
Object Mother
Factory methods returning pre-configured objects for common scenarios.
When to use:
- Standard test fixtures (default user, pending order)
- Shared across many tests
- Named scenarios (premium customer, expired subscription)
References
— Builder and Object Mother class templatesreferences/templates.md
— Complete Order example with Value Object builders and usagereferences/examples.md
Generation Instructions
-
Analyze the target class:
- Constructor parameters
- Required vs optional properties
- Value objects used
- State transitions (for entities)
-
Determine sensible defaults:
- Generate IDs automatically
- Use common/valid values
- Consider relationships
-
Create Builder with:
- Private constructor with defaults
- Static factory method (
,aOrder
)anEmail
methods for each propertywith*- Immutable (clone in each method)
methodbuild()
-
Create Mother with:
methoddefault()- Named scenarios (
,pending
,confirmed
)premium - Parameterized methods (
,forCustomer
)withTotal
-
File placement:
- Builders:
tests/Builder/{ClassName}Builder.php - Mothers:
tests/Mother/{ClassName}Mother.php
- Builders:
Best Practices
- Sensible defaults — Tests should work without customization
- Fluent interface — Chain method calls
- Immutable builders — Clone in each
methodwith* - Expressive names —
notpending()withStatus(pending) - Composition — Builders can use other Mothers/Builders
- Single Responsibility — One builder per aggregate/entity