Nuqs

by pproencacf93c57cac89No license215 starsListed Oct 8, 2026Updated Oct 8, 2026Repository updated 7 weeks ago

nuqs (type-safe URL query state) best practices for Next.js and other React frameworks. This skill should be used when writing, reviewing, or refactoring code that uses nuqs for URL state management. Triggers on tasks involving useQueryState, useQueryStates, search params, URL state, query parameters, nuqs parsers, limitUrlUpdates, Standard Schema, NuqsAdapter, or Next.js routing with state.

Instructions onlySoftware Development
AI-generated overview

Guidelines for using nuqs type-safe URL query state in Next.js and React apps.

What it does
This skill provides a prioritized set of best-practice rules for managing URL query state with nuqs in Next.js and other React frameworks. It covers parser configuration, adapter setup, state management, server integration, performance, history and navigation, debugging, and advanced patterns. Each rule is documented in a separate reference file with explanations and code examples, and a compiled guide is included in AGENTS.md.
When to use it
Use it when writing, reviewing, or refactoring code that uses nuqs for URL state, such as useQueryState, useQueryStates, search params, or NuqsAdapter. It also applies when configuring parsers, integrating URL state with Server Components, or optimizing URL update performance.
Requirements
No scripts are shipped; the skill is instructions and reference documents only. It assumes a project using nuqs with Next.js or another React framework, and covers nuqs v2.5 through v2.9.

Community nuqs Best Practices for Next.js & React

Comprehensive guide for type-safe URL query state management with nuqs across Next.js, React Router, TanStack Router, Remix, and plain React. Covers nuqs v2.5–v2.9 features. Contains 39 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 or React Router project
  • Configuring parsers for URL parameters
  • Integrating URL state with Server Components
  • Optimizing URL update performance (limitUrlUpdates, key isolation)
  • Sharing parser definitions with tRPC / TanStack Router / forms via Standard Schema
  • Debugging nuqs-related issues

Rule Categories by Priority

PriorityCategoryImpactPrefix
1Parser ConfigurationCRITICALparser-
2Adapter & SetupCRITICALsetup-
3State ManagementHIGHstate-
4Server IntegrationHIGHserver-
5Performance OptimizationMEDIUMperf-
6History & NavigationMEDIUMhistory-
7Debugging & TestingLOW-MEDIUMdebug-
8Advanced PatternsLOWadvanced-

Quick Reference

1. Parser Configuration (CRITICAL)

  • parser-use-typed-parsers [blocked] — Use typed parsers for non-string values
  • parser-with-default [blocked] — Use withDefault for non-nullable state
  • parser-enum-validation [blocked] — Use enum parsers for constrained values
  • parser-array-format [blocked] — Choose correct array parser format
  • parser-json-validation [blocked] — Validate JSON parser input
  • parser-date-format [blocked] — Select appropriate date parser
  • parser-index-offset [blocked] — Use parseAsIndex for 1-based URL display

2. Adapter & Setup (CRITICAL)

  • setup-nuqs-adapter [blocked] — Wrap app with NuqsAdapter
  • setup-use-client [blocked] — Add 'use client' directive for hooks
  • setup-import-server [blocked] — Import server utilities from nuqs/server
  • setup-nextjs-version [blocked] — Ensure compatible Next.js version
  • setup-shared-parsers [blocked] — Define shared parsers in dedicated file
  • setup-default-options [blocked] — Configure app-wide defaults on NuqsAdapter (v2.5+)

3. State Management (HIGH)

  • state-use-query-states [blocked] — Use useQueryStates for related parameters
  • state-clear-with-null [blocked] — Clear URL parameters with null
  • state-avoid-derived [blocked] — Avoid derived state from URL parameters
  • state-options-inheritance [blocked] — Use withOptions for parser-level configuration
  • state-setter-return [blocked] — Use setter return value for URL access
  • state-standard-schema [blocked] — Use Standard Schema for cross-library validation (v2.5+)

4. Server Integration (HIGH)

  • server-search-params-cache [blocked] — Use createSearchParamsCache (or createLoader) for Server Components
  • server-shallow-false [blocked] — Use shallow:false to trigger server re-renders
  • server-use-transition [blocked] — Integrate useTransition for loading states
  • server-parse-before-get [blocked] — Call parse() before get() in Server Components
  • server-next15-async [blocked] — Handle async searchParams in Next.js 15+

5. Performance Optimization (MEDIUM)

  • perf-throttle-updates [blocked] — Throttle rapid URL updates with limitUrlUpdates
  • perf-debounce-search [blocked] — Debounce search input with built-in limitUrlUpdates
  • perf-clear-on-default [blocked] — Use clearOnDefault for clean URLs
  • perf-avoid-rerender [blocked] — Memoize components using URL state (Next.js)
  • perf-key-isolation [blocked] — Rely on key isolation outside Next.js (v2.5+)
  • perf-serialize-utility [blocked] — Use createSerializer for link URLs

6. History & Navigation (MEDIUM)

  • history-push-navigation [blocked] — Choose history:push vs history:replace
  • history-scroll-behavior [blocked] — Control scroll behavior on URL changes

7. Debugging & Testing (LOW-MEDIUM)

  • debug-enable-logging [blocked] — Enable debug logging for troubleshooting
  • debug-testing [blocked] — Test components with URL state

8. Advanced Patterns (LOW)

  • advanced-custom-parsers [blocked] — Create custom parsers for complex types
  • advanced-url-keys [blocked] — Use urlKeys for shorter URLs
  • advanced-eq-function [blocked] — Implement eq function for object parsers
  • advanced-framework-adapters [blocked] — Use framework-specific adapters
  • advanced-process-url-search-params [blocked] — Canonicalize URL shape with processUrlSearchParams (v2.6+)

How to Use

Read individual reference files for detailed explanations and code examples:

  • Section definitions [blocked] — Category structure and impact levels
  • Rule template [blocked] — Template for adding new rules

Reference Files

FileDescription
AGENTS.md [blocked]Complete compiled guide with all rules
references/_sections.md [blocked]Category definitions and ordering
assets/templates/_template.md [blocked]Template for new rules
metadata.json [blocked]Version and reference information

Source and attribution

Source:pproenca/dot-skillsinskills/.curated/nuqsat commitcf93c57

License: No license

Content belongs to its original authors. SourceWeft indexes it from a public repository.

Report or request removal