pagination-with-preserved-aggregates
CommunityAdd fast pagination to list pages without breaking stats or exports.
System Documentation
What problem does it solve?
Adding server-side pagination to admin list pages often breaks summary statistics, page counts, and full-dataset Excel/CSV exports, because the same paginated query is incorrectly used to compute totals that should cover the entire filtered dataset.
Core Features & Use Cases
- Two-query backend pattern: Separates paged row fetching from full-dataset aggregate queries to keep stats and exports accurate across all pagination states.
- Frontend state management: Prevents double-fetch bugs and ensures stats cards read totals from the server, not the current page's row count.
- Built-in smoke tests: Includes a reusable test template to verify the core invariant that totals remain consistent across page 1, page 2, full exports, and group-by modes.
- Use case:适用于任何有列表页、统计卡片、导出功能的大数据量后台页面,比如订单管理、用户列表、审计日志、工时记录等,支持Prisma、Drizzle、Sequelize等所有主流ORM和Elysia、Express、Fastify等后端框架。
Quick Start
Use this skill to implement server-side pagination for your admin order list page while ensuring the total order count summary card and full-dataset Excel export always reflect the complete filtered dataset, not just the current page.
Dependency Matrix
Required Modules
None requiredComponents
💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: pagination-with-preserved-aggregates Download link: https://github.com/freedomw1987/tree_monstor/archive/main.zip#pagination-with-preserved-aggregates Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 536,000+ vetted skills library on demand.