freeskillv1.0.0✓ verified
api-pagination
Implement correct, fast API pagination — cursor vs offset trade-offs, opaque cursor encoding, stable sort keys, page-size limits, total-count costs, and consumer-side iteration that survives inserts, deletes, and retries. With runnable cursor checks.
$npx vanara install api-pagination
Free & open source (Apache-2.0) — view the source on GitHub.
Overview
Pagination looks trivial until data changes underneath the reader. Offset pagination silently skips or duplicates rows when inserts land mid-iteration; cursor pagination survives churn but demands a stable sort key and an opaque token contract. This skill covers both sides: designing the API and consuming one correctly. Deep detail lives in references/; copy-paste material in examples/; a runnable
What it covers
- Decision: offset vs cursor
- Keyset mechanics (the part people get wrong)
- Cursor token contract
- Response envelope
- Consuming Paginated APIs Correctly
- Counting and Totals
- Cursor Encoding