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
parser-
2
Adapter & Setup
CRITICAL
setup-
3
State Management
HIGH
state-
4
Server Integration
HIGH
server-
5
Performance Optimization
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-use-typed-parsers - Use typed parsers for non-string values
parser-with-default - Use withDefault for non-nullable state
parser-enum-validation - Use enum parsers for constrained values
parser-array-format - Choose correct array parser format
debug-enable-logging - Enable debug logging for troubleshooting
debug-common-errors - Diagnose common nuqs errors
debug-testing - Test components with URL state
8. Advanced Patterns (LOW)
advanced-custom-parsers - Create custom parsers for complex types
advanced-url-keys - Use urlKeys for shorter URLs
advanced-eq-function - Implement eq function for object parsers
advanced-framework-adapters - Use framework-specific 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
1---2name: nuqs3description: Community nuqs Best Practices for Next.js4---5# Community nuqs Best Practices for Next.js67Comprehensive 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.89## When to Apply1011Reference these guidelines when:12- Implementing URL-based state with nuqs13- Setting up nuqs in a Next.js project14- Configuring parsers for URL parameters15- Integrating URL state with Server Components16- Optimizing URL update performance17- Debugging nuqs-related issues1819## Rule Categories by Priority2021| Priority | Category | Impact | Prefix |22|----------|----------|--------|--------|23| 1 | Parser Configuration | CRITICAL | `parser-` |24| 2 | Adapter & Setup | CRITICAL | `setup-` |25| 3 | State Management | HIGH | `state-` |26| 4 | Server Integration | HIGH | `server-` |27| 5 | Performance Optimization | MEDIUM | `perf-` |28| 6 | History & Navigation | MEDIUM | `history-` |29| 7 | Debugging & Testing | LOW-MEDIUM | `debug-` |30| 8 | Advanced Patterns | LOW | `advanced-` |3132## Quick Reference3334### 1. Parser Configuration (CRITICAL)3536- [`parser-use-typed-parsers`](references/parser-use-typed-parsers.md) - Use typed parsers for non-string values37- [`parser-with-default`](references/parser-with-default.md) - Use withDefault for non-nullable state38- [`parser-enum-validation`](references/parser-enum-validation.md) - Use enum parsers for constrained values39- [`parser-array-format`](references/parser-array-format.md) - Choose correct array parser format40- [`parser-json-validation`](references/parser-json-validation.md) - Validate JSON parser input41- [`parser-date-format`](references/parser-date-format.md) - Select appropriate date parser42- [`parser-index-offset`](references/parser-index-offset.md) - Use parseAsIndex for 1-based URL display43- [`parser-hex-colors`](references/parser-hex-colors.md) - Use parseAsHex for color values4445### 2. Adapter & Setup (CRITICAL)4647- [`setup-nuqs-adapter`](references/setup-nuqs-adapter.md) - Wrap app with NuqsAdapter48- [`setup-use-client`](references/setup-use-client.md) - Add 'use client' directive for hooks49- [`setup-import-server`](references/setup-import-server.md) - Import server utilities from nuqs/server50- [`setup-nextjs-version`](references/setup-nextjs-version.md) - Ensure compatible Next.js version51- [`setup-shared-parsers`](references/setup-shared-parsers.md) - Define shared parsers in dedicated file5253### 3. State Management (HIGH)5455- [`state-use-query-states`](references/state-use-query-states.md) - Use useQueryStates for related parameters56- [`state-functional-updates`](references/state-functional-updates.md) - Use functional updates for derived state57- [`state-clear-with-null`](references/state-clear-with-null.md) - Clear URL parameters with null58- [`state-controlled-inputs`](references/state-controlled-inputs.md) - Handle controlled input value properly59- [`state-avoid-derived`](references/state-avoid-derived.md) - Avoid derived state from URL parameters60- [`state-options-inheritance`](references/state-options-inheritance.md) - Use withOptions for parser-level configuration61- [`state-setter-return`](references/state-setter-return.md) - Use setter return value for URL access6263### 4. Server Integration (HIGH)6465- [`server-search-params-cache`](references/server-search-params-cache.md) - Use createSearchParamsCache for Server Components66- [`server-shallow-false`](references/server-shallow-false.md) - Use shallow:false to trigger server re-renders67- [`server-use-transition`](references/server-use-transition.md) - Integrate useTransition for loading states68- [`server-parse-before-get`](references/server-parse-before-get.md) - Call parse() before get() in Server Components69- [`server-share-parsers`](references/server-share-parsers.md) - Share parsers between client and server70- [`server-next15-async`](references/server-next15-async.md) - Handle async searchParams in Next.js 15+7172### 5. Performance Optimization (MEDIUM)7374- [`perf-throttle-updates`](references/perf-throttle-updates.md) - Throttle rapid URL updates75- [`perf-clear-on-default`](references/perf-clear-on-default.md) - Use clearOnDefault for clean URLs76- [`perf-avoid-rerender`](references/perf-avoid-rerender.md) - Memoize components using URL state77- [`perf-serialize-utility`](references/perf-serialize-utility.md) - Use createSerializer for link URLs78- [`perf-debounce-search`](references/perf-debounce-search.md) - Debounce search input before URL update7980### 6. History & Navigation (MEDIUM)8182- [`history-push-navigation`](references/history-push-navigation.md) - Use history:push for navigation-like state83- [`history-replace-ephemeral`](references/history-replace-ephemeral.md) - Use history:replace for ephemeral state84- [`history-scroll-behavior`](references/history-scroll-behavior.md) - Control scroll behavior on URL changes85- [`history-back-sync`](references/history-back-sync.md) - Handle browser back/forward navigation8687### 7. Debugging & Testing (LOW-MEDIUM)8889- [`debug-enable-logging`](references/debug-enable-logging.md) - Enable debug logging for troubleshooting90- [`debug-common-errors`](references/debug-common-errors.md) - Diagnose common nuqs errors91- [`debug-testing`](references/debug-testing.md) - Test components with URL state9293### 8. Advanced Patterns (LOW)9495- [`advanced-custom-parsers`](references/advanced-custom-parsers.md) - Create custom parsers for complex types96- [`advanced-url-keys`](references/advanced-url-keys.md) - Use urlKeys for shorter URLs97- [`advanced-eq-function`](references/advanced-eq-function.md) - Implement eq function for object parsers98- [`advanced-framework-adapters`](references/advanced-framework-adapters.md) - Use framework-specific adapters99100## How to Use101102Read individual reference files for detailed explanations and code examples:103104- [Section definitions](references/_sections.md) - Category structure and impact levels105- [Rule template](assets/templates/_template.md) - Template for adding new rules106107## Reference Files108109| File | Description |110|------|-------------|111| [AGENTS.md](AGENTS.md) | Complete compiled guide with all rules |112| [references/_sections.md](references/_sections.md) | Category definitions and ordering |113| [assets/templates/_template.md](assets/templates/_template.md) | Template for new rules |114| [metadata.json](metadata.json) | Version and reference information |
Run npx skillmds@latest add comeonoliver/nuqs in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Community nuqs Best Practices for Next.js It is listed under Web & Frontend on SkillMD.
This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
ComeOnOliver (@comeonoliver) published this skill. Their other Agent Skills are listed on their SkillMD profile.