Operational instructions for autonomous coding / AI agents contributing to the nuqs repository.
nuqs is a library for type-safe URL query string ↔ React state synchronization with minimal bundle size and zero dependencies.
Refer to: README.md & CONTRIBUTING.md for authoritative detail.
- Library source:
packages/nuqs - Documentation app (Next.js + Fumadocs):
packages/docs- MDX content:
packages/docs/content
- MDX content:
- End-to-end test benches:
packages/e2e- Framework targets: Next.js app/pages, React SPA, Remix, TanStack Router, React Router v6/v7
- Examples:
packages/examples/*
- Goal: Type-safe URL query string ↔ React state sync.
- Main Hooks:
useQueryState(key, parserOrConfig)useQueryStates(configObject, options)
- Parsers: Provide
parse&serialize; enhanced with.withDefault()&.withOptions() - Batching & Throttling: Multiple state updates in one tick are merged; URL updates throttled (≥50ms)
- Key Principles:
- URL = single source of truth
- Serialization must be lossless & pure
- Defaults are internal (not written to URL)
- Invalid parse → return
null
- Package manager:
pnpm - Build:
pnpm build - Test suite:
pnpm test(5-10 minutes; includes build + unit + typing + e2e) - Development:
pnpm dev --filter <package-name>...(triple dots start dependencies' dev script too)
For detailed development guidelines organized by task, see:
- Adapter Development — Adding framework adapters
- Parser Implementation — Creating custom parsers
- API Design & Architecture — Design principles, extensibility, type safety
- Testing Patterns — Unit, type-level, and e2e testing strategies
- Release & Git Workflow — Conventional commits, semantic versioning, PR standards
- Quality Standards — Checklists, performance, security, anti-patterns
| Task | Guide |
|---|---|
| Fix a bug | See Testing Patterns → Regression |
| Add a new parser | See Parser Implementation |
| Add a framework adapter | See Adapter Development |
| Improve performance | See API Design → Performance & Reliability |
| Update documentation | See Release & Git Workflow → Documentation |
| Prepare a pull request | See Release & Git Workflow → PR Quality Checklist |
Enable debug logs in the browser console:
localStorage.setItem('debug', 'nuqs')In server or Node environments (e.g. when using nuqs/server), set the DEBUG environment variable so it contains nuqs:
DEBUG=nuqs pnpm devLog lines are prefixed with [nuq+]
Encourage debug logs in issue reports and include them in reproduction scripts.
A task is DONE when:
- All checklist items satisfied
- Tests pass locally (
pnpm test) - Docs consistent with behavior
- No unresolved TODOs introduced
- No stray console logs (except controlled debug support)