api-platform-filters — скилл для Claude Code
Скилл api-platform-filters ведёт агента по фильтрам API Platform в Symfony: query-параметры, классы фильтров под установленную версию и свои фильтры для нестандартных запросов.
MIT ★ 234 обновлён 2026-10-05
npx skills add dev-toolings/superpowers-symfony --skill api-platform-filters -a claude-codeЧто делает api-platform-filters
Скилл задаёт порядок работы с фильтрами на операции API Platform: объявить parameters с QueryParameter и подобрать класс под каждый параметр. Атрибут #[ApiFilter] устарел с 4.4, поэтому в новом коде он не нужен.
Классы выбираются по установленной версии: PartialSearchFilter и FreeTextQueryFilter для поиска, ComparisonFilter для диапазонов, SortFilter с 4.3, ChainFilter с 4.4. Свой фильтр реализует FilterInterface и читает значение из $context['parameter']; AbstractFilter и filterProperty() тоже помечены устаревшими с 4.4, их оставляют для кода 4.3 и 3.4.
Дальше идут ограничения. Агент включает strictQueryParameterValidation, чтобы незнакомый query-параметр возвращал 400, ставит #[ORM\Index] на фильтруемые колонки и проверяет эндпоинт запросами с совпадением и без. Для id и внешних ключей нужен точный фильтр: частичное LIKE %value% индекс не использует. Значения в своих фильтрах связываются через generateParameterName() и setParameter(), без склейки строки.
Какие задачи решает
- добавить поиск по нескольким полям через один query-параметр
- перевести объявления
#[ApiFilter]на Parameters API - написать фильтр с собственной логикой запроса
- отбивать незнакомые query-параметры ответом 400
- поставить индексы на колонки, по которым фильтруют клиенты
Примеры запросов агенту
- Добавь фильтры в коллекцию
/api/products: поиск по названию, диапазон цены и сортировку. - Переведи
#[ApiFilter]в этом ресурсе наQueryParameter. - Напиши свой фильтр для поля
statusи включиstrictQueryParameterValidation.
Как установить api-platform-filters
1Через Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill api-platform-filters -a claude-code2Вручную: положить файлы
~/.claude/skills/api-platform-filters/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/api-platform-filters/
1Через Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill api-platform-filters -a codex2Вручную: положить файлы
.agents/skills/api-platform-filters/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill api-platform-filters -a cursor2Вручную: положить файлы
.cursor/skills/api-platform-filters/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install dev-toolings/superpowers-symfony content/skills/api-platform-filters2Вручную: положить файлы
.github/skills/api-platform-filters/SKILL.md1Через Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill api-platform-filters -a gemini-cli2Командой платформы
gemini skills install https://github.com/dev-toolings/superpowers-symfony --path content/skills/api-platform-filtersВручную: положить файлы
.devin/skills/api-platform-filters/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Claude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы об api-platform-filters
Как установить api-platform-filters в Claude Code?
Выполните npx skills add dev-toolings/superpowers-symfony --skill api-platform-filters -a claude-code. Файл скилла появится по пути ~/.claude/skills/api-platform-filters/SKILL.md.
Что делает api-platform-filters?
Подсказывает агенту, как объявлять фильтры API Platform через QueryParameter на операции, какой класс фильтра взять под задачу и как проверить результат запросами.
Чем Parameters API отличается от #[ApiFilter]?
#[ApiFilter] помечен устаревшим с 4.4, а QueryParameter объявляется прямо в parameters операции. Скилл предлагает миграцию вручную или через api:upgrade-filter.
Исходный текст
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