Skip to main content
skill CX Codex

doctrine-batch-processing — Claude Code skill for Doctrine batches

doctrine-batch-processing is a Claude Code skill for processing large Doctrine datasets in memory-conscious imports, exports, and backfills.

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-batch-processing -a claude-code
Open on GitHub

What doctrine-batch-processing does

The skill starts with measuring the dataset and the process memory budget. It recommends streaming entities with toIterable() or paging through very large tables by ID. Flush and clear after a chosen batch size, then load again any entities needed after clearing.

For bulk changes, it weighs ORM against DQL and DBAL when entity hydration is unnecessary. Those bulk paths bypass lifecycle events and listeners, so check whether your application relies on them. ORM 3 calls for toIterable() rather than Query#iterate(); use logging middleware in place of setSQLLogger().

Avoid findAll() on a table that keeps growing. The skill also calls for an explicit batch size and clear points, memory measurements on a realistic dataset, and a resumable run.

What it helps with

  • stream an import that exceeds available memory
  • export a large table without loading every entity
  • update or delete many rows with bulk DQL
  • insert large volumes through Doctrine or DBAL
  • make a batch run resumable after interruption

Example prompts for the agent

  • Process this import in Doctrine batches and record memory before and after the run.
  • Build an export for a large table with toIterable() and clear the EntityManager between batches.
  • Choose ORM, DQL or DBAL for this bulk update and account for lifecycle events.

How to install doctrine-batch-processing

1Skills CLI (Vercel)

npx skills add dev-toolings/superpowers-symfony --skill doctrine-batch-processing -a claude-code

2Manually: put the files in place

~/.claude/skills/doctrine-batch-processing/SKILL.md

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

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

Questions about doctrine-batch-processing

How do I install doctrine-batch-processing in Claude Code?

Run npx skills add dev-toolings/superpowers-symfony --skill doctrine-batch-processing -a claude-code. The skill file is at ~/.claude/skills/doctrine-batch-processing/SKILL.md.

What does doctrine-batch-processing do?

It guides large-data workflows in Doctrine: streaming or ID-based reads, periodic flush and clear, and choosing ORM, DQL or DBAL for writes. It also covers memory checks and operational safeguards.

Why does the skill recommend paging by ID instead of offset?

Offsets can slow down and skip rows as the dataset changes. Paging by ID avoids those issues described in the skill.

Source text

SKILL.md · MIT
---
name: doctrine-batch-processing
description: Process large datasets with Doctrine (ORM 3 toIterable, flush+clear, bulk DQL) and memory management
capabilities: [read, search, edit, shell]
tags: [doctrine, performance]
# projected by `bun run build` — do not edit by hand
allowed-tools:
  - Read
  - Glob
  - Grep
  - Write
  - Edit
  - Bash
---

# Doctrine Batch Processing (Symfony)

## Use when
- Processing more rows than fit in memory: imports, exports, backfills.
- A command or worker runs out of memory iterating over entities.
- Updating or deleting many rows at once.
- Inserting large volumes through Doctrine or DBAL.

## Default workflow
1. Measure the dataset size and the memory budget of the process.
2. Stream reads with `toIterable()`, or paginate by id (`id > :lastId`) for very large tables.
3. Flush and `clear()` every N items, and re-fetch anything needed after a clear.
4. Use DQL `UPDATE`/`DELETE` or DBAL for bulk writes that need no hydration.
5. Log memory usage and progress, and make the run resumable.

## Guardrails
- Never `findAll()` on a table that grows.
- Entities loaded before a `clear()` are detached: do not modify or persist them.
- Bulk DQL and DBAL skip lifecycle events and listeners. Check what relies on them.
- On ORM 3, `Query#iterate()` and `setSQLLogger()` are gone: use `toIterable()` and a logging middleware.
- Paginate by id rather than by offset: offsets get slower and skip rows when data moves.

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

## Output contract
- A batch loop with an explicit batch size and clear points.
- The choice between ORM, DQL bulk and DBAL for each write, with the reason.
- Memory measurements before and after on a realistic volume.

## References
- `reference.md`

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

Similar skills

All skills for Backend and APIs →

From the same set51

The whole set →
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-fixtures-foundry 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. 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 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 runner-selection The runner-selection skill detects whether Symfony commands belong in Docker, DDEV, or the host environment. Use it when the right command prefix is unclear or containers may be stopped. CX Codex +1 ★ 234repo stars doctrine-events doctrine-events — a Claude skill for attaching side effects to Doctrine entity events in Symfony: timestamps, slugs, search index updates, notifications. CX Codex +1 ★ 234repo stars

Project sponsors

Companies that keep this analytics open