api-platform-state-providers — скилл для Claude Code: установка
Скилл api-platform-state-providers помогает настроить кастомные State Provider и Processor в API Platform и Symfony. Отвязывает выборку и сохранение данных от сущностей Doctrine.
MIT ★ 234 обновлён 2026-10-05
npx skills add dev-toolings/superpowers-symfony --skill api-platform-state-providers -a claude-codeЧто делает api-platform-state-providers
Скилл направляет Claude Code при реализации ProviderInterface и ProcessorInterface в проектах на Symfony с API Platform версий 4.3, 4.4 и v5. Ассистент создаёт провайдеры для чтения данных из внешних API или оборачивает встроенные Doctrine-сервисы с помощью атрибута #[Autowire].
Для операций записи скилл генерирует процессоры, делегирующие вызовы в persist_processor или remove_processor. Учтите: устаревшие интерфейсы DataProvider и DataPersister из второй версии API Platform удалены, а флаг write: true для GET-операций поддерживается только в v4.
Какие задачи решает
- получить данные ресурса из внешнего источника вместо Doctrine ORM
- обернуть стандартный Doctrine Provider для отдачи DTO или фильтрации тенанта
- выполнить хэширование или отправку сообщений перед сохранением сущности
- настроить запуск процессора на GET-эндпоинте с флагом
write: true
Примеры запросов агенту
- Создай State Provider для чтения профиля пользователя через внешний REST API.
- Оберни Doctrine Item Provider, чтобы отдавать DTO вместо сущности Order.
- Напиши State Processor для хеширования пароля перед вызовом persist.
Как установить api-platform-state-providers
1Через Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill api-platform-state-providers -a claude-code2Вручную: положить файлы
~/.claude/skills/api-platform-state-providers/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/api-platform-state-providers/
1Через Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill api-platform-state-providers -a codex2Вручную: положить файлы
.agents/skills/api-platform-state-providers/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill api-platform-state-providers -a cursor2Вручную: положить файлы
.cursor/skills/api-platform-state-providers/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install dev-toolings/superpowers-symfony content/skills/api-platform-state-providers2Вручную: положить файлы
.github/skills/api-platform-state-providers/SKILL.md1Через Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill api-platform-state-providers -a gemini-cli2Командой платформы
gemini skills install https://github.com/dev-toolings/superpowers-symfony --path content/skills/api-platform-state-providersВручную: положить файлы
.devin/skills/api-platform-state-providers/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Claude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы об api-platform-state-providers
Как установить api-platform-state-providers в Claude Code?
Выполните команду npx skills add dev-toolings/superpowers-symfony --skill api-platform-state-providers -a claude-code. Альтернативный вариант — поместить файл по пути ~/.claude/skills/api-platform-state-providers/SKILL.md.
Что делает скилл api-platform-state-providers?
Он задаёт правила проектирования State Providers и Processors в API Platform. Это позволяет изолировать логику хранения, использовать DTO и тестировать сценарии успеха, 404 и побочные эффекты.
Поддерживает ли скилл DataProvider из API Platform v2?
Интерфейсы DataProvider и DataPersister устарели и не используются. Скилл работает с современными ProviderInterface и ProcessorInterface.
Исходный текст
SKILL.md · MIT
--- name: api-platform-state-providers description: Master API Platform State Providers and Processors (v5, 4.4, 4.3) (ProviderInterface/ProcessorInterface) to decouple data retrieval and persistence from entities 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 State Providers (Symfony) ## Use when - Reading data from a source other than the default Doctrine provider. - Wrapping the Doctrine provider to post-process results (return a DTO, enforce a tenant scope). - Business logic must run before or after persisting (hashing, slug, dispatching a message). - A v4 read endpoint must dispatch a query or command through a processor. ## Default workflow 1. Implement `ProviderInterface::provide()` returning `iterable|object|null`, where `null` gives a 404 (v3.4 declares `mixed`). 2. To keep Doctrine fetching, inject `api_platform.doctrine.orm.state.item_provider` and `api_platform.doctrine.orm.state.collection_provider` with `#[Autowire]`. 3. Implement `ProcessorInterface::process()` and delegate to `api_platform.doctrine.orm.state.persist_processor` or `remove_processor`. 4. Wire them with `provider:` and `processor:` on the resource or the operation; autoconfiguration registers them, and the `api_platform.state_provider` or `api_platform.state_processor` tag is only needed without it. 5. For a processor on `GET` or `GetCollection`, add `write: true` (v4 only). ## Guardrails - Run pre-persist logic before calling the inner processor and side effects after it returns. - A processor returns the created or modified object, and nothing for `DELETE`. - `write: true` on safe methods is v4 only: v3.4 processors run on write methods only. - `DataProvider` and `DataPersister` are v2 interfaces and no longer exist. ## Progressive disclosure - Use this file for execution posture and risk controls. - Open references when deep implementation details are needed. ## Output contract - The providers and processors added, and the operations they are wired to. - Which built-in services are decorated. - Tests for the not-found, success, and side-effect paths. ## References - `reference.md`
© dev-toolings · MIT · dev-toolings/superpowers-symfony