Skip to main content
skill CX Codex

api-platform-filters — Claude Code skill: what it does, how to install

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.

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-filters -a claude-code
Open on GitHub

What api-platform-filters does

The skill fixes the order of work: declare parameters with QueryParameter on the operation, then choose a filter class for each parameter. #[ApiFilter] has been deprecated since 4.4, so it survives only in 3.4 code or code that has not been migrated yet.

Which class you get depends on the installed version. Search runs through PartialSearchFilter or FreeTextQueryFilter, ranges through ComparisonFilter, sorting needs SortFilter 4.3, chaining needs ChainFilter 4.4. A custom filter implements FilterInterface and pulls its value out of $context['parameter']. AbstractFilter and filterProperty() are deprecated since 4.4 as well, so they stay in 4.3 and 3.4 code.

Guardrails cover the rest. strictQueryParameterValidation makes unknown query parameters return 400, filtered columns get an #[ORM\Index], and the endpoint is called with matching and non-matching values. Ids and foreign keys take exact matching, because a partial LIKE %value% cannot use an index. Custom filters bind values with generateParameterName() and setParameter() instead of building the query string by hand.

What it helps with

  • add search across several properties behind one query parameter
  • move #[ApiFilter] declarations onto the Parameters API
  • write a filter with query logic the built-in classes miss
  • reject unknown query parameters with a 400
  • index the columns clients filter on

Example prompts for the agent

  • Add filters to the /api/products collection: name search, price range and sorting.
  • Migrate the #[ApiFilter] attributes in this resource to QueryParameter.
  • Write a custom filter for the status field and turn on strictQueryParameterValidation.

How to install api-platform-filters

1Skills CLI (Vercel)

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

2Manually: put the files in place

~/.claude/skills/api-platform-filters/SKILL.md

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

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

Questions about api-platform-filters

How do I install api-platform-filters in Claude Code?

Run npx skills add dev-toolings/superpowers-symfony --skill api-platform-filters -a claude-code. The skill file lands at ~/.claude/skills/api-platform-filters/SKILL.md.

What does api-platform-filters do?

It tells the agent to declare filters with QueryParameter on the operation, pick a filter class that matches the installed API Platform version, and verify the endpoint with real requests.

Do I still need #[ApiFilter]?

Only for 3.4 code or resources that were never migrated, since the attribute is deprecated from 4.4 onward. The skill works with parameters on the operation and mentions api:upgrade-filter for the conversion.

Source text

SKILL.md · MIT
---
name: api-platform-filters
description: "Implement API Platform filters - Parameters API (QueryParameter, v5/4.4/4.3) and the #[ApiFilter] attribute deprecated since 4.4 - for search, date, range, boolean, and custom filtering"
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 Filters (Symfony)

## Use when
- A collection endpoint needs search, exact match, range, date, boolean, or sort query parameters.
- One query parameter must search across several properties.
- A filter needs custom query logic that the built-in filters do not cover.
- Migrating `#[ApiFilter]` declarations (deprecated since 4.4) to the Parameters API, by hand or with `api:upgrade-filter`.

## Default workflow
1. Declare `parameters` with `QueryParameter` on the operation; keep `#[ApiFilter]` only in 3.4 code or code not yet migrated.
2. Choose a filter class per parameter, checking the installed version: `ExactFilter`, `PartialSearchFilter`, `FreeTextQueryFilter`, `OrFilter`, `IriFilter` (4.2+), `ComparisonFilter`, `SortFilter` (4.3+), `StartSearchFilter`, `EndSearchFilter`, `ChainFilter` (4.4+).
3. For a custom filter, implement `FilterInterface` and read the bound value from `$context['parameter']` (`AbstractFilter` and `filterProperty()` are deprecated since 4.4: keep them for 4.3 and 3.4 code).
4. Turn on `strictQueryParameterValidation` so unknown query parameters return 400.
5. Add `#[ORM\Index]` on filtered columns, then request the endpoint with matching and non-matching values.

## Guardrails
- Keep filter classes stateless: take request data from `$context`, not the constructor.
- Expose only the properties clients need to filter on.
- Use exact matching for ids and foreign keys: partial `LIKE %value%` cannot use an index.
- In custom filters, validate the value and bind it with `generateParameterName()` and `setParameter()`, never by string concatenation.

## Progressive disclosure
- Use this file for execution posture and risk controls.
- Open references when deep implementation details are needed.

## Output contract
- The parameters per operation, with filter class and accepted syntax (for example `?price[gte]=1000`).
- Indexes added for the filtered columns.
- Tests for a match, an empty result, and an unknown parameter.

## 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 →
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-state-providers Configures API Platform State Providers and Processors in Symfony. It helps decouple data retrieval and persistence from Doctrine entities. 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 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 doctrine-architect doctrine-architect — a read-only subagent that opens your Symfony entities and migrations, then hands back a relation map with a migration plan. CX Codex ★ 234repo stars symfony-tdd-coach symfony-tdd-coach — a subagent guiding TDD workflows in Symfony apps using Pest PHP or PHPUnit. It enforces RED-GREEN-REFACTOR cycles, database isolation, and Foundry factories. CX Codex ★ 234repo stars

Project sponsors

Companies that keep this analytics open