typescript-nodejs-nextjs-react-ui-css-cursorrules- — rule for Cursor
A Cursor rule that pins down how the agent writes TypeScript, Next.js App Router, React and Tailwind code. Useful when generated components drift from your conventions.
.cursor/rules/typescript-nodejs-nextjs-react-ui-css-cursorrules-.mdcWhat typescript-nodejs-nextjs-react-ui-css-cursorrules- does
The file lives at .cursor/rules/typescript-nodejs-nextjs-react-ui-css-cursorrules-.mdc and targets files matching **/*. Inside is a set of conventions: functional and declarative patterns instead of classes, interfaces over types, the function keyword for pure functions, named exports for components. Directories use lowercase with dashes, like components/auth-wizard.
For UI the rule leans on Shadcn UI, Radix UI and Tailwind, with a mobile-first approach to layout. A performance section asks for fewer use client, useEffect and setState calls, React Server Components as the default, client components wrapped in Suspense with a fallback, dynamic loading for non-critical parts, and WebP images with size data and lazy loading. URL search parameter state goes through nuqs.
Auto-apply is off: alwaysApply: false. The rule will not attach itself to your requests, so you have to reference it manually — otherwise the agent never sees it. Worth knowing before you expect the style to change right after dropping the file in.
What it helps with
- set one TypeScript code style for the agent across a project
- steer component generation away from classes toward functional patterns
- cut down on client components in favour of React Server Components
- settle directory naming and component export conventions
- standardise on Tailwind and Shadcn UI for styling
Example prompts for the agent
- Rewrite this component following the project rules: functional style, named export, interface instead of type
- Find where we can drop
use clientand let the server render this - Build the form with Shadcn UI and Tailwind, mobile-first, keep filter state in the URL via
nuqs
How to install typescript-nodejs-nextjs-react-ui-css-cursorrules-
Manually: put the files in place
.cursor/rules/typescript-nodejs-nextjs-react-ui-css-cursorrules-.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.claude/rules/typescript-nodejs-nextjs-react-ui-css-cursorrules-.mdThe paths frontmatter field limits the files: move globs from the source into paths
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.github/instructions/typescript-nodejs-nextjs-react-ui-css-cursorrules-.instructions.mdThe applyTo field sets which files it applies to: move globs from the source into applyTo
Manually: put the files in place
.devin/rules/typescript-nodejs-nextjs-react-ui-css-cursorrules-.mdManually: put the files in place
.clinerules/typescript-nodejs-nextjs-react-ui-css-cursorrules-.mdStep by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules
Questions about typescript-nodejs-nextjs-react-ui-css-cursorrules-
How do I install typescript-nodejs-nextjs-react-ui-css-cursorrules- in Cursor?
Copy the file into your project at .cursor/rules/typescript-nodejs-nextjs-react-ui-css-cursorrules-.mdc. There is no install command — the rule works from that folder.
What does this rule do?
It describes how to write TypeScript, Node.js, Next.js App Router, React, Shadcn UI, Radix UI and Tailwind code: file structure, naming, exports, and how to handle client components and images.
Why doesn't the rule apply on its own?
It sets alwaysApply: false, so Cursor does not pick it up automatically. Attach the file to a request when you want these conventions in play.
Source text
typescript-nodejs-nextjs-react-ui-css-cursorrules-.mdc · CC0-1.0
--- description: "Cursor rules for TypeScript development with Node.js, Next.js, React, UI, and CSS integration." globs: **/* alwaysApply: false --- You are an expert in TypeScript, Node.js, Next.js App Router, React, Shadcn UI, Radix UI and Tailwind. Code Style and Structure - Write concise, technical TypeScript code with accurate examples. - Use functional and declarative programming patterns; avoid classes. - Prefer iteration and modularization over code duplication. - Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError). - Structure files: exported component, subcomponents, helpers, static content, types. Naming Conventions - Use lowercase with dashes for directories (e.g., components/auth-wizard). - Favor named exports for components. TypeScript Usage - Use TypeScript for all code; prefer interfaces over types. - Avoid enums; use maps instead. - Use functional components with TypeScript interfaces. Syntax and Formatting - Use the "function" keyword for pure functions. - Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements. - Use declarative JSX. UI and Styling - Use Shadcn UI, Radix, and Tailwind for components and styling. - Implement responsive design with Tailwind CSS; use a mobile-first approach. Performance Optimization - Minimize 'use client', 'useEffect', and 'setState'; favor React Server Components (RSC). - Wrap client components in Suspense with fallback. - Use dynamic loading for non-critical components. - Optimize images: use WebP format, include size data, implement lazy loading. Key Conventions - Use 'nuqs' for URL search parameter state management. - Optimize Web Vitals (LCP, CLS, FID). - Limit 'use client': - Favor server components and Next.js SSR. - Use only for Web API access in small components. - Avoid for data fetching or state management. Follow Next.js docs for Data Fetching, Rendering, and Routing.
© PatrickJS · CC0-1.0 · PatrickJS/awesome-cursorrules