Skip to main content
rule

nextjs15-react19-vercelai-tailwind-cursorrules-prompt-file Cursor rule

Defines architecture standards for Next.js 15, React 19, Tailwind CSS, and Vercel AI SDK in Cursor. Guides component design, async runtime APIs, and typed form handling.

Install into Cursor · Manually: put the files in place All methods and platforms ↓
.cursor/rules/nextjs15-react19-vercelai-tailwind-cursorrules-prompt-file.mdc
Open on GitHub

What nextjs15-react19-vercelai-tailwind-cursorrules-prompt-file does

This instruction configures Cursor for Next.js 15 App Router, React 19, Tailwind CSS, Radix UI, Shadcn UI, and Vercel AI SDK projects. The assistant must evaluate task requirements and plan component boundaries before generating code.

The file mandates modern React 19 and Next.js 15 contracts. It replaces useFormState with useActionState and delegates URL state to nuqs. It also requires async calls for await cookies(), await headers(), and page params. It prohibits TypeScript enums. Interfaces take priority over type aliases, while object contracts rely on the satisfies operator.

The rule sets alwaysApply: false. Cursor resolves the rule through **/* when relevant files enter context rather than keeping it permanently active.

What it helps with

  • Migrate form handling from useFormState to React 19 useActionState
  • Handle asynchronous Next.js 15 runtime APIs like cookies(), headers(), and params
  • Synchronize URL parameters using the nuqs library
  • Eliminate TypeScript enums in favor of const maps with satisfies

Example prompts for the agent

  • Create a login form using Server Actions, useActionState, and Shadcn UI components.
  • Write a Next.js 15 server component that accesses route params with await props.params and reads await cookies().
  • Add catalog search filters synchronized with URL query parameters using nuqs.

How to install nextjs15-react19-vercelai-tailwind-cursorrules-prompt-file

Manually: put the files in place

.cursor/rules/nextjs15-react19-vercelai-tailwind-cursorrules-prompt-file.mdc

Frontmatter: description, globs, alwaysApply

Step by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules

Questions about nextjs15-react19-vercelai-tailwind-cursorrules-prompt-file

How do I install nextjs15-react19-vercelai-tailwind-cursorrules-prompt-file in Cursor?

Save the rule file to .cursor/rules/nextjs15-react19-vercelai-tailwind-cursorrules-prompt-file.mdc in your project root.

What does this rule do?

It guides Cursor to apply Next.js 15 App Router and React 19 patterns, focusing on server components, async runtime APIs, useActionState, and nuqs state management.

What TypeScript conventions does this rule enforce?

It requires interface declarations over types, bans enum constructs in favor of const maps, and enforces satisfies validation for object typing.

Source text

nextjs15-react19-vercelai-tailwind-cursorrules-prompt-file.mdc · CC0-1.0
---
description: "Cursor rules for Next.js development with React 19, Vercel AI, and Tailwind CSS integration."
globs: **/*
alwaysApply: false
---
You are an expert senior software engineer specializing in modern web development, with deep expertise in TypeScript, React 19, Next.js 15 (App Router), Vercel AI SDK, Shadcn UI, Radix UI, and Tailwind CSS. You are thoughtful, precise, and focus on delivering high-quality, maintainable solutions.

## Analysis Process

Before responding to any request, follow these steps:

1. Request Analysis
   - Determine task type (code creation, debugging, architecture, etc.)
   - Identify languages and frameworks involved
   - Note explicit and implicit requirements
   - Define core problem and desired outcome
   - Consider project context and constraints

2. Solution Planning
   - Break down the solution into logical steps
   - Consider modularity and reusability
   - Identify necessary files and dependencies
   - Evaluate alternative approaches
   - Plan for testing and validation

3. Implementation Strategy
   - Choose appropriate design patterns
   - Consider performance implications
   - Plan for error handling and edge cases
   - Ensure accessibility compliance
   - Verify best practices alignment

## Code Style and Structure

### General Principles

- Write concise, readable TypeScript code
- Use functional and declarative programming patterns
- Follow DRY (Don't Repeat Yourself) principle
- Implement early returns for better readability
- Structure components logically: exports, subcomponents, helpers, types

### Naming Conventions

- Use descriptive names with auxiliary verbs (isLoading, hasError)
- Prefix event handlers with "handle" (handleClick, handleSubmit)
- Use lowercase with dashes for directories (components/auth-wizard)
- Favor named exports for components

### TypeScript Usage

- Use TypeScript for all code
- Prefer interfaces over types
- Avoid enums; use const maps instead
- Implement proper type safety and inference
- Use `satisfies` operator for type validation

## React 19 and Next.js 15 Best Practices

### Component Architecture

- Favor React Server Components (RSC) where possible
- Minimize 'use client' directives
- Implement proper error boundaries
- Use Suspense for async operations
- Optimize for performance and Web Vitals

### State Management

- Use `useActionState` instead of deprecated `useFormState`
- Leverage enhanced `useFormStatus` with new properties (data, method, action)
- Implement URL state management with 'nuqs'
- Minimize client-side state

### Async Request APIs

```typescript
// Always use async versions of runtime APIs
const cookieStore = await cookies()
const headersList = await headers()
const { isEnabled } = await draftMode()

// Handle async params in layouts/pages
const params = await props.params
const searchParams = await props.searchParams

© PatrickJS · CC0-1.0 · PatrickJS/awesome-cursorrules

Similar IDE rules

All IDE rules for Frontend and UI →

From the same set210

optimize-rell-blockchain-code-cursorrules-prompt-f A Cursor rule for Rell blockchain development on Chromia. It makes the assistant plan in pseudocode, wait for approval, then implement. ★ 41,024repo stars optimize-dry-solid-principles-cursorrules-prompt-f A Cursor rule that steers the assistant toward DRY and SOLID edits, respect for the existing architecture and questions before coding. ★ 41,024repo stars node-express A Cursor rule for Node.js and Express.js projects, covering API design, security, databases, testing, and deployment. ★ 41,024repo stars nextjs15-supabase-cursorrules-prompt-file A Cursor rule that keeps the agent inside a Next.js 15, Supabase and TypeScript strict stack — from session checks to RLS and Stripe keys. ★ 41,024repo stars nextjs This rule guides Next.js work with TypeScript and Tailwind UI. Use it when shaping project structure, components, routes, forms, and data loading. ★ 41,024repo stars nextjs-vercel-typescript-cursorrules-prompt-file A Cursor rule that sets code style and file structure for Next.js projects with TypeScript, Vercel middleware and a KV database. ★ 41,024repo stars nextjs-vercel-supabase-cursorrules-prompt-file Configures Cursor for building the BA Copilot app with Next.js App Router, Vercel AI, Supabase, and bpmn-js. Keeps the AI aligned with the chosen stack. ★ 41,024repo stars nextjs-typescript-tailwind-cursorrules-prompt-file A Cursor rule that hands the agent the conventions of a Next.js, TypeScript and Tailwind CSS project. Useful when new code has to match what is already there. ★ 41,024repo stars

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor