api-platform-pagination
Skill2 starsChanged 6 months agoMITView on GitHub
Configure API Platform 4.3 pagination — default page size (30 items in 4.x, not 20), `hydra_prefix: false` shape (`member` / `totalItems` / `view` / `next` keys, no `hydra:` prefix), partial pagination (`paginationPartial: true`) to skip the COUNT on large tables, cursor-based pagination via `paginationViaCursor` paired with UUID v7 / ULID identifiers, `paginationMaximumItemsPerPage` to prevent DoS, fetch-join collection / output walker tuning, custom paginator implementations (`PartialPaginatorInterface`, `PaginatorInterface`, `TraversablePaginator`), and renaming the client parameters via `collection.pagination.{page,items_per_page,enabled,partial}_parameter_name`. Trigger when listing a resource that may grow beyond ~100k rows, when designing infinite-scroll / autocomplete APIs, or when fixing slow `COUNT(*)` queries.
In this repository52 other files it gives its agents.
- api-platform-dto-resourcesSkill
- api-platform-errorsSkill
- api-platform-file-uploadSkill
- api-platform-filtersSkill
- api-platform-identifiersSkill
- api-platform-mcpSkill
- api-platform-mutatorsSkill
- api-platform-openapiSkill
- api-platform-performanceSkill
- api-platform-resilienceSkill
- api-platform-resourcesSkill
- api-platform-securitySkill
- api-platform-serializationSkill
- api-platform-state-processorsSkill
- api-platform-state-providersSkill
- api-platform-testsSkill
- api-platform-upgradeSkill
- api-platform-userSkill
- api-platform-versioningSkill
- bootstrap-checkSkill
- brainstormingSkill
- config-env-parametersSkill
- controller-cleanupSkill
- cqrs-and-handlersSkill
- daily-workflowSkill
- doctrine-batch-processingSkill
- doctrine-fetch-modesSkill
- doctrine-fixtures-foundrySkill
- doctrine-migrationsSkill
- doctrine-relationsSkill
- doctrine-transactionsSkill
- effective-contextSkill
- executing-plansSkill
- functional-testsSkill
- interfaces-and-autowiringSkill
- makefile-disciplineSkill
- messenger-retry-failuresSkill
- ports-and-adaptersSkill
- quality-checksSkill
- rate-limitingSkill
- runner-selectionSkill
- strategy-patternSkill
- symfony-cacheSkill
- symfony-messengerSkill
- symfony-schedulerSkill
- symfony-votersSkill
- tdd-with-pestSkill
- tdd-with-phpunitSkill
- test-doubles-mockingSkill
- using-symfony-superpowersSkill
- value-objects-and-dtosSkill
- writing-plansSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 18
Default 30 items per page is wrong for your domain (raise or lower it explicitly).
- Very specific: line 22
Verify the 4.x defaults: pagination_items_per_page: 30, hydra_prefix: false.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
API Platform 4.3 — Pagination
Use when
- The collection can grow to millions of rows and
COUNT(*)is too expensive. - Infinite-scroll / autocomplete needs cursor pagination on a chronologically sortable key.
- Default 30 items per page is wrong for your domain (raise or lower it explicitly).
- Custom paginator needed (search engine, external API, computed projections).
Default workflow
- Verify the 4.x defaults:
pagination_items_per_page: 30,hydra_prefix: false. Adapt tests. - Cap
paginationMaximumItemsPerPage(50-100) per operation — anti-DoS. - For large tables:
paginationPartial: true(no COUNT, nototalItems). - For infinite scroll: identifier = UUID v7 / ULID +
paginationViaCursor+ComparisonFilteron the cursor field. - For non-Doctrine sources: implement a custom
PaginatorInterface.
Guardrails
hydra_prefix: falseis the default — tests must usemember/totalItems/view/next(nohydra:prefix).- Default page size is 30 in 4.x (changed from 20 in 3.x) — fix tests that hard-code 20.
- Always cap the max page size to prevent abusers from requesting
?itemsPerPage=10000. - Cursor pagination requires a stable sort key — UUID v7 / ULID are ideal; auto-increment IDs work but leak volume.
Progressive disclosure
SKILL.mdlists posture and rules.reference.mdcarries the full patterns: 4.x JSON-LD shape, partial pagination, cursor with UUID v7, fetch-join collection / output walkers, custom parameter names, custom paginator, best practices.
Output contract
- Operations declare
paginationItemsPerPage,paginationMaximumItemsPerPage, and where applicablepaginationPartial/paginationViaCursor. - Tests assert the 4.x JSON-LD shape (no
hydra:prefix). - Cursor pagination uses an indexed sort key; performance verified on a representative dataset.
References
reference.md
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

