一键导入
sort-prefs-cookie-by-path
Persist sort preferences in a cookie keyed by path (not resource ID); restore when URL has no sort params.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Persist sort preferences in a cookie keyed by path (not resource ID); restore when URL has no sort params.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
When changing API routes, auth, or env-dependent behavior, add or update the corresponding integration tests and keep the test file layout consistent.
When adding or changing files under infra/k8s/ or sync targets for k8s, know what Argo CD syncs and remind the user to push to Git so the cluster can sync.
Keeps tools/generate-data seeders and docs in sync when main or management DB schema or ORM entities change. Use when adding or changing tables/entities in packages/orm, packages/management-orm, or infra database migrations.
When changing DB schema or permission dimensions, consider predefined roles and bucket_role / role-related code.
Use when adding or changing environment variables, infra/env/classification YAML, scripts/env-classification, K8s env render, or local env generation.
Common patterns for the Boilerplate HTTP API (Express)
| name | sort-prefs-cookie-by-path |
| description | Persist sort preferences in a cookie keyed by path (not resource ID); restore when URL has no sort params. |
Use this skill when adding or changing sort UI (messages recent/oldest, table sortBy/sortOrder). Persist the user's last choice in a cookie keyed by path (e.g. bucket-detail-messages, bucket-detail-buckets), not by resource ID. Restore when the URL has no sort param(s).
This file is the authority for sort preference persistence and restore behavior.
First-paint / no flash: Prefer restoring from the cookie on the server (redirect when URL has no sort params) so the first paint shows the correct sort and there is no flash of unsorted content. Use server-safe helpers (getMessagesSortFromCookieValue, getSortPrefsFromCookieValue) in the page and redirect() before fetching data. Keep client-side restore in TableWithSort and MessagesSortSelect for in-app navigation.
Implement at the table level via TableWithSort so any sortable table can opt in:
sortPrefsCookieName, sortPrefsListKey (path-based, e.g. bucket-detail-buckets), and getSortUrl(sortBy, sortOrder).router.replace(getSortUrl(...))) and save (on header click → write cookie → onSortChange(sortKey, nextOrder)).onSortChange has signature (sortKey: string, nextOrder: 'asc' | 'desc') => void.Implement in the component that owns the select (e.g. MessagesSortSelect):
sortPrefsCookieName. When set: restore (effect when URL has no sort → read cookie → if 'oldest', router.replace with sort=oldest); save (on change → setMessagesSortInCookie then router.push).getMessagesSortFromCookie(cookieName), setMessagesSortInCookie(cookieName, sort) from @boilerplate/ui (key bucket-detail-messages).Use the same app cookie as other table sort prefs (TABLE_SORT_PREFS_COOKIE_NAME / management_table_sort_prefs). Add path-based list keys as needed. Cookie value is a map; keys include bucket-detail-messages (value { sort: 'recent' | 'oldest' }) and bucket-detail-buckets (value SortPref).