nuqs
9
总安装量
9
周安装量
#32762
全站排名
安装命令
npx skills add https://github.com/fellipeutaka/leon --skill nuqs
Agent 安装分布
opencode
9
claude-code
9
github-copilot
9
codex
9
kimi-cli
9
gemini-cli
9
Skill 文档
nuqs Best Practices
Type-safe URL query state management with nuqs 2.x. Contains rules across 8 categories, prioritized by impact.
Rule Categories
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Parser Configuration | CRITICAL | parser- |
| 2 | Adapter & Setup | CRITICAL | setup- |
| 3 | State Management | HIGH | state- |
| 4 | Server Integration | HIGH | server- |
| 5 | Performance | MEDIUM | perf- |
| 6 | History & Navigation | MEDIUM | history- |
| 7 | Debugging & Testing | LOW-MEDIUM | debug- |
| 8 | Advanced Patterns | LOW | advanced- |
Quick Reference
1. Parser Configuration (CRITICAL)
parser-typedâ Use typed parsers for non-string valuesparser-with-defaultâ Use withDefault for non-nullable stateparser-enum-literalsâ Use literal/enum parsers for constrained valuesparser-array-formatâ Choose correct array parser formatparser-json-validationâ Validate JSON parser with Standard Schemaparser-date-formatâ Select appropriate date parserparser-index-offsetâ Use parseAsIndex for 1-based URL displayparser-hex-colorsâ Use parseAsHex for color valuesparser-customâ Create custom parsers for complex types
2. Adapter & Setup (CRITICAL)
setup-adapterâ Wrap app with correct NuqsAdaptersetup-client-hooksâ Add ‘use client’ for hookssetup-server-importsâ Import server utilities from nuqs/serversetup-shared-parsersâ Define shared parsers in a dedicated file
3. State Management (HIGH)
state-use-query-statesâ Use useQueryStates for related parametersstate-functional-updatesâ Use functional updates for derived statestate-clear-with-nullâ Clear URL parameters with nullstate-controlled-inputsâ Handle controlled input value properlystate-avoid-derivedâ Avoid derived state from URL parametersstate-options-inheritanceâ Use withOptions for parser-level configstate-setter-returnâ Use setter return value for URL access
4. Server Integration (HIGH)
server-create-loaderâ Use createLoader for page-level server parsingserver-search-params-cacheâ Use createSearchParamsCache for nested RSC accessserver-shallow-falseâ Use shallow:false to trigger server re-rendersserver-use-transitionâ Integrate useTransition for loading statesserver-share-parsersâ Share parsers between client and serverserver-next15-asyncâ Handle async searchParams in Next.js 15+
5. Performance (MEDIUM)
perf-limit-url-updatesâ Throttle/debounce URL updatesperf-clear-on-defaultâ Use clearOnDefault for clean URLsperf-avoid-rerenderâ Memoize components using URL stateperf-serialize-utilityâ Use createSerializer for link URLs
6. History & Navigation (MEDIUM)
history-push-navigationâ Use history:push for navigation-like statehistory-replace-ephemeralâ Use history:replace for ephemeral statehistory-scroll-behaviorâ Control scroll behavior on URL changeshistory-back-syncâ Handle browser back/forward navigation
7. Debugging & Testing (LOW-MEDIUM)
debug-enable-loggingâ Enable debug logging for troubleshootingdebug-common-errorsâ Diagnose common nuqs errorsdebug-testingâ Test components and hooks with URL state
8. Advanced Patterns (LOW)
advanced-url-keysâ Use urlKeys for shorter URL param namesadvanced-eq-functionâ Implement eq function for object parsersadvanced-adapter-propsâ Configure NuqsAdapter global defaults and URL middlewareadvanced-standard-schemaâ Use createStandardSchemaV1 and inferParserTypeadvanced-optimistic-search-paramsâ useOptimisticSearchParams for Remix/React Router