Skip to content
Back to skills

Builder Factory

ASecurity

Create typed test data builders, with mimicry-js in TypeScript projects and factory_boy in Python projects. Use when the user asks for mock data, test fixtures, factories, seed data or fake objects for unit tests, Storybook stories or E2E scenarios, or mentions builders or factories, even indirectly ("I need realistic invoices for testing").

  • 2 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added October 13, 2026
developmenttypescriptpythontestingdatabase

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned November 11, 2026

npx -y skills add JanSzewczyk/claude-plugins --skill builder-factory --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Builder Factory?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Builder Factory
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/janszewczyk-builder-factory/badge)](https://www.skillsdirectory.com/skills/janszewczyk-builder-factory)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: builder-factory
description: Create typed test data builders, with mimicry-js in TypeScript projects and factory_boy in Python projects. Use when the user asks for mock data, test fixtures, factories, seed data or fake objects for unit tests, Storybook stories or E2E scenarios, or mentions builders or factories, even indirectly ("I need realistic invoices for testing").
allowed-tools: Read, Write, Edit, Glob, Grep
---

# Builder factory

Create or extend a test data builder for one type or model. The workflow is the same in every
language; the rules differ by library, so read only the rows for the project's language.

## Workflow

1. **Detect the stack.** `package.json` with `mimicry-js` → TypeScript rows. `pyproject.toml` or
   `requirements*.txt` with `factory-boy` → Python rows. Neither → ask which to use.
2. **Reuse first.** Search for existing builders (`**/*.builder.ts`) or factories
   (`**/factories.py`, `**/factories/*.py`) and extend one before creating another.
3. **Read the type or model**: fields, optional fields, enums, nested types, relations.
4. **Write the builder** next to the feature's tests, named after the type (`userBuilder` in
   `user.builder.ts`, `UserFactory` in `factories.py`).
5. **Show one usage** in the test that needed it, with explicit values for everything it asserts.

## Rules

Rows marked `any` apply in every language. Skip rows for the language this project does not use.

<!-- BEGIN:knowledge -->
<!-- generated by knowledge.mjs from 7 note(s) (sha256 b5392650ec48); edit the notes in knowledge/, then run build -->

| Impact | Rule | Applies to |
| --- | --- | --- |
| critical | [Place mimicry-js generators directly as field values, use Faker inside arrow functions](references/rules.md#place-mimicry-js-generators-directly-as-field-values-use-faker-inside-arrow-functions) — oneOf, int, sequence and friends resolve only at field level; inside () => they return a descriptor, not a value. | typescript, mimicry-js |
| high | [Set every value the test asserts on explicitly when you build test data](references/rules.md#set-every-value-the-test-asserts-on-explicitly-when-you-build-test-data) — Let the builder randomise what the test ignores; pass an override for every value the test checks. | any |
| high | [Pass asserted values as keyword arguments and model states as Traits](references/rules.md#pass-asserted-values-as-keyword-arguments-and-model-states-as-traits) — UserFactory.build(name=...) for one object, build_batch(n, ...) for lists, class Params Traits for named states. | python, factory-boy |
| high | [Build with .one() and .many() and pass overrides or traits for asserted values](references/rules.md#build-with-one-and-many-and-pass-overrides-or-traits-for-asserted-values) — userBuilder.one({ overrides }) for one object, .many(n) for lists, traits for named states. | typescript, mimicry-js |
| medium | [Reset builder counters and random state between tests that depend on them](references/rules.md#reset-builder-counters-and-random-state-between-tests-that-depend-on-them) — Sequences and seeded randomness carry over between tests; reset them where a test depends on their values. | any |
| medium | [Call Factory.build() unless the test needs the row in the database](references/rules.md#call-factorybuild-unless-the-test-needs-the-row-in-the-database) — Calling the factory directly runs create() and writes to the database; build() keeps a test in memory. | python, factory-boy |
| medium | [Call builder.reset() in beforeEach when a test depends on sequence values](references/rules.md#call-builderreset-in-beforeeach-when-a-test-depends-on-sequence-values) — reset() restarts sequence() and unique() counters; seed() makes oneOf, int, float and bool reproducible. | typescript, mimicry-js |

<!-- END:knowledge -->

Files in this skill

  • SKILL.md5.8 KB
  • references/examples.md9.9 KB
  • references/field-mappings.md3.8 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.