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.
npx skills add tmj-90/gaffer --skill pagination-and-filteringgit clone --depth 1 https://github.com/tmj-90/gafferWrote 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.
[](https://agentmods.dev/skills/tmj-90/gaffer/pagination-and-filtering)<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.
<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>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.
| Model | Per session | Once 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 |
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.
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
- Match the existing list contract. Copy a sibling endpoint/component: envelope
(
items,next_cursororpage,totalif offered), parameter names (limit,cursor,sort,filter[...]), defaults, and error shape. Callsearch_lorefor the repo's pagination convention. A second list shape is a defect. - 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. - 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-performanceskill). 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. - 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 a500or a silent restart from page one. - Bound the page. A default
limit(20–50) and a hard maximum (100–200); reject above it with400(or clamp, if that is the repo's convention, and say so in the response). Fetchlimit + 1rows to computehas_more; returnnext_cursoronly when there is one. OfferLink: <…>; rel="next"if the repo uses it. - 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 (thesecurity-authzskill). Full-text search uses the database's FTS or the search engine, with its own limits. - 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, otherwisehas_moreor a labelled estimate. Never compute an expensive count on every page. - 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-fetchingskill).
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.
- 16d ago Changed · +27 lines b4310b36a05e
- 19d ago First seen · 66 lines · 95 tokens per session scan A 35adcf55882e
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.
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.
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.
backend-patterns
Backend architecture patterns, API design, database optimization, and server-side best practices. Use when building APIs, services, or server-side functionality.
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.
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.
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…