list-queries

Designs paginated list, search, and picker queries for large multi-tenant database tables.

Updated Jan 12, 2026
One-click install
npx skills add https://github.com/brandonarbini/arbini.family --skill list-queries-brandonarbini
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: list-queries
Source: https://github.com/brandonarbini/arbini.family/tree/main/.agents/skills/list-queries
Command: npx skills add https://github.com/brandonarbini/arbini.family --skill list-queries-brandonarbini

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? List endpoints, dropdowns, and pickers that fetch entire tables work fine against seed data but collapse in production when a table holds tens of thousands of rows per tenant. This Skill enforces query shapes that scale from day one, avoiding painful rewrites of both the database query and the UI contract later. ## Core Features & Use Cases - Bounded list queries: Enforces server-clamped limits, tenant-scoped WHERE clauses over indexed columns, and keyset (cursor) pagination instead of offset pagination. - Search-as-you-type pickers: Defines a pattern for typeahead endpoints with debounced client requests, AbortController cancellation, hard result caps, and per-group caps for multi-entity search. - Free-text query support: Ensures every list function accepts a case-insensitive query across natural keys like name or email so callers can find rows instead of paging to them. - Use Case: When building a Prisma-backed Next.js combobox that lists all customers for a tenant, apply this Skill to replace a fetch-all-then-filter approach with a capped, cursor-paginated, tenant-scoped search endpoint. ## Quick Start Review my customer picker endpoint and rewrite it to use keyset pagination with a capped, tenant-scoped search query.

Frequently Asked Questions about list-queries

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

FAQPage Schema
How do I implement cursor pagination with Prisma?▼

Use keyset pagination by ordering on a stable unique tuple like createdAt plus id, passing the last row's id as the cursor with skip: 1, and taking limit + 1 rows. The extra row signals whether more results exist without running a COUNT query.

How do I build a search-as-you-type dropdown for a large table?▼

Create a dedicated endpoint that takes a short free-text query and returns a hard-capped set, such as take: 10, scoped by tenant. Debounce client input by 150-250 ms and cancel superseded requests with an AbortController so slow responses cannot land out of order.

Why is offset pagination bad for large tables?▼

Offset pagination forces the database to walk every skipped row, so deep pages get progressively slower. Concurrent inserts also shift rows between pages, causing duplicates or gaps, which keyset pagination avoids by anchoring to a stable cursor.

Should a typeahead search endpoint still filter by tenant?▼

Yes, a typeahead is not exempt from tenant scoping just because its result set is small. Scope the WHERE clause by tenant id over an index that leads with that column, exactly as you would for any other list query.

What is wrong with fetching all rows and filtering client-side?▼

Fetch-all-then-filter loads the entire table into memory and transfers it over the network, which breaks down as the table grows. The filter criterion should be expressed as a WHERE clause so the database does the work over an index.