Awesome-omni-skill Pagination, Search, and Sorting
Implement server-side pagination, search filtering, and column sorting across API endpoints and frontend list pages.
install
source · Clone the upstream repo
git clone https://github.com/diegosouzapw/awesome-omni-skill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/diegosouzapw/awesome-omni-skill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/backend/pagination-search-and-sorting" ~/.claude/skills/diegosouzapw-awesome-omni-skill-pagination-search-and-sorting && rm -rf "$T"
manifest:
skills/backend/pagination-search-and-sorting/SKILL.mdsource content
Pagination, Search, and Sorting
Backend
Query Parameters
All list endpoints accept:
(int, default: 1) — current page numberpage
(int, default: 10) — items per pagepageSize
(string?, optional) — text to filter resultssearch
(string, default varies) — field name to sort bysortBy
(string, default: "asc") —sortDirection
orascdesc
Default Sort Orders
- Patients: by
thenlastNamefirstName - Doctors: by
thenspecialtylastName - Exams: by
scheduledDate
Store Implementation
public (IReadOnlyList<T> Items, int TotalCount) GetPaged(int page, int pageSize, string sortBy, string sortDirection) { var totalCount = _collection.Count(); var items = ApplySort(_collection.FindAll(), sortBy, sortDirection) .Skip((page - 1) * pageSize).Take(pageSize).ToList(); return (items, totalCount); } public (IReadOnlyList<T> Items, int TotalCount) SearchPaged(string search, int page, int pageSize, string sortBy, string sortDirection) { var filtered = _collection.FindAll() .Where(item => /* case-insensitive string matching on relevant fields */) .ToList(); var totalCount = filtered.Count; var items = ApplySort(filtered, sortBy, sortDirection) .Skip((page - 1) * pageSize).Take(pageSize).ToList(); return (items, totalCount); }
Response Structure
public record {Entity}ListResponse( IReadOnlyList<{Entity}Response> Items, PaginationInfo Pagination, SortInfo Sort, IReadOnlyList<Link> Links);
Pagination Links
Use
PaginationLinks.Build(basePath, page, pageSize, totalPages, search, sortBy, sortDirection, additionalLinks).
Frontend
List Page Pattern
- State:
,page
,pageSize
,search
,sortBy
,sortDirection
.data - Fetch with query params appended to the HATEOAS-discovered base URL.
- MUI
for page navigation.TablePagination - MUI
+TextField
for search input.Button - MUI
on column headers for sort toggle.TableSortLabel - Clicking a column header cycles: default → asc → desc.