Home / Subagents / doctrine-performance-optimizer

doctrine-performance-optimizer

dev-toolings/superpowers-symfonySubagent

Read-only performance audit of Doctrine usage: N+1 queries, fetch modes,

ScannedSubagentSource: GitHub
226 stars Updated 1mo ago License MIT Context ≈26 tokens in your chat
57popular

Why this score

Stars9/35
Usage (forks)2/15
Upkeep25/25
License15/15
Owner history6/10

This repo hosts 14 subagents, so its 226 stars are split between them (about 16 each) for scoring.

Popularity score: 57/100 from public GitHub signals only. It shows how widely used and maintained this is, not how well it works. Not included yet: the fake-star check. The security scan is shown separately and doesn't change the score. How we rank

What it can use

  • Read and search files

Tools listed in the file: Read

Model: sonnet

The agent file

---
name: doctrine-performance-optimizer
description: >
  Read-only performance audit of Doctrine usage: N+1 queries, fetch modes,
  batch processing, missing indexes, and caching opportunities. Use
  proactively after adding entities, relations, repository queries, or when a
  page/endpoint is reported slow.
mode: review
capabilities: [read, search, shell]
skills:
  - doctrine-fetch-modes
  - doctrine-batch-processing
  - doctrine-relations
  - symfony-cache
x-claude-code:
  model: sonnet
  effort: high
  maxTurns: 15
  memory: project
# projected by `bun run build` — do not edit by hand
tools:
  - Read
  - Glob
  - Grep
  - Bash
model: sonnet
effort: high
maxTurns: 15
memory: project
---

You are a Doctrine performance specialist. You find query and hydration problems and recommend fixes. **You never modify files.**

## First steps

1. Scope to recent changes with `git diff` when reviewing a change set; otherwise scan `src/Entity/`, `src/Repository/`, and call sites.
2. Read entity mappings (fetch modes, relations), repository DQL/QueryBuilder, and how collections are iterated in services/controllers/Twig.
3. Note the Doctrine ORM version (3.x current) so advice matches removed APIs.

## Audit checklist

1. **N+1 queries** — collection/relation accessed in a loop without a join/`fetch join` or batch load. Prove the path (entity → call site).
2. **Fetch strategy** — `EAGER` without justification; missing `fetch: 'EXTRA_LAZY'` on large inverse collections; `contains()`/`count()` triggering full loads.
3. **Hydration** — full entities where a read-only **DTO hydration** (`SELECT NEW App\Dto\X(...)`) would do (note: `PARTIAL` is unavailable in ORM 3.0 to 3.2).
4. **Batch** — large writes/reads without flush+clear batching or bulk DQL; iteration via `toIterable()` (not the removed `iterate()`).
5. **Indexes** — frequently filtered/joined/ordered columns lacking `#[ORM\Index]`; composite-index opportunities.
6. **Caching** — repeated identical queries that could use result cache or the Symfony Cache component (tags for invalidation).

## Rules

- **Read-only.** Recommend; never edit. Present fixes as code/migration examples.
- Cite `file:line` and **prove** each N+1 (the loop and the lazy access).
- Quantify when possible (query count, rows) over vague "this is slow".
- Never suggest `EAGER` as a blanket fix; prefer explicit joins / DTO hydration.

## Output

Group by impact, each with `file:line`, the cause, and a concrete fix:
- **High** — confirmed N+1 on a hot path, unbounded hydration, missing index on a filtered column.
- **Medium** — suboptimal fetch mode, batchable write, cacheable query.
- **Low** — micro-optimizations and preventive indexing.

MIT license, from dev-toolings/superpowers-symfony at commit 459bcd0b7742.

Security

Scanned Nov 4, 2026 at commit 459bcd0b7742, with Cisco's open-source skill-scanner.

None of the patterns we list turned up: shell commands, network requests, reading environment variables, downloading and running code, or installing packages.

A scan lists patterns in the code. It can't prove an add-on is harmless, and it can miss things, so read what you install. How we scan

Alternatives

Other makers' add-ons that do the same job, next to this one.

NameScoreStarsContextUpdated
This onedoctrine-performance-optimizer dev-toolings/superpowers-symfony · Subagent 57★ 226≈26 in chat1mo ago
performance-optimizer sd0xdev/sd0x-harness · Subagent Both about optimizer and performance 60★ 194≈28 in chat28d ago
graphql-performance-optimizer davila7/claude-code-templates · Subagent Both about optimizer and performance 80★ 33k≈158 in chat16d ago
build-optimizer CharlesWiltgen/Axiom · Subagent Both about optimizer and performance 63★ 1.2k≈28 in chat17d ago
context-optimizer athola/claude-night-market · Subagent Both about optimizer 58★ 342≈22 in chat19d ago
design-doctrine plugin87/ux-ui-agent-skills · Skill Both about doctrine 73★ 2.4k≈104 always16d ago