pagination
Skill2 starsChanged 4 months agoMITView on GitHub
Add pagination to a list endpoint or query that returns unbounded rows — offset/limit or cursor-based — so responses stay fast and bounded as the dataset grows. Use when the user says "add pagination", "paginate this endpoint", "this returns too many rows", "add limit and offset", "add cursor pagination", "page through results", or "the list query is slow with lots of data".
3 other projects use a version of this.
Adopted by
Most recently taken up by
- AnyOrgName/php-skillstheir own version, first seen Nov 8, 2026
- jars-demo/jars-skillstheir own version, first seen Oct 25, 2026
- ffsshhttiikk/opencode-agents-skillstheir own version, first seen Feb 28, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- AnyOrgName/php-skills★ 4same name
- ffsshhttiikk/opencode-agents-skills★ 2same name
- jars-demo/jars-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository68 other files it gives its agents.
- a11ySkill
- api-docsSkill
- audit-logSkill
- benchmarkSkill
- bisectSkill
- cacheSkill
- changelogSkill
- cherry-pickSkill
- ci-setupSkill
- codeownersSkill
- commit-messageSkill
- connection-poolSkill
- contributingSkill
- coverageSkill
- db-migrateSkill
- dead-codeSkill
- debugSkill
- depsSkill
- diagramSkill
- dockerizeSkill
- docstringSkill
- e2eSkill
- env-exampleSkill
- error-handlingSkill
- explainSkill
- feature-flagSkill
- flaky-testSkill
- gitignoreSkill
- graceful-shutdownSkill
- graphqlSkill
- healthcheckSkill
- i18nSkill
- idempotencySkill
- licenseSkill
- lint-fixSkill
- loggingSkill
- migrateSkill
- mockSkill
- onboardSkill
- optimizeSkill
- pr-descriptionSkill
- pre-commitSkill
- profileSkill
- prune-branchesSkill
- rate-limitSkill
- readmeSkill
- rebaseSkill
- refactorSkill
- regexSkill
- releaseSkill
- resolve-conflictsSkill
- retrySkill
- review-diffSkill
- scaffoldSkill
- secrets-scanSkill
- security-headersSkill
- seedSkill
- soft-deleteSkill
- sqlSkill
- squashSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
4 rules. 0 are common, 2 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 27
Verify: Add a test that pages through a seeded dataset end to end, asserting no gaps or duplicates across page boundaries, that the last …
- Very specific: line 31
Always enforce a default and a hard-max page size.
- Distinctive: line 33
Prefer keyset/cursor pagination for large or shifting datasets.
- Distinctive: line 35
Ensure the ordering and cursor comparison are index-backed, and end by summarizing the strategy, the default/max page size, the response …
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Framework & data-access signals
!grep -rilE "express|fastify|nestjs|flask|fastapi|django|prisma|sequelize|typeorm|sqlalchemy|knex|mongoose|LIMIT|OFFSET|findMany" --include='*.*' package.json pyproject.toml go.mod Gemfile 2>/dev/null | grep -vE 'node_modules|\.git|dist|build' | head -8
Instructions
Bound the result set of the list operation in $ARGUMENTS so it can't return the whole table at once. Match the project's existing framework, query builder/ORM, and response conventions rather than inventing a new shape.
Method
- Pick the right strategy for the data:
- Cursor (keyset) pagination — preferred for large, append-heavy, or real-time data and infinite scroll. Page by
WHERE (sort_key, id) > (:last_sort, :last_id)on an indexed, stable ordering. It stays fast at deep pages and doesn't skip/duplicate rows when data shifts between requests. - Offset/limit — fine for small, bounded, or admin datasets and when the client needs jump-to-page/total counts. Simple, but slow at high offsets and prone to drift as rows are inserted/deleted. Recommend one explicitly and say why for this dataset.
- Cursor (keyset) pagination — preferred for large, append-heavy, or real-time data and infinite scroll. Page by
- Enforce a bounded, sane limit. Apply a default page size (e.g. 20) and a hard maximum (e.g. 100). Clamp — never trust a client-supplied
limitthat could request the whole table. Reject or clamp non-numeric / negative values. - Guarantee a stable, total ordering. Order by a unique tiebreaker (typically the primary key) alongside the sort column, so pages don't overlap or drop rows when sort values tie. Ensure an index backs the ordering (and the cursor comparison) — see the
optimizeskill if the query is slow. - Return a clear envelope. Include the page of
dataplus pagination metadata: for cursor, anextCursor(null when exhausted) andhasMore; for offset,page/pageSizeandtotalonly if counting is affordable (aCOUNT(*)on a huge filtered set can dominate the request — make it optional or approximate). Keep the envelope consistent with the project's other list endpoints. - Encode cursors opaquely. Base64-encode the cursor payload so clients treat it as a token, not something to construct; validate/decode defensively and fail cleanly on a malformed cursor.
- Verify. Add a test that pages through a seeded dataset end to end, asserting no gaps or duplicates across page boundaries, that the last page reports exhaustion, and that an over-large
limitis clamped.
Rules
- Always enforce a default and a hard-max page size; never let a request return an unbounded result set, even if the client omits or inflates
limit. - Order by a unique tiebreaker so pagination is deterministic; an unstable sort silently drops or repeats rows across pages.
- Prefer keyset/cursor pagination for large or shifting datasets; reserve offset for small sets or when jump-to-page/totals are genuinely required.
- Make expensive total counts optional — don't force a full
COUNT(*)on every page of a large table. - Ensure the ordering and cursor comparison are index-backed, and end by summarizing the strategy, the default/max page size, the response envelope, and the ordering guarantee.
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.

