api-platform-serialization — скилл для Claude Code
Скилл api-platform-serialization настраивает сериализацию API Platform: группы полей на операцию, IRI вместо вложенных объектов, вычисляемые свойства и опции нормализаторов.
MIT ★ 234 обновлён 2026-10-05
npx skills add dev-toolings/superpowers-symfony --skill api-platform-serialization -a claude-codeЧто делает api-platform-serialization
Скилл показывает агенту, как управлять составом полей в ответах API Platform. Он учит назначать normalizationContext и denormalizationContext отдельно для списка, чтения, создания и обновления, помечать свойства атрибутом #[Groups] и форсировать IRI вместо вложенных объектов через readableLink: false и writableLink: false. Для вычисляемых полей скилл предлагает кастомные нормализаторы, для динамических групп — декоратор api_platform.serializer.context_builder, для предотвращения циклов — #[MaxDepth] с enable_max_depth.
Скилл различает атрибуты Symfony Serializer (Attribute) и старые аннотации (Annotation): агент будет использовать первые. Он напоминает, что связанная сущность встраивается, только если у неё есть общая группа с родителем; без неё она рендерится как IRI. Секретные поля агент скроет атрибутом #[Ignore], а пароль добавит только в группу создания.
Выход работы — матрица полей по операциям, зарегистрированные нормализаторы и контекст-билдеры, тесты или OpenAPI с результирующим набором полей.
Какие задачи решает
- Выставить разные поля для списка, чтения и записи ресурса API Platform
- Заменить вложенные объекты на IRI в ответе
- Добавить вычисляемое или зависящее от роли поле
- Задать формат даты или другие опции нормализатора для свойства
- Предотвратить циклы сериализации в связанных сущностях
Примеры запросов агенту
- Настрой группы сериализации: список товаров должен возвращать
id,nameиprice, а запрос на создание приниматьname,priceиcategoryId, но неid - Замени вложенный объект
categoryна IRI в ответе GET/products - Добавь вычисляемое поле
discountedPriceв ответ для операции чтения
Как установить api-platform-serialization
1Через Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill api-platform-serialization -a claude-code2Вручную: положить файлы
~/.claude/skills/api-platform-serialization/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/api-platform-serialization/
1Через Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill api-platform-serialization -a codex2Вручную: положить файлы
.agents/skills/api-platform-serialization/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill api-platform-serialization -a cursor2Вручную: положить файлы
.cursor/skills/api-platform-serialization/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install dev-toolings/superpowers-symfony content/skills/api-platform-serialization2Вручную: положить файлы
.github/skills/api-platform-serialization/SKILL.md1Через Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill api-platform-serialization -a gemini-cli2Командой платформы
gemini skills install https://github.com/dev-toolings/superpowers-symfony --path content/skills/api-platform-serializationВручную: положить файлы
.devin/skills/api-platform-serialization/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Claude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы об api-platform-serialization
Как установить api-platform-serialization в Claude Code?
Выполни npx skills add dev-toolings/superpowers-symfony --skill api-platform-serialization -a claude-code, скилл будет доступен в ~/.claude/skills/api-platform-serialization/SKILL.md.
Что делает скилл api-platform-serialization?
Он учит агента управлять составом полей в API Platform: назначать группы на операцию, форсировать IRI для связей, добавлять вычисляемые поля через нормализаторы и предотвращать циклы.
Как заменить вложенный объект на IRI?
Примени #[ApiProperty(readableLink: false, writableLink: false)] к свойству-связи. Вложенный объект появится, только если у связанной сущности есть общая группа с родителем.
Исходный текст
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