API Pagination Debugging

API Pagination Debugging is a skill for Claude Code, Codex from ngpestelos/readwise-mcp-server. It costs 93 tokens per session (3,928 once invoked), scanned A, original, MIT.

A troubleshooting guide for APIs that return data in multiple pages. An API is a way for software to request data from another service, and pagination splits a large result into smaller responses.

In plain words
What is it for?
Use it to debug cursor-, page-, offset-, or link-based pagination, inspect response fields, choose page sizes, and fix incomplete API imports.
Why use it?
It helps find why an import stops early, repeats records, or misses part of a dataset. The guide focuses on matching the code to the API's actual paging format.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/ngpestelos/readwise-mcp-server/api-pagination-debugging
Any agent
npx skills add ngpestelos/readwise-mcp-server --skill api-pagination-debugging
Clone the repo
git clone --depth 1 https://github.com/ngpestelos/readwise-mcp-server

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for API Pagination Debugging

README.md
[![agentmods](https://agentmods.dev/badge/skills/ngpestelos/readwise-mcp-server/api-pagination-debugging.svg)](https://agentmods.dev/skills/ngpestelos/readwise-mcp-server/api-pagination-debugging)
Your own site
<a href="https://agentmods.dev/skills/ngpestelos/readwise-mcp-server/api-pagination-debugging"><img src="https://agentmods.dev/badge/skills/ngpestelos/readwise-mcp-server/api-pagination-debugging.svg" alt="Measured on agentmods" height="20"></a>
Per session 93 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,928 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00093 $0.03928
Opus 5 $0.00046 $0.01964
Sonnet 5 $0.00019 $0.00786
Haiku 4.5 $0.00009 $0.00393

Measured 4d ago against content hash 586a1376e860, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

API Pagination Debugging scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

curl -s API_ENDPOINT | jq 'keys'
.claude/skills/api-pagination-debugging/SKILL.md · 592 lines

How it starts

The opening of the file, as written. The whole thing — 592 lines — stays where its author put it; the contents beside it link to each section on GitHub.

API Pagination Debugging

Purpose: Systematically diagnose and fix pagination failures that prevent complete data import from APIs

Core Principles

1. Verify API Response Structure Before Assuming

Never assume pagination fields based on documentation or other endpoints. Always test actual responses:

curl -s API_ENDPOINT | jq 'keys'

Different API versions or endpoints may use different pagination patterns even within the same service.

2. Match Pagination Logic to API Design

APIs use distinct pagination patterns that require different implementations:

  • Cursor-based: {nextPageCursor, results} - use cursor param
  • Page-based: {page, total_pages, results} - use page number param
  • Offset-based: {offset, limit, total} - use offset/limit params
  • Link-based: {next, previous, results} - follow next URL

Using the wrong pattern causes pagination to stop after first page.

3. Optimize Page Size for Efficiency

Most APIs support configurable page sizes (e.g., 50-1000 items per page). Using maximum page_size:

  • Reduces total API calls (20x fewer calls with 1000 vs 50)
  • Decreases network overhead
  • Minimizes rate limit exposure
  • Speeds up bulk imports

4. Test Pagination Flow Before Implementation

Before implementing pagination logic:

  1. Fetch page 1 and inspect response structure
  2. Manually fetch page 2 to confirm field values
  3. Verify cursor/page advancement works correctly
  4. Check termination condition (null cursor, empty results, etc.)

Systematic Debugging Workflow

Step 1: Reproduce the Issue

Symptoms of pagination failure:

  • Import stops after exactly 1 page
  • Returns same results repeatedly
  • Status shows "completed_all_pages" but dataset incomplete
  • Missing data compared to known totals

Example:

Expected: 74,386 highlights
Actual: 463 files (< 1% of total)
Status: "completed_all_pages" after 1 page

Step 2: Inspect Actual API Response

Don't trust assumptions - verify response structure:

Read the full file on GitHub · 592 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 592 lines · 93 tokens per session scan A 586a1376e860

Subscribe to this mod's changes

API Pagination Debugging is a skill published in the GitHub repository ngpestelos/readwise-mcp-server (0 stars, last pushed 2mo ago), licensed MIT. It adds 93 tokens to every session and 3,928 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

local-ai-agents

Build local-first AI agents that run entirely on a developer workstation with Microsoft Foundry Local and Qwen function-calling models. Covers Small Language Models (SLMs), the OpenAI-compatible local endpoint, sandboxed local tools, local RAG with Chroma, local MCP servers, hybrid cloud/local routing, and the…

microsoft/ai-agents-for-beginners · 200 tokens

next-cache-components-adoption

Turn on Cache Components in a Next.js app and resolve the blocking routes it surfaces. Use when the user wants to enable, adopt, or migrate to Cache Components, flip the cacheComponents flag, work through a flood of blocking-prerender / instant validation errors, run the cache-components-instant-false codemod, or…

vercel/next.js · 95 tokens

chat-pet-sprite-creation

Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.

microsoft/vscode · 53 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens

insight-error-page

Write or audit an insight-kind error page for the Next.js dev overlay. Use when creating a new errors/ .mdx page, auditing an existing one, or checking that a page matches the framework fix cards. Covers page structure, title alignment, FixCard cards with Copy prompt button, code snippets, terminology verification…

vercel/next.js · 83 tokens