api-platform-dto-resources

api-platform-dto-resources is a skill for Claude Code from gerard-labs/superpowers-api-platform. It costs 130 tokens per session (578 once invoked), scanned A, original, MIT.

A guide for using input and output data objects in API Platform 4.3 instead of exposing database entities directly. These objects define the data an API accepts and returns, while validation checks requests at the boundary.

In plain words
What is it for?
Use it when defining create or update payloads, validating API data, representing linked resources with IRIs, using enum values, or connecting DTOs through providers, processors, or the Symfony Object Mapper.
Why use it?
It helps keep the public API shape independent from database design and allows different validation rules for different operations. It also reduces repetitive mapping code when the conversion is simple.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Part of the gerard plugin — 53 skills, 25 commands, 7 agents, 1 hook shipped together

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.

agentmods
npx agentmods add skills/gerard-labs/superpowers-api-platform/api-platform-dto-resources
Any agent
npx skills add gerard-labs/superpowers-api-platform --skill api-platform-dto-resources
Clone the repo
git clone --depth 1 https://github.com/gerard-labs/superpowers-api-platform

Made for: Claude Code.

Or install gerard, the plugin that ships this one along with the rest of its 53 skills, 25 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 api-platform-dto-resources

README.md
[![agentmods](https://agentmods.dev/badge/skills/gerard-labs/superpowers-api-platform/api-platform-dto-resources.svg)](https://agentmods.dev/skills/gerard-labs/superpowers-api-platform/api-platform-dto-resources)
Your own site
<a href="https://agentmods.dev/skills/gerard-labs/superpowers-api-platform/api-platform-dto-resources"><img src="https://agentmods.dev/badge/skills/gerard-labs/superpowers-api-platform/api-platform-dto-resources.svg" alt="Measured on agentmods" height="20"></a>
Per session 130 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 578 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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.00130 $0.00578
Opus 5 $0.00065 $0.00289
Sonnet 5 $0.00026 $0.00116
Haiku 4.5 $0.00013 $0.00058

Measured 5d ago against content hash 44a6f4e644d9, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

api-platform-dto-resources 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 5d 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.

skills/api-platform-dto-resources/SKILL.md · 44 lines

What it actually says

API Platform 4.3 — Input/Output DTOs (+ Object Mapper 4.3)

Use when

  • The API contract should not be a one-to-one reflection of the Doctrine entity.
  • Validation rules differ per operation (CreateOrderInput vs UpdateOrderInput).
  • The contract needs IRI-only relations and BackedEnum statuses.
  • A simple CRUD could benefit from the new Symfony Object Mapper 4.3 to skip Provider/Processor boilerplate.

Default workflow

  1. Decide: pure DTO (full Provider/Processor) or Object Mapper 4.3 (when mapping is mechanical).
  2. Define Input and Output DTOs as final readonly with Symfony validator attributes.
  3. Wire them on the operation (input:, output:, processor: / provider:) — or annotate with #[Map] if using Object Mapper.
  4. Test the contract: 201 with the right shape, 422 on invalid payload, IRI resolution.

Guardrails

  • DTOs hold no business logic — just validated transport.
  • Always type relations as Resources (Customer $customer), never scalar IDs.
  • Use BackedEnum for any status / type / category — never free string.
  • Object Mapper 4.3 is for mechanical mapping only. Persistence logic, aggregation, side effects → keep an explicit Processor.

Progressive disclosure

  • SKILL.md lists the decision and the four steps.
  • reference.md covers the full DTO patterns + Object Mapper 4.3 (#[Map(source:)], transformers, when it auto-activates).

Output contract

  • New final readonly Input/Output classes.
  • The #[ApiResource] operation wired with the right input / output / processor / provider (or #[Map] annotations).
  • Validation + IRI-resolution coverage in functional tests.

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. 5d ago First seen · 44 lines · 130 tokens per session scan A 44a6f4e644d9

Subscribe to this mod's changes

api-platform-dto-resources is a skill published in the GitHub repository gerard-labs/superpowers-api-platform (2 stars, last pushed 3mo ago), licensed MIT. It adds 130 tokens to every session and 578 once invoked, about $0.0006 per session on Opus 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-31.