Skill
API Pagination Design
Picks cursor or offset pagination for a list endpoint, then implements stable ordering, hard limits and next links that never skip or repeat rows.
1Choose with evidence, then make paging deterministic.
2Steps
31. Read the endpoint, the table and its indexes. Note the expected size, whether rows are inserted while clients page, and whether users need to jump to page N.
42. Choose. Use cursor (keyset) pagination for feeds, logs and anything large or changing. Use offset only for small, stable lists where a page number is a real feature, and cap the maximum offset.
53. Make the order total. Sort by a column plus a unique tiebreaker, for example `ORDER BY created_at DESC, id DESC`. Without the tiebreaker, equal timestamps cause skipped rows.
Claude CodeCodex
API Pagination Design
SkillBackend and APIs
Free