pagination-and-filtering

Implement cursor-based pagination with composite (created_at, id) ordering and LIMIT+1 hasMore logic.

1|Updated Mar 23, 2026
One-click install
npx skills add https://github.com/RaNDoM6913/claude-code-superkit --skill pagination-and-filtering
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: pagination-and-filtering
Source: https://github.com/RaNDoM6913/claude-code-superkit/tree/main/packages/showcase/.claude/skills/pagination-and-filtering
Command: npx skills add https://github.com/RaNDoM6913/claude-code-superkit --skill pagination-and-filtering

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Efficiently delivering data to clients at scale by replacing OFFSET-based pagination with cursor-based pagination and robust filtering, reducing latency and avoiding inconsistencies when data changes between pages.

Core Features & Use Cases

  • Cursor-based pagination with a composite (created_at, id) cursor to ensure stable, deterministic paging for feeds, lists, and admin tables.
  • LIMIT+1 hasMore pattern to detect additional pages without extra COUNT queries.
  • Debounced search and TanStack Infinite Queries integration for smooth front-end experiences.
  • Composite indexes design guidelines and filtered queries for high-performance data access in SQL databases.

Quick Start

Set up your API to paginate results with a composite cursor (created_at, id) and return a hasMore flag for client navigation.

Frequently Asked Questions about pagination-and-filtering

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why use cursor-based pagination instead of OFFSET in SQL databases?▼

Cursor-based pagination replaces OFFSET to reduce latency and prevent data inconsistencies when records change between pages. It uses a composite (created_at, id) cursor to ensure stable, deterministic paging for large SQL-backed feeds and admin tables.

How do I detect if more pages exist without running expensive COUNT queries?▼

Use the LIMIT+1 hasMore pattern to detect additional pages without COUNT queries. Fetch one row beyond the target page size; if that extra row exists, hasMore is true, eliminating the need for expensive COUNT queries.

How do I integrate cursor pagination with TanStack Infinite Queries?▼

Integrate cursor pagination with TanStack Infinite Queries by having your API return a composite cursor and a hasMore flag. The front-end TanStack Infinite Queries client uses these outputs to fetch subsequent pages and manage debounced search.

Does this cursor pagination approach support debounced search and dynamic ORDER BY?▼

Yes, this approach supports debounced search and safe dynamic ORDER BY for filtered queries. You must pair dynamic ORDER BY clauses with corresponding composite indexes in your SQL store to maintain high-performance data access.

What database indexes do I need for composite cursor pagination?▼

You need corresponding composite indexes that match your cursor ordering, specifically on (created_at, id). Designing these indexes ensures high-performance data access for filtered queries in your SQL database.