Skip to main content
skill CX Codex

api-platform-state-providers — Claude Code skill: setup guide

Configures API Platform State Providers and Processors in Symfony. It helps decouple data retrieval and persistence from Doctrine entities.

MIT ★ 234 updated 2026-10-05

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add dev-toolings/superpowers-symfony --skill api-platform-state-providers -a claude-code
Open on GitHub

What api-platform-state-providers does

This skill guides Claude Code through implementing ProviderInterface and ProcessorInterface across API Platform versions 4.3, 4.4, and v5. It helps fetch records from custom stores or decorate default Doctrine services with #[Autowire].

For write pipelines, it wires processors delegating to built-in persist or remove handlers. Keep in mind that legacy DataProvider and DataPersister interfaces from v2 are obsolete, and setting write: true on safe methods requires API Platform v4.

What it helps with

  • fetch API resource state from external services instead of Doctrine
  • decorate built-in providers to return DTOs or enforce tenant scopes
  • execute business logic like password hashing before persisting entities
  • attach processors to GET endpoints using the write: true option

Example prompts for the agent

  • Create a custom State Provider that returns a user DTO from an external service.
  • Decorate the Doctrine item provider to enforce a tenant boundary.
  • Implement a State Processor to dispatch an event before persisting the entity.

How to install api-platform-state-providers

1Skills CLI (Vercel)

npx skills add dev-toolings/superpowers-symfony --skill api-platform-state-providers -a claude-code

2Manually: put the files in place

~/.claude/skills/api-platform-state-providers/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/api-platform-state-providers/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about api-platform-state-providers

How do I install api-platform-state-providers in Claude Code?

Run npx skills add dev-toolings/superpowers-symfony --skill api-platform-state-providers -a claude-code. You can also place the skill file directly at ~/.claude/skills/api-platform-state-providers/SKILL.md.

What does api-platform-state-providers do?

It equips Claude Code with workflows for decoupling data access in Symfony API Platform. It covers custom providers, processors, DTO transformations, and test patterns.

Does it support legacy API Platform v2 DataPersister interfaces?

It does not support v2 contracts because they were removed. The skill works strictly with modern ProviderInterface and ProcessorInterface.

Source text

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

Similar skills

All skills for Backend and APIs →

From the same set51

The whole set →
doctrine-relations Skill guides you through defining Doctrine relationships (OneToMany, ManyToMany, ManyToOne) with correct owning and inverse sides, cascade strategies, and N+1 query prevention. CX Codex +1 ★ 234repo stars doctrine-fetch-modes doctrine-fetch-modes guides Doctrine ORM and DBAL 4 query optimization in Symfony. Fixes N+1 queries, configures lazy loading, and implements DTO hydration. CX Codex +1 ★ 234repo stars api-platform-resources api-platform-resources is a Claude Code skill for configuring API Platform resources for REST and GraphQL. It activates for resource creation and changes to operations, pagination, or OpenAPI docs. CX Codex +1 ★ 234repo stars messenger-retry-failures messenger-retry-failures sorts out failed Symfony Messenger handlers: whether a message deserves another attempt, when it goes straight to the failure transport, and how to pull it back. CX Codex +1 ★ 234repo stars api-platform-dto-resources The api-platform-dto-resources skill decouples your API contract from Doctrine entities in API Platform via Symfony's Object Mapper. CX Codex +1 ★ 234repo stars api-platform-filters api-platform-filters tells the agent how to wire search, range, date and boolean filters into API Platform collection endpoints in Symfony, and how to leave the deprecated attribute behind. CX Codex +1 ★ 234repo stars doctrine-performance-optimizer doctrine-performance-optimizer audits Doctrine ORM code in read-only mode to detect looped relation queries, evaluate fetch strategies, and suggest DTO hydration, batch processing, or database indexes. CX Codex ★ 234repo stars symfony-reviewer symfony-reviewer reviews changed Symfony files for architecture, security, and framework conventions. Run it after edits or ask for a code review. CX Codex ★ 234repo stars

Project sponsors

Companies that keep this analytics open