pagination-and-filtering

pagination-and-filtering is a skill for Claude Code, Codex from tmj-90/gaffer. It costs 95 tokens per session (1,476 once invoked), scanned A, original, Apache-2.0.

A way to build list endpoints and screens that split results into manageable pages and support sorting, filtering, or search. It keeps the result order stable even while records are being added or changed.

In plain words
What is it for?
It helps implement API collections, database queries, tables, and exports with page limits, cursors, sorting, filters, and search. It also helps match the response shape already used by the project.
Why use it?
Unbounded lists can use too much time or memory, and simple page numbers can repeat or skip records when data changes. Proper limits, indexes, and stable ordering also reduce the risk of expensive requests.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit It helps implement API collections, database queries, tables, and exports with page limits, cursors, sorting, filters, and search. It also helps match the response shape already used by the project.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/tmj-90/gaffer/pagination-and-filtering
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.

Any agent
npx skills add tmj-90/gaffer --skill pagination-and-filtering
Clone the repo
git clone --depth 1 https://github.com/tmj-90/gaffer

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 pagination-and-filtering

README.md
[![agentmods](https://agentmods.dev/badge/skills/tmj-90/gaffer/pagination-and-filtering/github.svg)](https://agentmods.dev/skills/tmj-90/gaffer/pagination-and-filtering)
Your own site
<a href="https://agentmods.dev/skills/tmj-90/gaffer/pagination-and-filtering"><img src="https://agentmods.dev/badge/skills/tmj-90/gaffer/pagination-and-filtering/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for pagination-and-filtering

Your own site · 80×15
<a href="https://agentmods.dev/skills/tmj-90/gaffer/pagination-and-filtering"><img src="https://agentmods.dev/badge/skills/tmj-90/gaffer/pagination-and-filtering.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 95 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,476 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00095 $0.01476
Opus 5.5 $0.00038 $0.00590
Sonnet 5.5 $0.00019 $0.00295
Haiku 4.5 $0.00010 $0.00148

Measured 16d ago against content hash b4310b36a05e, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

pagination-and-filtering scanned grade A with 0 findings 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 16d 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

runner/skills/pagination-and-filtering/SKILL.md · 93 lines

How it starts

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

Paginate, sort and filter a collection

A list endpoint is where unbounded cost and subtle inconsistency hide. OFFSET makes the database read and discard every skipped row, and it skips or repeats rows when the table changes between requests; a non-unique sort order makes page boundaries nondeterministic; an unbounded limit is a denial of service. Sources: Markus Winand, Use The Index, Luke ("Paging Through Results", "No Offset"); PostgreSQL and MySQL documentation on row-value comparison and ORDER BY; RFC 8288 (Link header).

Steps

  1. Match the existing list contract. Copy a sibling endpoint/component: envelope (items, next_cursor or page, total if offered), parameter names (limit, cursor, sort, filter[...]), defaults, and error shape. Call search_lore for the repo's pagination convention. A second list shape is a defect.
  2. Prefer cursor (keyset) pagination for data that changes. The cursor encodes the last row's sort-key values plus its id; the next page is WHERE (created_at, id) < (:c_created_at, :c_id) ORDER BY created_at DESC, id DESC LIMIT :limit + 1. With mixed directions (name ASC, id DESC) a row-value comparison is wrong; expand it: name > :n OR (name = :n AND id < :id). Use offset only for small, static lists or a genuine "jump to page N" need, stated in the code.
  3. Make the sort total, index-backed and NULL-safe. Every sort ends with a unique tiebreaker (the primary key). Back each allowed sort with a composite index in the same column order and direction, after any equality filters (the sql-query-performance skill). Keyset on a nullable column breaks (NULL compares as unknown); sort on a non-null column, or make NULL placement explicit (NULLS LAST) and handle the NULL segment in the predicate. Allow-list sortable fields; never interpolate a client column name.
  4. Make cursors opaque and bound to their query. Base64url-encode JSON (or sign it with an HMAC if tampering matters) containing the key values, sort, and a hash of the filters. Reject a cursor used with different sort/filter parameters or with malformed contents with 400, never a 500 or a silent restart from page one.
  5. Bound the page. A default limit (20–50) and a hard maximum (100–200); reject above it with 400 (or clamp, if that is the repo's convention, and say so in the response). Fetch limit + 1 rows to compute has_more; return next_cursor only when there is one. Offer Link: <…>; rel="next" if the repo uses it.
  6. Filters are typed data, never query fragments. Each filter has a declared type and allowed operators (status=open,ready, created_after=2026-01-01T00:00:00Z), is validated at the boundary, and is bound as a parameter. Tenant/ownership scoping is applied server-side before any client filter (the security-authz skill). Full-text search uses the database's FTS or the search engine, with its own limits.
  7. Be honest about totals. An exact COUNT(*) over a large filtered set costs as much as the query itself; offer it only when cheap or requested, otherwise has_more or a labelled estimate. Never compute an expensive count on every page.
  8. Keep the UI in step. Same parameter names; active sort and filters in the URL (shareable, back button works); empty, loading and error states handled; filter changes reset the cursor (the frontend-data-fetching skill).

Read the full file on GitHub · 93 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. 16d ago Changed · +27 lines b4310b36a05e
  2. 19d ago First seen · 66 lines · 95 tokens per session scan A 35adcf55882e

Subscribe to this mod's changes

pagination-and-filtering is a skill published in the GitHub repository tmj-90/gaffer (2 stars, last pushed 17d ago), licensed Apache-2.0. It adds 95 tokens to every session and 1,476 once invoked, about $0.0004 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-28.

Related

Other skills, from other repositories

compound-field-patterns

Compound fields (Name, Address, Geolocation): SOQL access rules, DML semantics, component access in Apex/LWC, reporting column behavior, formula field restrictions. NOT for creating a new custom field — use admin/custom-field-creation. NOT for formula syntax and functions — use admin/formula-fields.

PranavNagrecha/AwesomeSalesforceSkills · 67 tokens

caching-strategies

Implement effective caching at every layer: in-memory, Redis, CDN, and browser. Activate whenever the user asks about caching, performance optimization for repeated data access, Redis patterns, CDN configuration, cache invalidation, HTTP cache headers, memoization, or stale-while-revalidate strategies.

VersoXBT/claude-initial-setup · 63 tokens

backend-patterns

Backend architecture patterns, API design, database optimization, and server-side best practices. Use when building APIs, services, or server-side functionality.

Wania-Kazmi/claude-code-autonomous-agent-workflow · 32 tokens

backend-patterns

Backend architecture patterns, API design, database optimization, and server-side best practices for Node.js, Express, and Next.js API routes. Use when building or reviewing Node.js, Express, or Next.js API routes and their data access.

affaan-m/ECC · 51 tokens

event-store-design

Design and implement event stores for event-sourced systems. Use when building event sourcing infrastructure, choosing event store technologies, or implementing event persistence patterns.

wshobson/agents · 33 tokens

ai-persistence/build-drizzle-adapter

Use when an app already runs Drizzle ORM and needs TanStack AI chat persistence — writes a chat-persistence.ts into the app against its existing db handle, schema file, and drizzle-kit journal. Covers the four tables (SQLite/Postgres/MySQL), the onConflict idempotency rules, JSON columns, and per-request bindings like…

TanStack/ai · 79 tokens