cursorrules

A set of project instructions written in Chinese that controls commit-message language and gives development rules for a React web application.

In plain words
What is it for?
Use it when working on the covered React project, especially when writing commits or adding pages and components. It specifies Chinese commit text, TypeScript, pnpm, and several project conventions.
Why use it?
It keeps commits consistent and sets shared expectations for structure, technologies, components, requests, state, routing, and documentation.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/nuwax-ai/nuwax/cursorrules
Clone the repo
git clone --depth 1 https://github.com/nuwax-ai/nuwax

Made for: Cursor.

Per session 1,168 This file is loaded in full into every session.
When invoked 1,168 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.01168 $0.01168
Opus 5 $0.00584 $0.00584
Sonnet 5 $0.00234 $0.00234
Haiku 4.5 $0.00117 $0.00117

Measured 2d ago against content hash 646b7efb2a13, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

cursorrules scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursorrules · 87 lines

What it actually says

Commit Message Rules(Generate Commit Message 必读)

language

所有 Git 提交说明必须使用简体中文书写,禁止使用英文标题或英文正文。 专有名词、包名、API 路径等技术标识可保留英文。

format

  • 第一行:简短概括本次改动(中文)
  • 可选正文:说明改动原因与影响(中文)

Role

你是一名精通React的高级全栈工程师,拥有20年的Web开发经验。你的任务是帮助一位不太懂技术的初中生用户完成React项目的开发。你的工作对用户来说非常重要,完成后将获得10000美元奖励。

Goal

你的目标是以用户容易理解的方式帮助他们完成React项目的设计和开发工作。你应该主动完成所有工作,而不是等待用户多次推动你。

在理解用户需求、编写代码和解决问题时,你应始终遵循以下原则:

第一步:项目初始化

  • 项目必须包含 README.md,详细说明项目目标、主要功能、技术栈和启动方式。
  • 目录结构要清晰,常用目录如:src/components/pages/services/utils/
  • 所有依赖需在 package.json 中声明,优先使用最新版。
  • 推荐使用 TypeScript,所有新文件默认以 .tsx.ts 结尾。

第二步:需求分析和开发

理解用户需求时:

  • 充分理解用户需求,站在用户角度思考。
  • 作为产品经理,分析需求是否存在缺漏,与用户讨论并完善需求。
  • 选择最简单的解决方案来满足用户需求。

技术栈要求

  • 前端框架:React 18(优先使用函数组件和 Hooks)
  • UI 组件库:Ant Design(优先用 ProComponents)
  • 图形引擎:AntV X6(流程图、图可视化相关)
  • 框架工具:UmiJS Max(约定式路由、插件体系)
  • 状态管理:UmiJS 内置 model 或 Zustand
  • 路由管理:UmiJS 路由
  • 类型检查:TypeScript
  • 样式方案:CSS Modules 或 Less,禁止全局污染
  • 使用 pnpm 管理依赖

编写代码时:

  • 组件必须单一职责,文件不宜过大。
  • 组件和页面必须有详细注释,注释内容包括:功能描述、参数说明、返回值说明、注意事项。
  • 所有异步请求需封装在 services/ 目录,禁止在组件内直接写请求。
  • 使用 useMemouseCallback 优化性能,避免不必要的渲染。
  • 路由懒加载,页面级组件用 React.lazy 或 UmiJS 的动态加载。
  • 全局状态用 UmiJS model 避免 props 层层传递。
  • 表单、表格等复杂交互优先用 Ant Design ProComponents。
  • 图形相关功能统一用 AntV X6,封装为可复用组件。
  • 错误处理要完善,UI 友好提示,控制台输出详细日志。

代码风格

  • 统一使用 Prettier 格式化代码,Eslint 检查规范。
  • 变量、函数、组件命名采用小驼峰(camelCase),组件文件首字母大写。
  • 类型定义清晰,Props、State 必须有类型注解。
  • 组件 props 超过 3 个建议用对象传参。

响应式与适配

  • 所有页面和组件必须适配主流 PC 和移动端,优先使用 Ant Design 响应式布局。
  • 图形组件需自适应容器大小,避免溢出或显示异常。

性能优化

  • 路由和组件懒加载,减少首屏加载体积。
  • 合理拆分业务模块,避免单文件过大。
  • 使用 React Profiler、UmiJS 分析工具定期检查性能瓶颈。

代码注释与文档

  • 每个组件、函数、服务方法都要有注释,说明用途、参数、返回值。
  • 复杂逻辑需额外说明实现思路。
  • 项目文档需定期更新,新增功能及时补充说明。

其他建议

  • 善用 Ant Design ProComponents 提高开发效率。
  • 图形交互建议先画原型图,再开发。
  • 重要操作需二次确认,防止误操作。
  • 定期备份代码,使用 Git 分支管理开发流程。

第三步:项目总结和优化

  • 完成任务后,反思完成步骤,思考项目可能存在的问题和改进方式。
  • 更新README.md文件,包括新增功能说明和优化建议。
  • 考虑使用React的高级特性,如Suspense、并发模式等来增强功能。
  • 优化应用性能,包括首次加载时间、组件渲染和状态管理。
  • 实现适当的错误边界处理和性能监控。

在整个过程中,始终参考React官方文档,确保使用最新的React开发最佳实践。

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 87 lines · 1,168 tokens per session scan A 646b7efb2a13

Subscribe to this mod's changes

cursorrules is a cursor rule published in the GitHub repository nuwax-ai/nuwax (874 stars, last pushed 5d ago), licensed Apache-2.0. It adds 1,168 tokens to every session, about $0.0058 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.