Skip to main content
skill CX Codex

doctrine-fixtures-foundry — Claude Code skill

doctrine-fixtures-foundry teaches the agent to build Doctrine test data with Zenstruck Foundry v2 factories: named states, sequences and entity relations. Triggers when you write fixtures or migrate factories from Foundry v1.

MIT ★ 234 updated 2026-10-05

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add dev-toolings/superpowers-symfony --skill doctrine-fixtures-foundry -a claude-code
Open on GitHub

What doctrine-fixtures-foundry does

The skill sets a workflow for generating test and dev data in a Symfony project: one PersistentObjectFactory per entity, defaults() kept to required fields only, and every variation expressed as an immutable named state like admin() or published(). Related entities come from OtherFactory::new() calls inside the factory, and shared scenarios go into stories.

It also guards against common breakage: any column with a unique constraint gets self::faker()->unique() so tests stop colliding. Calling ->object() or ->_real() is off-limits since v2 factories already hand back real objects. When a failure needs to be reproducible, it seeds Faker via FOUNDRY_FAKER_SEED.

A bundled reference.md holds deeper implementation detail the agent can open on demand. Migrating legacy v1 factories is an explicit trigger, so the skill covers upgrades rather than only greenfield work.

What it helps with

  • generate a Foundry v2 factory for a Doctrine entity
  • express object variations as named states
  • create related entities in a test without hand-written setup
  • migrate Foundry v1 factories and ->object() calls to v2
  • make Faker-driven test failures reproducible

Example prompts for the agent

  • Write a Foundry factory for the User entity with an admin() state
  • Migrate my old Foundry v1 factories to v2
  • Build a story with a user, an order and three items for cart tests

How to install doctrine-fixtures-foundry

1Skills CLI (Vercel)

npx skills add dev-toolings/superpowers-symfony --skill doctrine-fixtures-foundry -a claude-code

2Manually: put the files in place

~/.claude/skills/doctrine-fixtures-foundry/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/doctrine-fixtures-foundry/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about doctrine-fixtures-foundry

How do I install doctrine-fixtures-foundry in Claude Code?

Run npx skills add dev-toolings/superpowers-symfony --skill doctrine-fixtures-foundry -a claude-code and the skill lands in ~/.claude/skills/doctrine-fixtures-foundry/SKILL.md.

What does doctrine-fixtures-foundry do?

It gives the agent rules for working with Zenstruck Foundry v2: PersistentObjectFactory factories returning real objects, named states, sequences, relations and stories for shared scenarios.

Does it help with migrating from Foundry v1?

Yes — migrating v1 factories and ->object() calls is a listed trigger. In v2 factories return real objects, so ->object() and ->_real() are no longer needed.

Source text

SKILL.md · MIT
---
name: doctrine-fixtures-foundry
description: Create test data with Zenstruck Foundry v2 factories (PersistentObjectFactory, real objects); define states, sequences, and relationships
capabilities: [read, search, edit, shell]
tags: [doctrine, testing]
# projected by `bun run build` — do not edit by hand
allowed-tools:
  - Read
  - Glob
  - Grep
  - Write
  - Edit
  - Bash
---

# Doctrine Fixtures Foundry (Symfony)

## Use when
- Creating test or development data for Doctrine entities.
- Writing a Foundry factory, a named state, a sequence, or a story.
- Building related entities for a test without hand-written setup.
- Migrating legacy Foundry v1 factories or `->object()` calls to v2.

## Default workflow
1. Generate a factory per entity and keep `defaults()` to required and unique fields.
2. Express each variation as an immutable named state (`admin()`, `published()`).
3. Let factories create default relations with `OtherFactory::new()`.
4. Group shared scenarios in stories, and reset the database per test class.
5. Assert on real objects and on the repository through `Factory::assert()`.

## Guardrails
- Use `self::faker()->unique()` for every unique column, or tests collide.
- Do not call `->object()` or `->_real()`: v2 factories return real objects.
- Seed Faker (`FOUNDRY_FAKER_SEED`) when a failure must be reproducible.
- Do not build a factory for trivial data a test can create inline.

## Progressive disclosure
- Use this file for execution posture and risk controls.
- Open references when deep implementation details are needed.

## Output contract
- Factories with minimal defaults, named states and relation defaults.
- Stories for shared scenarios, when more than one test needs them.
- Test setup wired with the Foundry extension and `#[ResetDatabase]`.

## References
- `reference.md`

© dev-toolings · MIT · dev-toolings/superpowers-symfony

Similar skills

All skills for Testing and QA →

From the same set51

The whole set →
daily-workflow The daily-workflow skill lays out a routine for Symfony work, from getting a project running to checking changes before a commit. Use it for migrations, debugging, and recurring maintenance. CX Codex +1 ★ 234repo stars bootstrap-check bootstrap-check runs a pass/fail check over a Symfony project's setup: .env, services, Doctrine mappings, routes. Each failure comes with the fix. CX Codex +1 ★ 234repo stars ports-and-adapters ports-and-adapters guides Claude Code in setting up Hexagonal Architecture in Symfony, isolating domain models from Doctrine, HTTP, and vendor SDKs. CX Codex +1 ★ 234repo stars config-env-parameters The config-env-parameters skill guides changes to Symfony environment variables, parameters, and secrets across environments. Use it when configuration needs a clear home and safe injection into the app. CX Codex +1 ★ 234repo stars doctrine-transactions doctrine-transactions guides Claude Code on managing Doctrine ORM 3 transactions, locking strategies, and flush boundaries in Symfony applications. Fits concurrent row edits and rollback recovery. CX Codex +1 ★ 234repo stars doctrine-batch-processing doctrine-batch-processing is a Claude Code skill for processing large Doctrine datasets in memory-conscious imports, exports, and backfills. CX Codex +1 ★ 234repo stars controller-cleanup The controller-cleanup skill extracts business logic from fat Symfony controllers into services, handlers and commands. Leaves actions lean, delegating and responding only. CX Codex +1 ★ 234repo stars brainstorming brainstorming structures feature discovery for Symfony projects: clarifies unclear requirements, identifies framework components, and compares architecture designs. CX Codex +1 ★ 234repo stars

Project sponsors

Companies that keep this analytics open