PluginBench
Rule

typescript shadcn ui nextjs cursorrules prompt fil

via PatrickJS/awesome-cursorrules

TypeScript + shadcn/ui + Next.js coding standards with RSC-first, functional patterns, and Tailwind styling.

What is typescript shadcn ui nextjs cursorrules prompt fil?

Establishes conventions for building Next.js applications with TypeScript, shadcn/ui components, and Tailwind CSS. Emphasizes React Server Components, functional programming, early error handling, and performance optimization. Use this rule to maintain consistent code style and architectural patterns across a full-stack Next.js project.

  • Enforce TypeScript interfaces, functional components, and descriptive naming (isLoading, hasError patterns)
  • Minimize client-side code: favor React Server Components and limit 'use client' directives to small, Web API-dependent components
  • Implement error handling with early returns, guard clauses, Zod validation, and error boundaries for resilience
  • Structure files with exported components, subcomponents, helpers, static content, and types in a consistent order
  • Optimize performance: lazy-load non-critical components, wrap client components in Suspense, use WebP images with size data
  • Apply shadcn/ui, Radix, and Tailwind Aria for accessible, responsive UI with mobile-first Tailwind CSS design

Applies to

File patterns this rule matches.

**/*
Rule definition (reference)

Source of truth, from the repository.

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

Error Handling and Validation:

  • Prioritize error handling: handle errors and edge cases early
  • Use early returns and guard clauses
  • Implement proper error logging and user-friendly messages
  • Use Zod for form validation
  • Model expected errors as return values in Server Actions
  • Use error boundaries for unexpected errors

UI and Styling:

  • Use Shadcn UI, Radix, and Tailwind Aria 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

Related rules

Senior full-stack TypeScript, React, Node.js guidance with clean architecture, testing, and WHY-oriented reasoning.

**/*
41k
via PatrickJS/awesome-cursorrules

Quantitative factor research skills for designing, evaluating, and mining alpha factors in equities markets.

**/*
41k
via PatrickJS/awesome-cursorrules

Android development with Jetpack Compose, clean architecture, and Material Design 3.

**/*
41k
via PatrickJS/awesome-cursorrules

Angular development with Novo Elements UI library using standalone components.

**/*
41k
via PatrickJS/awesome-cursorrules

Expert Angular 18 + TypeScript development with Jest, emphasizing clean code and performance.

**/*
41k
via PatrickJS/awesome-cursorrules

Manage Kubernetes clusters, add-ons, stacks, and credentials via the Ankra CLI platform.

**/*.sh +5
41k
via PatrickJS/awesome-cursorrules
typescript shadcn ui nextjs cursorrules prompt fil Rule | PluginBench