跳到正文
Skillpedia
网站与界面(前端)12k · #11522

nuqs

它能做什么

它指导 AI 在 React 和 Next.js 中使用带类型的解析器读取和写入网址查询值。适用于希望页面状态可以分享、可以收藏的开发者。

适用场景

  • ✓当你希望把筛选条件、搜索文字或标签页保存在网址中时。
  • ✓当你在 React 或 Next.js 项目中使用 useQueryState 或 useQueryStates 时。
  • ✓当你希望限制或隔离网址更新,以获得更好的性能时。

技能链接

https://github.com/trycompai/crm/blob/release/.agents/skills/nuqs/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/trycompai/crm/blob/release/.agents/skills/nuqs/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“你能把搜索和日期筛选条件保存在网址中,让页面刷新后仍保留它们吗?”

每周 5 个新技能,1 分钟读完。

工作原理

AI 会为每个值选择带类型的解析器,为框架设置适配器,并接入状态钩子,使网址和屏幕保持同步。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

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

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)

2. Adapter & Setup (CRITICAL)

3. State Management (HIGH)

4. Server Integration (HIGH)

5. Performance Optimization (MEDIUM)

常见问题

它只适用于 Next.js 吗?

不是。该指南还涵盖 React Router、TanStack Router、Remix 和原生 React。

什么是解析器?

它把网址中的值(例如文字或数字)转换为代码可以使用的带类型的值,也能反过来转换。

它涵盖服务器组件吗?

涵盖。它涵盖在 Next.js 中把网址状态与服务器组件集成的方法。

详情

作者的原始描述

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.

repo: trycompai/crm

热度

GitHub 星标
12k
排名
#11522
许可证
MIT
更新时间
2026/11/1

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能