pagination-implementation

Implement offset/limit and token-based LIST pagination with PagedResults mapping.

6|Updated Feb 20, 2025
One-click install
npx skills add https://github.com/zerobias-org/module --skill pagination-implementation
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pagination-implementation
Source: https://github.com/zerobias-org/module/tree/main/.claude/skills/pagination-implementation
Command: npx skills add https://github.com/zerobias-org/module --skill pagination-implementation

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill provides standardized patterns for LIST pagination, preventing mixing offset/limit and token-based approaches while ensuring reliable and testable paging across APIs.

Core Features & Use Cases

  • Offset/Limit pagination pattern for APIs that expose offset and limit parameters, including input validation and safe defaults.
  • Token-Based pagination pattern for cursor-style APIs that return a next-page token and allow token reuse across requests.
  • Clear mapping of API responses to a unified PagedResults structure with proper validation and error handling.

Quick Start

Integrate these pagination patterns into your LIST handlers to support either offset/limit or token.

Frequently Asked Questions about pagination-implementation

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

FAQPage Schema
How do I implement pagination for REST API list endpoints?

Implement REST API list endpoint pagination by standardizing offset/limit and token-based approaches. This pattern enforces offset initialization and validates response structures to ensure reliable paged results.

What is the difference between offset and cursor pagination in API design?

Offset pagination uses numeric positions for page traversal, while cursor pagination uses opaque tokens. This pattern strictly separates these modes to prevent mixing approaches and maps both to a unified PagedResults container.

How do I handle next-page tokens when fetching paged API results?

Handle next-page tokens by implementing cursor-based pagination patterns that allow token reuse across requests. This validates the response structure and maps the token to a unified PagedResults container for reliable traversal.

Can I use offset and limit parameters alongside token-based pagination?

You should not mix offset and limit parameters with token-based pagination. This pattern enforces strict separation of pagination modes to prevent conflicts and ensure testable, reliable paging across APIs.

How do I validate API pagination responses and set safe defaults?

Validate API pagination responses by mapping them to a unified PagedResults structure with proper error handling. This enforces offset initialization and applies safe defaults for limit parameters.

What is the best way to standardize list pagination across multiple API clients?

Standardize list pagination across API clients by mapping responses to a unified PagedResults structure. This enforces strict separation of offset and token modes while providing input validation and clear response structure mapping.