Skip to main content
rule CX Codex

next.js-react-typescript-cursor-rules — Claude Code rule

next.js-react-typescript-cursor-rules — a Claude Code rule for consistent Next.js, React, and TypeScript work. It covers App Router structure, UI conventions, and server-first rendering choices.

MIT ★ 571 updated 2026-07-03

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/rules/Next.js-React-TypeScript-Cursor-Rules.md
Open on GitHub

What next.js-react-typescript-cursor-rules does

This rule guides Claude Code when it writes TypeScript for Node.js, Next.js App Router, and React. It favors functional code over classes, named component exports, clear variable names, and a predictable file layout: the exported component, subcomponents, helpers, static content, then types.

It also sets conventions for dashed directory names, interfaces instead of type aliases, maps instead of enums, and declarative JSX. UI work follows Shadcn UI, Radix UI, and Tailwind with a mobile-first layout. The rule asks the agent to keep use client, useEffect, and setState limited, prefer React Server Components, use Suspense fallbacks, and load non-critical components dynamically. URL search state is expected to use nuqs, so projects using another approach should account for that constraint.

What it helps with

  • standardize TypeScript code across a Next.js project
  • organize component files into a repeatable layout
  • reduce unnecessary client-side React code
  • build responsive interfaces with Tailwind
  • manage URL search state with nuqs

Example prompts for the agent

  • Review this Next.js component and align it with the project rule.
  • Create a React page in TypeScript with Tailwind and Shadcn UI, using use client only where required.
  • Refactor this component file into exports, subcomponents, helpers, static content, and types.

How to install next.js-react-typescript-cursor-rules

Manually: put the files in place

.claude/rules/Next.js-React-TypeScript-Cursor-Rules.md

The paths frontmatter field limits the files

Step by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use

Questions about next.js-react-typescript-cursor-rules

How do I install next.js-react-typescript-cursor-rules in Claude Code?

Place the rule file at .claude/rules/Next.js-React-TypeScript-Cursor-Rules.md.

What does next.js-react-typescript-cursor-rules do?

It gives Claude Code conventions for TypeScript, Next.js App Router, and React, covering file structure, naming, interfaces, JSX, and UI libraries. It also steers rendering toward server components and selective client code.

Which tools and libraries does the rule cover?

The rule targets Next.js App Router, React, TypeScript, Shadcn UI, Radix UI, and Tailwind. It also calls for nuqs for URL search parameters and image handling with WebP, size data, and lazy loading.

Source text

Next.js-React-TypeScript-Cursor-Rules.md · MIT
# Next.js React TypeScript Cursor Rules

```js
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.
```

© qdleader · MIT · qdleader/Awesome-AI-Pedia

Similar IDE rules

All IDE rules for Frontend and UI →

From the same set5

Project sponsors

Companies that keep this analytics open