Cursor Pagination

You might say

When I scroll down to load the next page of my feed, why do a couple of posts I just saw show up again?

Fetching the next batch of API data from a unique marker on the last item instead of skipping N rowsWhen a feed returns 20 items plus a nextCursor pointing to the last row, inserting two new posts at the top does not shift where the next request starts, preventing duplicate items. However, cursor pagination cannot jump straight to page 8, so admin tables that require arbitrary page jumps still fit numbered pagination.
Know first
Keyset PaginationSeek PaginationCursor-Based Pagination

You can say this to an AI Agent

Ready to paste into Cursor, Claude Code, or Codex
Structured AI Agent prompt

Switch the feed API from `page/offset` to cursor pagination: sort by `(created_at, id)` descending, return `items`, `nextCursor`, and `hasMore`, and index the sort columns. Verify by fetching batch 1, inserting 2 new items at the top, and fetching batch 2 with `nextCursor` to confirm zero duplicates or skipped items.

Want your Agent to translate plain-language UI ideas automatically?Install free VibeHub Skill →
Oil UI Pro. Push AI’s design skills to the limit. Usability, existing projects and stricter review.
Further reading