install
source · Clone the upstream repo
git clone https://github.com/ComeOnOliver/skillshub
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ComeOnOliver/skillshub "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/pproenca/dot-skills/nuqs" ~/.claude/skills/comeonoliver-skillshub-nuqs && rm -rf "$T"
manifest:
skills/pproenca/dot-skills/nuqs/SKILL.mdsource content
Community nuqs Best Practices for Next.js
Comprehensive guide for type-safe URL query state management with nuqs in Next.js applications. Contains 42 rules across 8 categories, prioritized by impact to guide code generation, refactoring, and code review.
When to Apply
Reference these guidelines when:
- Implementing URL-based state with nuqs
- Setting up nuqs in a Next.js project
- Configuring parsers for URL parameters
- Integrating URL state with Server Components
- Optimizing URL update performance
- Debugging nuqs-related issues
Rule Categories by Priority
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Parser Configuration | CRITICAL | |
| 2 | Adapter & Setup | CRITICAL | |
| 3 | State Management | HIGH | |
| 4 | Server Integration | HIGH | |
| 5 | Performance Optimization | MEDIUM | |
| 6 | History & Navigation | MEDIUM | |
| 7 | Debugging & Testing | LOW-MEDIUM | |
| 8 | Advanced Patterns | LOW | |
Quick Reference
1. Parser Configuration (CRITICAL)
- Use typed parsers for non-string valuesparser-use-typed-parsers
- Use withDefault for non-nullable stateparser-with-default
- Use enum parsers for constrained valuesparser-enum-validation
- Choose correct array parser formatparser-array-format
- Validate JSON parser inputparser-json-validation
- Select appropriate date parserparser-date-format
- Use parseAsIndex for 1-based URL displayparser-index-offset
- Use parseAsHex for color valuesparser-hex-colors
2. Adapter & Setup (CRITICAL)
- Wrap app with NuqsAdaptersetup-nuqs-adapter
- Add 'use client' directive for hookssetup-use-client
- Import server utilities from nuqs/serversetup-import-server
- Ensure compatible Next.js versionsetup-nextjs-version
- Define shared parsers in dedicated filesetup-shared-parsers
3. State Management (HIGH)
- Use useQueryStates for related parametersstate-use-query-states
- Use functional updates for derived statestate-functional-updates
- Clear URL parameters with nullstate-clear-with-null
- Handle controlled input value properlystate-controlled-inputs
- Avoid derived state from URL parametersstate-avoid-derived
- Use withOptions for parser-level configurationstate-options-inheritance
- Use setter return value for URL accessstate-setter-return
4. Server Integration (HIGH)
- Use createSearchParamsCache for Server Componentsserver-search-params-cache
- Use shallow:false to trigger server re-rendersserver-shallow-false
- Integrate useTransition for loading statesserver-use-transition
- Call parse() before get() in Server Componentsserver-parse-before-get
- Share parsers between client and serverserver-share-parsers
- Handle async searchParams in Next.js 15+server-next15-async
5. Performance Optimization (MEDIUM)
- Throttle rapid URL updatesperf-throttle-updates
- Use clearOnDefault for clean URLsperf-clear-on-default
- Memoize components using URL stateperf-avoid-rerender
- Use createSerializer for link URLsperf-serialize-utility
- Debounce search input before URL updateperf-debounce-search
6. History & Navigation (MEDIUM)
- Use history:push for navigation-like statehistory-push-navigation
- Use history:replace for ephemeral statehistory-replace-ephemeral
- Control scroll behavior on URL changeshistory-scroll-behavior
- Handle browser back/forward navigationhistory-back-sync
7. Debugging & Testing (LOW-MEDIUM)
- Enable debug logging for troubleshootingdebug-enable-logging
- Diagnose common nuqs errorsdebug-common-errors
- Test components with URL statedebug-testing
8. Advanced Patterns (LOW)
- Create custom parsers for complex typesadvanced-custom-parsers
- Use urlKeys for shorter URLsadvanced-url-keys
- Implement eq function for object parsersadvanced-eq-function
- Use framework-specific adaptersadvanced-framework-adapters
How to Use
Read individual reference files for detailed explanations and code examples:
- Section definitions - Category structure and impact levels
- Rule template - Template for adding new rules
Reference Files
| File | Description |
|---|---|
| AGENTS.md | Complete compiled guide with all rules |
| references/_sections.md | Category definitions and ordering |
| assets/templates/_template.md | Template for new rules |
| metadata.json | Version and reference information |