add-api-dto-mapping

add-api-dto-mapping is a skill for Claude Code, Codex from tarlepp/symfony-flex-backend. It costs 38 tokens per session (1,425 once invoked), scanned A, original, MIT.

Repository guidance for API data-transfer objects in PHP applications. An API data-transfer object, or DTO, defines the data an endpoint accepts and how that request is validated and converted for the application.

In plain words
What is it for?
Use it when adding or changing API DTOs, validation rules, request mappings, argument resolution, or related endpoint tests.
Why use it?
It keeps request fields, types, defaults, validation, and mappings consistent across create, update, and partial-update operations.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when adding or changing API DTOs, validation rules, request mappings, argument resolution, or related endpoint tests.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/tarlepp/symfony-flex-backend/add-api-dto-mapping
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 tarlepp/symfony-flex-backend --skill add-api-dto-mapping
Clone the repo
git clone --depth 1 https://github.com/tarlepp/symfony-flex-backend

Made for: Claude Code, Codex.

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 add-api-dto-mapping

README.md
[![agentmods](https://agentmods.dev/badge/skills/tarlepp/symfony-flex-backend/add-api-dto-mapping/github.svg)](https://agentmods.dev/skills/tarlepp/symfony-flex-backend/add-api-dto-mapping)
Your own site
<a href="https://agentmods.dev/skills/tarlepp/symfony-flex-backend/add-api-dto-mapping"><img src="https://agentmods.dev/badge/skills/tarlepp/symfony-flex-backend/add-api-dto-mapping/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 add-api-dto-mapping

Your own site · 80×15
<a href="https://agentmods.dev/skills/tarlepp/symfony-flex-backend/add-api-dto-mapping"><img src="https://agentmods.dev/badge/skills/tarlepp/symfony-flex-backend/add-api-dto-mapping.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 38 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,425 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.
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.00038 $0.01425
Opus 5.5 $0.00015 $0.00570
Sonnet 5.5 $0.00008 $0.00285
Haiku 4.5 $0.00004 $0.00143

Measured yesterday against content hash 562c2166866a, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

add-api-dto-mapping 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 yesterday.

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.

.github/skills/add-api-dto-mapping/SKILL.md · 123 lines

How it starts

The opening of the file, as written. The whole thing — 123 lines — stays where its author put it; the contents beside it link to each section on GitHub.

What is this?

Use this skill when adding or changing an API DTO, its validation, request mapping, or argument resolution without necessarily adding a complete CRUD resource. For a full resource or persistence change, also follow .github/skills/add-rest-resource/SKILL.md or .github/skills/add-doctrine-entity/SKILL.md as appropriate.

Follow the shared skill guidance, including .github/copilot-instructions.md and doc/AI_RULES.md.

Table of Contents ᐞ

Workflow ᐞ

  1. Read composer.json for installed packages and supported versions, and symfony.lock for recipes. Trace the affected endpoint through its controller DTO selection, RestDtoValueResolver, AutoMapper configuration, request mapper, DTO, and resource validation/persistence. Inspect nearby tests and BodySubscriber when request-body handling matters. Use src/DTO/User/ and src/AutoMapper/User/ as references, not as templates to copy without checking the target feature.
  2. Establish which fields callers may supply, which operations accept them, and the required types, defaults, nullability, and response exposure. Distinguish omitted fields from explicit null, empty strings, empty arrays, false, and zero. Ask before changing an unspecified API contract, relationship replacement/addition policy, or authorization boundary.
  3. Extend the existing DTO family under src/DTO/. REST DTOs follow RestDto and RestDtoInterface, with operation-specific create, update, and patch subclasses where needed. Keep properties, accessors, and collection types explicit. Setters for writable fields must record setVisited() consistently with the field's intended null semantics; do not mark omitted fields as visited or mark fields visited while loading existing entity state. Do not apply blanket readonly or constructor-only patterns to these mutable DTOs.
  4. Add Symfony Validator constraints to the appropriate DTO properties or classes, preserving operation-specific requirements such as create-only password constraints. Reuse existing custom constraints in src/Validator/ when appropriate. Inspect RestResource::getDtoForEntity() and RestResourceBaseMethods: patch loads existing state before merging visited input and validating, whereas update starts from a fresh DTO. Do not weaken required-field validation to make partial requests pass.
  5. Update the feature's RequestMapper under src/AutoMapper/, extending RestRequestMapper. Its $properties list is the writable-field allowlist; expose only intended inputs. The base mapper reads present fields from $request->request, calls matching setters, and uses transform<Property>() methods when defined. Keep conversions there rather than manually mapping request data in controllers or services. Preserve explicit failures for invalid values; do not silently substitute defaults, discard invalid references, or coerce incompatible input.
  6. For relations and enums, follow nearby transformers and validation. Relation IDs can be resolved through the corresponding resource's getReference() and checked with EntityReferenceExists; obtaining a reference alone does not prove that the entity exists or that the caller may associate it. Preserve relevant authorization checks. Keep relationship application in existing DTO $mappings hooks, including replacement versus additive patch behavior such as PatchUserGroups. Keep unrelated business logic in resources or services.
  7. Register every affected request DTO in the feature's AutoMapperConfiguration::$requestMapperClasses, extending RestAutoMapperConfiguration and injecting the feature request mapper. Check the controller's method-to-DTO selection. Reuse RestDtoValueResolver: it resolves RestDtoInterface arguments for supported actions in the registered controller collection, not arbitrary concrete DTO arguments or custom endpoints. Do not introduce a parallel request-binding mechanism or change shared resolvers just to support one field. If resolver changes are required, inspect service registration and preserve unrelated argument resolution and decorator behavior.
  8. Keep DTO load(), visited-field updates, and custom mapping hooks consistent with the entity and resource flow. Inspect the actual response serializer context, groups, and OpenAPI metadata separately; a request DTO change does not automatically change response exposure. Never expose credentials or privileged fields incidentally. Preserve the endpoint's established output contract rather than adding a new response-mapping architecture as part of an input-only change.
  9. Follow .github/skills/write-tests/SKILL.md. Inspect tests/Integration/DTO/, tests/Integration/AutoMapper/, and tests/Integration/ValueResolver/RestDtoValueResolverTest.php for existing helpers. Cover setters and visited fields, transformations, registered DTO mappings, validation, and entity updates as relevant. Exercise omitted versus explicit values, invalid enums or references, and create/update/patch differences. For API contract or wiring changes, also test through the real HTTP boundary, including JSON body handling, error responses, persistence, authorization, and sensitive-field exclusion where affected. Direct mapper calls alone do not verify the complete request flow.
  10. Update relevant API metadata and existing documentation when the accepted input, output, validation, or patch semantics change. Do not generate a migration for a DTO-only change; use the entity skill when persisted mapping actually changes.

Read the full file on GitHub · 123 lines

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. yesterday First seen · 123 lines · 38 tokens per session scan A 562c2166866a

Subscribe to this mod's changes

add-api-dto-mapping is a skill published in the GitHub repository tarlepp/symfony-flex-backend (288 stars, last pushed today), licensed MIT. It adds 38 tokens to every session and 1,425 once invoked, about $0.0002 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-10-21.

Related

Other skills, from other repositories

api-platform-upgrade

Migrate an API Platform codebase from 3.x or 4.0–4.2 up to 4.3. Trigger when composer.lock shows api-platform/ < 4.3, when grep finds.

gerard-labs/superpowers-api-platform · 49 tokens

api-platform-identifiers

Choose and wire up API Platform 4.3 resource identifiers — UUID v7 (recommended for temporal cursor pagination), ULID, scalar (string/int), \DateTimeInterface, composite identifiers via Link(uriVariables: …), custom identifiers (slug) with #[ApiProperty(identifier: true)], decorating UriVariableTransformerInterface to…

gerard-labs/superpowers-api-platform · 0 tokens

bootstrap-check

Verify a Symfony project's bootstrap state before any work — .env / .env.dist parity, config/bundles.php enabled bundles, config/services.yaml recipe-default App\ block with exclude:, config/packages/apiplatform.yaml flags (hydraprefix, eagerloading.forceeager, usesymfonylisteners), composer.lock presence, framework /…

gerard-labs/superpowers-api-platform · 125 tokens

ports-and-adapters

Apply Hexagonal Architecture / Ports & Adapters in Symfony — Domain (POPOs, no framework imports), Application (use cases orchestrating ports), Infrastructure (Symfony / Doctrine / API Platform adapters). Bounded contexts variant: one context per business domain with a Contract/ public surface. Deptrac to enforce…

gerard-labs/superpowers-api-platform · 120 tokens

cakephp-rest

Build secure, fast RESTful APIs using CakePHP's built-in routing and serialization capabilities.

AtulPurohit/Antigravity-Awesome-Skills · 22 tokens

codeigniter-rest

Build secure RESTful APIs using the CodeIgniter framework.

AtulPurohit/Antigravity-Awesome-Skills · 17 tokens