nuqs Agent Rules

Type-safe URL query state for React applications.

Overview

nuqs states a few URL-state rules, then points each task to a detailed contributor guide. It also names the task-runner entry points, shows how to enable browser and server debug logs, and defines when a change is done.

Documents

├── 
├── .agents
│   └── docs
│       ├── 
│       ├── 
│       ├── 
│       ├── 
│       ├── 
│       └── 
├── packages
│   └── docs
│       └── 
├── 
└── 

Techniques in this file

01 / Router files

Route common tasks to the relevant guide

A table maps bugs, parsers, adapters, performance, documentation, and pull requests to focused documents. It gives an entry path into the material without loading every guide for every change.

Source excerpt starting at line 62.
| Task                    | Guide                                                                             || ----------------------- | --------------------------------------------------------------------------------- || Fix a bug               | See [Testing Patterns](.agents/docs/testing.md) → Regression                      || Add a new parser        | See [Parser Implementation](.agents/docs/parser-implementation.md)                || Add a framework adapter | See [Adapter Development](.agents/docs/adapter-development.md)                    || Improve performance     | See [API Design](.agents/docs/api-design.md) → Performance & Reliability          || Update documentation    | See [Release & Git Workflow](.agents/docs/git-workflow.md) → Documentation        || Prepare a pull request  | See [Release & Git Workflow](.agents/docs/git-workflow.md) → PR Quality Checklist |

02

Preserve the task graph when filtering tests

Focused tests must use root Turbo commands instead of invoking package scripts directly. The file also documents the full suite’s duration and included build, unit, typing, and end-to-end stages.

Source excerpt starting at line 41.
- **Test suite:** `pnpm test` (5-10 minutes; includes build + unit + typing + e2e)- **Focused tests:** Use the root Turbo command, for example `pnpm run test --filter nuqs` or `pnpm run test --filter e2e-next`. Do not invoke package test scripts directly.

03

Record URL-state invariants together

The core concepts define lossless pure serialization, internal defaults, and null on invalid parsing. These rules establish observable behavior for parser and state changes.

Source excerpt starting at line 30.
- **Key Principles:**  1. URL = single source of truth  2. Serialization must be lossless & pure  3. Defaults are internal (not written to URL)  4. Invalid parse → return `null`

04

Make debug collection part of reproduction

The guide gives browser and server activation steps for the opt-in debug bundle. It then asks for debug logs in issue reports and reproduction scripts.

Source excerpt starting at line 75.
Import the opt-in debug bundle once in each runtime where logs are needed: ```tsimport 'nuqs/debug'``` Then enable debug logs in the browser console and reload the page: ```jslocalStorage.setItem('debug', 'nuqs')``` In server or Node environments (e.g. when using `nuqs/server`), set the `DEBUG` environment variable so it contains `nuqs`: ```bashDEBUG=nuqs pnpm dev``` Hook-level logs are prefixed with `[nuq+ …]`; internal subsystems use `[nuqs <subsystem>]` (see `packages/nuqs/src/lib/debug-messages.ts` for the catalog). Encourage debug logs in issue reports and include them in reproduction scripts.

Ideas for your repo

  1. Map frequent tasks directly to their deeper guides.
  2. Document the task-runner entry point required for focused tests.
  3. Write state and serialization invariants as observable behavior.
  4. Include opt-in diagnostics in reproduction instructions.
Sponsored byModem

Give your agents the whole story.

These instructions explain how to work in nuqs. Modem shows your agents what customers said, who is affected, and what changed.

See how Modem works