Cursor Rules Generator for Next.js + TypeScript

ide
Cursor
.cursorrules
scaffolding
strict_senior
Remix

Generate a production-ready .cursorrules file optimized for Next.js projects with custom TypeScript configurations.

12/8/2025

Prompt

Generate a .cursorrules file for a Next.js 14 App Router project with the following specifications:

Project Configuration

  • Next.js Version: [14 / 13 / 15]
  • TypeScript Mode: [Strict / Standard]
  • Primary Framework Features: [App Router / Pages Router / Both]
  • Server Components: [Preferred default / Client-first / Mixed]

Styling Approach

  • CSS Framework: [Tailwind CSS / CSS Modules / styled-components / Emotion / Vanilla CSS]
  • UI Component Library: [shadcn/ui / Material-UI / Chakra UI / Radix UI / None]
  • Icon Library: [lucide-react / react-icons / heroicons / None]
  • Design System: [Mobile-first / Desktop-first / Custom breakpoints]

Code Organization Rules

  • Component Structure: [Feature-based / Type-based / Domain-based]
  • Route Organization: [Route groups like (marketing), (app) / Flat structure / Custom]
  • Shared Code Location: [lib/ / utils/ / shared/ / Custom]
  • Component Export Style: [Named exports / Default exports / Mixed based on usage]

Import Organization

Define your preferred import order:

  1. [React/Next imports / Framework imports first]
  2. [Third-party libraries / External packages]
  3. [Local imports / Internal modules]
  4. [Types/Interfaces / Separate or inline]
  5. [Blank line separations: Yes / No]

Component Patterns

  • Component Type: [Functional only / Class allowed / Server Components default]
  • Props Interface Naming: [ComponentNameProps / IComponentProps / Props / Custom]
  • Props Destructuring: [Required / Optional / Never]
  • Client Component Usage: [Minimal (only for interactivity) / Liberal / Specific use cases]

TypeScript Requirements

  • Strict Mode: [Enabled / Disabled]
  • 'any' Type Policy: [Never / Discouraged / Allowed with comment / Permitted]
  • Type Inference: [Maximize / Explicit typing preferred / Mixed]
  • Interface vs Type: [Prefer interface / Prefer type / Either]

Data Fetching Strategy

  • Preferred Method: [Server Components / API Routes / Both / Server Actions]
  • Caching Strategy: [Aggressive / Minimal / Custom per route]
  • Error Handling: [error.tsx boundaries / Try-catch / Both]
  • Loading States: [loading.tsx / Suspense boundaries / Manual]

Error Handling

  • Error Boundaries: [Required for all routes / Top-level only / Optional]
  • API Error Responses: [Structured format / Simple messages / Custom]
  • Client-Side Errors: [Console only / Error tracking service / Custom]

Performance Rules

  • Image Optimization: [Always use next/image / Optional / Custom]
  • Font Loading: [next/font required / Self-hosted / CDN allowed]
  • Bundle Size Monitoring: [Strict / Aware / No limits]

Additional Conventions

[Add any project-specific rules, naming conventions, or architectural patterns]

Generate a complete .cursorrules file with clear, actionable rules based on these specifications. Include sections for core principles, file structure, component patterns, TypeScript usage, styling, data fetching, and error handling.

Tags

cursor
nextjs
typescript
rules

Tested Models

cursor-small
claude-3-5-sonnet

Comments (0)

Sign in to leave a comment

Sign In