Install
$ agentstack add skill-pradnyeshp-claude-skills-pagination ✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
About
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.
- 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.
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: Pradnyeshp
- Source: Pradnyeshp/Claude-Skills
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet — be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.