Test Data Builder
Installation
SKILL.md
Test Data Builder
Produce per-test domain data that is realistic, deterministic, and isolated. The costly failure this prevents is the shared fixture file that becomes an append-only god object: one test tweaks a record, three unrelated tests start flaking, and nobody can delete a fixture row because nobody knows who depends on it. Builders with valid defaults make every test self-describing and every failure reproducible.
Operating procedure
Order matters: defaults must be valid before overrides mean anything, and determinism must be in place before you add realistic randomness.
Step 1: Gather inputs
Collect before writing a factory. Defaults in parentheses; label guesses as guesses.
- The domain object(s) under test and their required fields.
- The stack's factory library (FactoryBot for Ruby, Fishery or test-data-bot for TypeScript, factory_boy for Python, Bogus/AutoFixture for .NET; default: hand-rolled builder if none exists).
- Whether tests touch a real database, and the isolation mechanism available (per-test transaction rollback preferred).
- The invariants a "valid" object must satisfy - validations, foreign keys, non-null constraints.