Standardizes pagination logic for API development and database queries.

Install

mkdir -p .claude/skills/pagination && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/7773" && unzip -o skill.zip -d .claude/skills/pagination && rm skill.zip

Installs to .claude/skills/pagination

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Implement cursor-based and offset pagination for APIs. Covers efficient database queries, stable sorting, and pagination metadata.
130 charsno explicit “when” trigger
Intermediate

Key capabilities

  • Implement cursor-based pagination for real-time data
  • Apply offset pagination for simple list endpoints
  • Generate pagination metadata including next and previous cursors
  • Optimize database queries using indexed sort columns
  • Handle stable sorting by including ID in sort criteria

How it works

The skill provides functions to encode and decode cursors based on record timestamps and IDs, allowing the database to fetch subsequent pages efficiently. It uses a query function to filter records based on the provided cursor and returns a result set with pagination metadata.

Inputs & outputs

You give it
API request parameters including cursor and limit
You get back
Paginated data array with next and previous cursor metadata

When to use pagination

  • Implement cursor-based pagination for large datasets
  • Add offset pagination to an API endpoint
  • Optimize database queries for paged results

About pagination

Provides implementation patterns for cursor-based and offset pagination. It handles query optimization, sorting stability, and the generation of pagination metadata for API responses.

Implement cursor-based and offset pagination for APIs. Covers efficient database queries, stable sorting, and pagination metadata.

When not to use it

  • Using offset pagination on large datasets
  • Returning total count on every request

Limitations

  • Offset pagination is inconsistent with concurrent writes
  • Cursor pagination does not support jumping to specific pages

How it compares

Unlike manual pagination which often relies on inefficient offset-based scanning, this approach uses cursor-based navigation to ensure consistent performance with concurrent data updates.

Compared to similar skills

pagination side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
pagination (this skill)16moNo flagsIntermediate
moai-domain-backend13moReviewAdvanced
senior-backend147moReviewAdvanced
jsonapi12moNo flagsAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry