doctrine-fetch-modes

doctrine-fetch-modes is a skill for Claude Code from dev-toolings/superpowers-symfony. It costs 31 tokens per session (590 once invoked), scanned A, original, MIT.

A guide for controlling how Doctrine reads database records and related data. It covers creating small data-transfer objects, lazy loading, query hints, and direct database access through DBAL 4.

In plain words
What is it for?
Use it when designing entity queries, selecting only required fields, optimizing related-data loading, or choosing between Doctrine ORM and DBAL.
Why use it?
It helps avoid loading more data than a request needs and reduces repeated database queries. This can make data-heavy Symfony pages and endpoints easier to tune.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Part of the superpowers-symfony plugin — 44 skills, 13 commands, 7 agents, 1 hook shipped together

Good fit Use it when designing entity queries, selecting only required fields, optimizing related-data loading, or choosing between Doctrine ORM and DBAL.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/dev-toolings/superpowers-symfony/doctrine-fetch-modes
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add dev-toolings/superpowers-symfony --skill doctrine-fetch-modes
Clone the repo
git clone --depth 1 https://github.com/dev-toolings/superpowers-symfony

Made for: Claude Code.

Or install superpowers-symfony, the plugin that ships this one along with the rest of its 44 skills, 13 commands, 7 agents, 1 hook.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for doctrine-fetch-modes

README.md
[![agentmods](https://agentmods.dev/badge/skills/dev-toolings/superpowers-symfony/doctrine-fetch-modes/github.svg)](https://agentmods.dev/skills/dev-toolings/superpowers-symfony/doctrine-fetch-modes)
Your own site
<a href="https://agentmods.dev/skills/dev-toolings/superpowers-symfony/doctrine-fetch-modes"><img src="https://agentmods.dev/badge/skills/dev-toolings/superpowers-symfony/doctrine-fetch-modes/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for doctrine-fetch-modes

Your own site · 80×15
<a href="https://agentmods.dev/skills/dev-toolings/superpowers-symfony/doctrine-fetch-modes"><img src="https://agentmods.dev/badge/skills/dev-toolings/superpowers-symfony/doctrine-fetch-modes.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 31 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 590 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00031 $0.00590
Opus 5.5 $0.00012 $0.00236
Sonnet 5.5 $0.00006 $0.00118
Haiku 4.5 $0.00003 $0.00059

Measured 1mo ago against content hash f5696fc8a464, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

doctrine-fetch-modes scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

content/skills/doctrine-fetch-modes/SKILL.md · 49 lines

What it actually says

Doctrine Fetch Modes (Symfony)

Use when

  • A list or detail endpoint runs one query per row (N+1) on a relation.
  • A read-only list needs a few columns, not full managed entities.
  • Choosing LAZY, EAGER or EXTRA_LAZY on a mapping, or porting ORM 2 code that relied on PARTIAL objects.
  • A report or projection query drops to raw SQL through DBAL 4.

Default workflow

  1. Confirm the N+1 or over-fetch in the Symfony profiler before changing any mapping.
  2. Keep relations on fetch: 'LAZY'; set fetch: 'EXTRA_LAZY' on large collections so count(), contains() and slice() run targeted SQL.
  3. Load the relations a use case needs with a fetch join in the repository (addSelect() plus leftJoin()).
  4. For read-only lists, project into a readonly DTO with SELECT NEW (constructor argument order must match the NEW list).
  5. Use Query::HINT_READ_ONLY or an index-by alias (createQueryBuilder('p', 'p.id')) when the result is only displayed or looked up by id.
  6. For raw SQL, use the DBAL 4 methods (fetchAllAssociative(), fetchOne(), executeStatement()).

Guardrails

  • PARTIAL in DQL fails on ORM 3.0 to 3.2 and only returns from 3.3: use SELECT NEW DTOs for read-only lists instead.
  • Avoid fetch: 'EAGER' on a mapping; a fetch join in the query gives the same result per use case.
  • SELECT NEW returns DTOs, not managed entities: never modify or flush them.
  • DBAL 4 removed query(), exec() and fetchAll().

Progressive disclosure

  • Use this file for execution posture and risk controls.
  • Open references when deep implementation details are needed.

Output contract

  • Repository methods with the fetch strategy chosen per use case.
  • DTO classes and the SELECT NEW queries that fill them.
  • Query count before and after, from the profiler or doctrine:query:dql --show-sql.

References

  • reference.md
Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago Changed · +4 lines · -4 tokens per session f5696fc8a464
  2. 2mo ago Changed · +2 lines · -3 tokens per session c1f0c8f02f02
  3. 3mo ago First seen · 43 lines · 38 tokens per session scan A cf4ed4818146

Subscribe to this mod's changes

doctrine-fetch-modes is a skill published in the GitHub repository dev-toolings/superpowers-symfony (235 stars, last pushed 19d ago), licensed MIT. It adds 31 tokens to every session and 590 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

doctrine-fetch-modes compared with skills from other repositories

doctrine-fetch-modes next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
doctrine-fetch-modesdev-toolings/superpowers-symfonySkill23519d agoMITA31Claude Code
database-performanceAaronontheweb/dotnet-skillsSkill1.3k10d agoMITA44Claude Code
flux-migratetonone-ai/tononeSkill842d agoMITA51Claude Code
forge-infratonone-ai/tononeSkill842d agoMITA53Claude Code
flux-schematonone-ai/tononeSkill842d agoMITA55Claude Code
flux-recontonone-ai/tononeSkill842d agoMITA48Claude Code
forge-audittonone-ai/tononeSkill842d agoMITA54Claude Code