api-platform-serialization — Claude Code skill: what it does
Skill configures API Platform serialization: field groups per operation, IRIs instead of nested objects, computed properties, and normalizer options.
MIT ★ 234 updated 2026-10-05
npx skills add dev-toolings/superpowers-symfony --skill api-platform-serialization -a claude-codeWhat api-platform-serialization does
The skill teaches the agent how to control which fields appear in API Platform responses. It shows how to set normalizationContext and denormalizationContext separately for list, read, create, and update operations, mark properties with #[Groups], and force IRIs instead of nested objects with readableLink: false and writableLink: false. For computed fields the skill recommends custom normalizers, for dynamic groups a decorator of api_platform.serializer.context_builder, and for cycle prevention #[MaxDepth] with enable_max_depth.
The skill distinguishes Symfony Serializer attributes (Attribute) from old annotations (Annotation): the agent will use the former. It reminds that a related entity embeds only when it shares a group with the parent; without one it renders as an IRI. The agent will hide secret fields with #[Ignore] and add password only to the create group.
Output includes a matrix of fields per operation, registered normalizers and context builders, and tests or OpenAPI showing the resulting field set.
What it helps with
- Expose different fields for list, read, and write operations in API Platform
- Replace nested objects with IRIs in responses
- Add a computed or role-dependent field to a resource
- Set date format or other normalizer options for a property
- Prevent serialization cycles in related entities
Example prompts for the agent
- Set up serialization groups: product list should return
id,name, andprice, while create should acceptname,price, andcategoryIdbut notid - Replace the nested
categoryobject with an IRI in GET/products - Add a computed field
discountedPriceto the read operation response
How to install api-platform-serialization
1Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill api-platform-serialization -a claude-code2Manually: put the files in place
~/.claude/skills/api-platform-serialization/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/api-platform-serialization/
1Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill api-platform-serialization -a codex2Manually: put the files in place
.agents/skills/api-platform-serialization/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill api-platform-serialization -a cursor2Manually: put the files in place
.cursor/skills/api-platform-serialization/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install dev-toolings/superpowers-symfony content/skills/api-platform-serialization2Manually: put the files in place
.github/skills/api-platform-serialization/SKILL.md1Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill api-platform-serialization -a gemini-cli2Platform CLI
gemini skills install https://github.com/dev-toolings/superpowers-symfony --path content/skills/api-platform-serializationManually: put the files in place
.devin/skills/api-platform-serialization/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 api-platform-serialization
How to install api-platform-serialization in Claude Code?
Run npx skills add dev-toolings/superpowers-symfony --skill api-platform-serialization -a claude-code, the skill will be available at ~/.claude/skills/api-platform-serialization/SKILL.md.
What does api-platform-serialization do?
It teaches the agent to control field composition in API Platform: assign groups per operation, force IRIs for relations, add computed fields via normalizers, and prevent cycles.
How to replace a nested object with an IRI?
Apply #[ApiProperty(readableLink: false, writableLink: false)] to the relation property. Nested object appears only when the related entity shares a group with the parent.
Source text
SKILL.md · MIT
--- name: api-platform-serialization description: "Control API Platform serialization with groups, #[Context], IRI links (readableLink/writableLink), and custom context builders" capabilities: [read, search, edit, shell] tags: [api-platform] # projected by `bun run build` — do not edit by hand allowed-tools: - Read - Glob - Grep - Write - Edit - Bash --- # Api Platform Serialization (Symfony) ## Use when - Operations must expose different fields (list, read, create, update). - A related resource must render as an IRI or be embedded. - A response needs computed or role-dependent fields. - A property needs normalizer options such as a date format. ## Default workflow 1. Name groups `entity:operation` and set `normalizationContext` and `denormalizationContext` per operation. 2. Tag properties with `#[Groups]` from the Serializer `Attribute` namespace, not the old `Annotation` one. 3. Control relations with `#[ApiProperty(readableLink: false, writableLink: false)]` to force IRIs. 4. Apply per-property options with `#[Context]` instead of writing a normalizer. 5. Add computed fields in a custom normalizer, and dynamic groups in a decorator of `api_platform.serializer.context_builder`. 6. Prevent cycles with `#[MaxDepth]` and `enable_max_depth`, and hide secrets with `#[Ignore]`. ## Guardrails - Use separate read and write groups: for example `password` only in the create group, `id` only in read groups. - A related resource is embedded only when it shares a group with the parent; otherwise it renders as an IRI. - `#[MaxDepth]` has no effect unless `enable_max_depth` is true in the context. - Keep entities clean: computed fields belong in normalizers. ## Progressive disclosure - Use this file for execution posture and risk controls. - Open references when deep implementation details are needed. ## Output contract - The groups and contexts per operation, as a field matrix. - Normalizers or context builders added, and how they are registered. - Tests or OpenAPI output showing the resulting fields. ## References - `reference.md`
© dev-toolings · MIT · dev-toolings/superpowers-symfony