agentsclimarketplace

Be pagination patterns

Skill barcelosvinicius/basic-engineering/plugins/be/skills/be-pagination-patterns

Claude Code plugin + npm base for AI-assisted engineering: 25 skills, 12 agents, slash commands, session-continuity hook. Also works with Copilot, Cursor, and others.

Install
npx -y skills add barcelosvinicius/basic-engineering --skill be-pagination-patterns

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Use when implementing or fixing any REST endpoint that returns a collection. Never return an unbounded list — server-side pagination with offset or cursor strategies, response contract, and limits. Spring Boot and Angular examples as on-demand resources.

SKILL.md

2.9 KB, as published. Nobody here has run it

Skill: REST Endpoint Pagination

Defines the server-side pagination pattern for list endpoints.

Why it is critical: endpoints without pagination return all records at once. As data grows, this causes timeouts, memory overflow, and performance degradation for all users simultaneously.

Rules

  1. Every collection endpoint is paginated — no exceptions for "small" tables; they grow.
  2. Sane defaults, hard limits: default page size 20–50; maximum page size capped server-side (e.g., 100) — never trust the client's size.
  3. Deterministic ordering: always apply an explicit sort (typically most recent first); unordered pagination produces duplicates and gaps.
  4. Explicit response contract — return pagination metadata alongside the data, never a bare array:
{
  "content": [...],
  "page": 0,
  "size": 30,
  "totalElements": 247,
  "totalPages": 9,
  "first": true,
  "last": false
}

Standard query parameters: ?page=0&size=30&sort=createdAt,desc (offset) or ?cursorId=1234&size=30 (cursor).

Offset vs cursor

Offset (page=N) — default, suitable for most cases:

  • ✅ Simple; allows jumping to any page.
  • ⚠️ Performance degrades at very high offsets (OFFSET 10000 is slow); rows inserted mid-navigation shift pages (duplicates).

Cursor (based on last ID or timestamp) — for feeds and high-frequency lists:

  • ✅ Constant performance at any position; consistent under concurrent writes.
  • ⚠️ No jumping to an arbitrary page.
  • Response shape: { content: [...], nextCursor: 1205, hasMore: true }.

Use cursor for: real-time activity feeds, notifications, chat. Use offset for: filtered tables, reports, "go to page N" UIs.

Common mistakes

MistakeCauseSolution
Endpoint returns unbounded listRepository method without paginationMake pagination part of the data-access signature
Sorting silently ignoredSort field doesn't exist in the modelValidate sort fields against an allowlist
size=0 or size=100000 acceptedNo bounds validationEnforce min 1 / server-side max
Very high page is slowHigh SQL OFFSETSwitch to cursor for deep navigation
Frontend shows duplicatesInserts between offset pagesUse cursor or de-duplicate by ID client-side

Resources

  • examples-spring-angular.md — full Spring Boot implementation (repository → service → controller → PageResponse DTO, @PageableDefault, max-page-size config, cursor query) and Angular client (typed model, service, infinite scroll + classic pagination).

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.