Skip to main content
rule

typescript-nextjs-cursorrules-prompt-file — Cursor rule: what it does

This rule sets coding conventions for TypeScript and Next.js App Router, with guidance for React and Daisy UI with Tailwind. Use it to steer Cursor toward those patterns in a project.

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

What typescript-nextjs-cursorrules-prompt-file does

The rule asks for a detailed pseudocode plan before implementation, followed by confirmation before code is written. It sets conventions for TypeScript and React, including functional components, named exports, interfaces, and modular file structure. It also directs the agent to use bun instead of npm.

For Next.js, it favours Server Components and restrained use of use client; client components should be wrapped in Suspense. UI guidance covers Daisy UI and Tailwind with a mobile-first approach, while nuqs is recommended for URL search state. The rule also calls for attention to Web Vitals and image handling, including WebP and lazy loading. Requiring bun can clash with a project whose workflow depends on npm.

What it helps with

  • set TypeScript and React coding conventions
  • guide work in the Next.js App Router
  • reduce unnecessary use of use client and useEffect
  • build responsive UI with Daisy UI and Tailwind

Example prompts for the agent

  • Follow typescript-nextjs-cursorrules-prompt-file while adding a page to the Next.js App Router.
  • Before writing the component, outline the implementation in pseudocode and wait for my approval.
  • Build a responsive Tailwind interface and use nuqs to manage URL search parameters.

How to install typescript-nextjs-cursorrules-prompt-file

Manually: put the files in place

.cursor/rules/typescript-nextjs-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 typescript-nextjs-cursorrules-prompt-file

How do I install typescript-nextjs-cursorrules-prompt-file in Cursor?

Add the rule file to your project at .cursor/rules/typescript-nextjs-cursorrules-prompt-file.mdc.

What does typescript-nextjs-cursorrules-prompt-file do?

It sets conventions for TypeScript, React, and Next.js App Router, with additional guidance on UI styling and performance.

Which UI tools does the rule recommend?

It specifies Daisy UI and Tailwind CSS for components and styling, and recommends nuqs for URL search state.

Source text

typescript-nextjs-cursorrules-prompt-file.mdc · CC0-1.0
---
description: "Cursor rules for TypeScript development with Next.js integration."
globs: **/*
alwaysApply: false
---
You are an expert in TypeScript, Node.js, Next.js App Router, Drizzle ORM, React, Daisy UI and Tailwind. Always run bun as a package manager (and not npm)

Follow the user's requirements carefully and to the letter.

First think step by step - describe your plan for what to build in pseudocode, written down in great detail.

Confirm, then write code!

Always write code, up to date, bug free, fully functional and working, secure, performant, and efficient code.

Focus on readability over being performant.

Fully implement all requested functionality.

Be sure to reference file names.

Be concise. Minimize any other prose.

If you think there might not be a correct answer, say so. If you do not know the answer, say so instead of guessing.

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 Daisy UI 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

Similar IDE rules

All IDE rules for Frontend and UI →

From the same set210

typescript-react-nextjs-cloudflare-cursorrules-pro A Cursor rule that points the agent at TypeScript, Next.js App Router, React and Cloudflare tooling. Useful when your project already runs on that stack. ★ 41,024repo stars typescript-nodejs-react-vite-cursorrules-prompt-fi This rule sets TypeScript conventions for Node.js, React, and Vite projects, with guidance for TanStack Query, TanStack Router, and Tailwind. Use it to keep agent edits aligned with your codebase’s existing style. ★ 41,024repo stars typescript-nodejs-nextjs-react-ui-css-cursorrules- 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. ★ 41,024repo stars typescript-nextjs-supabase-cursorrules-prompt-file A Cursor rule that keeps TypeScript work on Next.js App Router and Supabase consistent: server components first, Shadcn UI, Tailwind. ★ 41,024repo stars typescript-expo-jest-detox-cursorrules-prompt-file A Cursor rule that points the assistant at TypeScript, React Native, Expo and mobile UI work. Useful when your app runs on Expo and you test it with Jest and Detox. ★ 41,024repo stars typescript-code-convention-cursorrules-prompt-file A Cursor rule that pins down TypeScript code style for Next.js App Router, React, Expo, tRPC and Tailwind projects. Useful when the agent writes code inconsistently. ★ 41,024repo stars toss-style-design-system This Cursor rule guides the agent toward restrained product interfaces with clear hierarchy, grayscale structure, and limited accent color. Use it when editing UI components or styles. ★ 41,024repo stars tokrepo-agent-discovery-cursorrules-prompt-file This Cursor rule makes the agent search TokRepo for existing skills, prompts and MCP configs before writing new ones, and verify every candidate before install. ★ 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