---
name: nuqs
description: nuqs type-safe URL search-param state.
title: nuqs
canonical_url: https://skilld.dev/gh/pymodel/react-frontend-skills/nuqs
last_updated: 2026-11-12T09:04:44.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> 42 supporting files sit beside this SKILL.md. When the Skill refers to one, fetch https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/PATH with PATH replaced.
>
> If the user asked to install this Skill, run `npx skilld install pymodel/react-frontend-skills/nuqs`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/nuqs`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/pymodel/react-frontend-skills/nuqs) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/nuqs`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/nuqs --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/nuqs --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# 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 | `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`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/parser-use-typed-parsers.md) - Use typed parsers for non-string values
- [`parser-with-default`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/parser-with-default.md) - Use withDefault for non-nullable state
- [`parser-enum-validation`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/parser-enum-validation.md) - Use enum parsers for constrained values
- [`parser-array-format`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/parser-array-format.md) - Choose correct array parser format
- [`parser-json-validation`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/parser-json-validation.md) - Validate JSON parser input
- [`parser-date-format`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/parser-date-format.md) - Select appropriate date parser
- [`parser-index-offset`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/parser-index-offset.md) - Use parseAsIndex for 1-based URL display
- [`parser-hex-colors`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/parser-hex-colors.md) - Use parseAsHex for color values

### 2. Adapter & Setup (CRITICAL)

- [`setup-nuqs-adapter`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/setup-nuqs-adapter.md) - Wrap app with NuqsAdapter
- [`setup-use-client`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/setup-use-client.md) - Add 'use client' directive for hooks
- [`setup-import-server`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/setup-import-server.md) - Import server utilities from nuqs/server
- [`setup-nextjs-version`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/setup-nextjs-version.md) - Ensure compatible Next.js version
- [`setup-shared-parsers`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/setup-shared-parsers.md) - Define shared parsers in dedicated file

### 3. State Management (HIGH)

- [`state-use-query-states`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/state-use-query-states.md) - Use useQueryStates for related parameters
- [`state-functional-updates`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/state-functional-updates.md) - Use functional updates for derived state
- [`state-clear-with-null`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/state-clear-with-null.md) - Clear URL parameters with null
- [`state-controlled-inputs`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/state-controlled-inputs.md) - Handle controlled input value properly
- [`state-avoid-derived`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/state-avoid-derived.md) - Avoid derived state from URL parameters
- [`state-options-inheritance`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/state-options-inheritance.md) - Use withOptions for parser-level configuration
- [`state-setter-return`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/state-setter-return.md) - Use setter return value for URL access

### 4. Server Integration (HIGH)

- [`server-search-params-cache`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/server-search-params-cache.md) - Use createSearchParamsCache for Server Components
- [`server-shallow-false`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/server-shallow-false.md) - Use shallow:false to trigger server re-renders
- [`server-use-transition`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/server-use-transition.md) - Integrate useTransition for loading states
- [`server-parse-before-get`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/server-parse-before-get.md) - Call parse() before get() in Server Components
- [`server-share-parsers`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/server-share-parsers.md) - Share parsers between client and server
- [`server-next15-async`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/server-next15-async.md) - Await async searchParams in App Router pages

### 5. Performance Optimization (MEDIUM)

- [`perf-throttle-updates`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/perf-throttle-updates.md) - Throttle URL updates with limitUrlUpdates
- [`perf-clear-on-default`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/perf-clear-on-default.md) - Use clearOnDefault for clean URLs
- [`perf-avoid-rerender`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/perf-avoid-rerender.md) - Memoize components using URL state
- [`perf-serialize-utility`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/perf-serialize-utility.md) - Use createSerializer for link URLs
- [`perf-debounce-search`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/perf-debounce-search.md) - Debounce server-bound search updates

### 6. History & Navigation (MEDIUM)

- [`history-push-navigation`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/history-push-navigation.md) - Use history:push for navigation-like state
- [`history-replace-ephemeral`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/history-replace-ephemeral.md) - Use history:replace for ephemeral state
- [`history-scroll-behavior`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/history-scroll-behavior.md) - Control scroll behavior on URL changes
- [`history-back-sync`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/history-back-sync.md) - Handle browser back/forward navigation

### 7. Debugging & Testing (LOW-MEDIUM)

- [`debug-enable-logging`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/debug-enable-logging.md) - Enable debug logging for troubleshooting
- [`debug-common-errors`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/debug-common-errors.md) - Diagnose common nuqs errors
- [`debug-testing`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/debug-testing.md) - Test components with URL state

### 8. Advanced Patterns (LOW)

- [`advanced-custom-parsers`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/advanced-custom-parsers.md) - Create custom parsers for complex types
- [`advanced-url-keys`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/advanced-url-keys.md) - Use urlKeys for shorter URLs
- [`advanced-eq-function`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/advanced-eq-function.md) - Implement eq function for object parsers
- [`advanced-framework-adapters`](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/nuqs/references/advanced-framework-adapters.md) - Use framework-specific adapters

## How to Use

Run in the project root first:

```bash
npx -y @pymodel/react-frontend-skills detect             # installed vs. targeted versions
```

Read `references/<rule-id>.md` for each rule above that matches the task: why it matters, then incorrect vs. correct code.
