doctrine-transactions — Claude Code skill: setup and usage
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.
MIT ★ 234 updated 2026-10-05
npx skills add dev-toolings/superpowers-symfony --skill doctrine-transactions -a claude-codeWhat doctrine-transactions does
The skill enforces putting transaction boundaries in service layers instead of controllers. Because Doctrine ORM 3 dropped EntityManager::transactional(), it guides the model to group modifications inside wrapInTransaction() with a single flush(). Outside an explicit transaction, each flush commits individually, which causes partial writes.
It also sets concurrency controls. Edits rely on #[ORM\Version] for optimistic locking, while tight critical sections receive PESSIMISTIC_WRITE. Transactions and locks must stay brief: making HTTP calls or sending emails inside them is prohibited.
When a flush fails, a constraint breaks, or a rollback occurs, the skill directs the agent to clear the EntityManager. You cannot reuse entity instances from a failed unit of work, so fresh data must be retrieved from scratch.
What it helps with
- Wrap multi-table writes inside
wrapInTransaction()using Doctrine ORM 3 - Add optimistic concurrency checks via
#[ORM\Version] - Guard sensitive updates with short
PESSIMISTIC_WRITEblocks - Reset the
EntityManagerafter constraint errors and rollbacks
Example prompts for the agent
- Refactor order checkout to use
wrapInTransaction()with a single flush in the service - Add optimistic locking with
#[ORM\Version]to the user profile entity and catchOptimisticLockException - Protect wallet balance updates with
PESSIMISTIC_WRITEand keep HTTP calls outside the transaction
How to install doctrine-transactions
1Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill doctrine-transactions -a claude-code2Manually: put the files in place
~/.claude/skills/doctrine-transactions/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/doctrine-transactions/
1Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill doctrine-transactions -a codex2Manually: put the files in place
.agents/skills/doctrine-transactions/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill doctrine-transactions -a cursor2Manually: put the files in place
.cursor/skills/doctrine-transactions/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install dev-toolings/superpowers-symfony content/skills/doctrine-transactions2Manually: put the files in place
.github/skills/doctrine-transactions/SKILL.md1Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill doctrine-transactions -a gemini-cli2Platform CLI
gemini skills install https://github.com/dev-toolings/superpowers-symfony --path content/skills/doctrine-transactionsManually: put the files in place
.devin/skills/doctrine-transactions/SKILL.mdThe legacy .windsurf/skills/ path still works
Claude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about doctrine-transactions
How to install doctrine-transactions in Claude Code?
Run npx skills add dev-toolings/superpowers-symfony --skill doctrine-transactions -a claude-code or save the definition file to ~/.claude/skills/doctrine-transactions/SKILL.md.
What does doctrine-transactions do?
It instructs Claude Code to organize Symfony database operations with clean service boundaries, Doctrine ORM 3 transaction wrappers, and explicit locking.
Why does the skill forbid HTTP calls inside transactions?
Pessimistic locks and database transactions tie up database connections. Network calls add latency, keeping database locks open and increasing timeout risks.
Source text
SKILL.md · MIT
--- name: doctrine-transactions description: Handle Doctrine transactions (ORM 3 wrapInTransaction), optimistic/pessimistic locking, flush strategies, and transaction boundaries capabilities: [read, search, edit, shell] tags: [doctrine] # projected by `bun run build` — do not edit by hand allowed-tools: - Read - Glob - Grep - Write - Edit - Bash --- # Doctrine Transactions (Symfony) ## Use when - Several writes must succeed or fail together. - Two users or workers can edit the same row concurrently. - Deciding where to flush and who owns the transaction boundary. - Recovering after a failed flush, a constraint violation, or a lost connection. ## Default workflow 1. Place the transaction boundary in the service layer, not in the controller. 2. Group related changes and flush once, inside `wrapInTransaction()`. 3. Pick the concurrency strategy: `#[ORM\Version]` optimistic locking for edits, `PESSIMISTIC_WRITE` for short critical sections. 4. Handle `OptimisticLockException` and constraint violations explicitly. 5. After a rollback, clear the EntityManager and re-fetch what you still need. ## Guardrails - On ORM 3, `EntityManager::transactional()` is gone: use `wrapInTransaction()`. - Outside an explicit transaction each flush commits on its own, so avoid several flushes per operation. - Keep transactions and pessimistic locks short; no HTTP calls or mail inside. - Do not reuse entities from a failed unit of work. ## Progressive disclosure - Use this file for execution posture and risk controls. - Open references when deep implementation details are needed. ## Output contract - Transaction boundaries with a single flush per operation. - The locking strategy chosen per entity, and how conflicts reach the user. - Rollback handling and the state of the EntityManager after it. ## References - `reference.md`
© dev-toolings · MIT · dev-toolings/superpowers-symfony