Skip to main content
rule

typescript-react-nextjs-cloudflare-cursorrules-pro — Cursor rule

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.

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

What typescript-react-nextjs-cloudflare-cursorrules-pro does

The file spells out how the agent should write code in your repo. It sets conventions: functional and declarative patterns instead of classes, interfaces over types, maps instead of enums, named exports, lowercase dashed directory names. File layout is fixed too — exported component, subcomponents, helpers, static content, types.

A second block covers UI and performance. Expect fewer suggestions of use client, useEffect and setState, and more React Server Components, client components wrapped in Suspense with a fallback, and dynamic loading for non-critical parts. Components and styling come from Shadcn UI, Radix and Tailwind, with a mobile-first layout. For state kept in URL search params the rule points to nuqs.

On the Cloudflare side the rule knows D1 and KV, and it can propose edits to wrangler.toml to wire up other primitives: R2 for file storage, KV for key-value, AI for multimodal inference. In the terminal it suggests wrangler commands. The rule lives at .cursor/rules/typescript-react-nextjs-cloudflare-cursorrules-pro.mdc, and its header carries alwaysApply: false — you turn it on yourself rather than getting it applied everywhere.

What it helps with

  • keep one TypeScript style across a Next.js codebase
  • move code away from classes and enums toward functions and maps
  • cut down on client components in favour of RSC
  • add R2, KV or AI bindings through wrangler.toml edits
  • keep Tailwind styling mobile-first

Example prompts for the agent

  • Write the order list component following our project rules
  • Suggest a wrangler.toml change to add an R2 binding
  • Convert this component to a React Server Component

How to install typescript-react-nextjs-cloudflare-cursorrules-pro

Manually: put the files in place

.cursor/rules/typescript-react-nextjs-cloudflare-cursorrules-pro.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-react-nextjs-cloudflare-cursorrules-pro

How do I install typescript-react-nextjs-cloudflare-cursorrules-pro in Cursor?

Create the file .cursor/rules/typescript-react-nextjs-cloudflare-cursorrules-pro.mdc and paste the rule contents into it.

What does typescript-react-nextjs-cloudflare-cursorrules-pro do?

It lays out coding conventions for TypeScript, Next.js App Router, React, Shadcn UI, Radix, Tailwind and DrizzleORM, and guides work with Cloudflare D1, KV and wrangler.

Does the rule apply to every file on its own?

No. Its header sets alwaysApply: false, so you attach it manually.

Source text

typescript-react-nextjs-cloudflare-cursorrules-pro.mdc · CC0-1.0
---
description: "Cursor rules for TypeScript development with React, Next.js, and Cloudflare integration."
globs: **/*
alwaysApply: false
---
You are an expert in TypeScript, Node.js, Next.js App Router, React, Shadcn UI, Radix UI, Tailwind CSS and DrizzleORM.
You are also excellent at Cloudflare developer tools like D1 serverless database and KV. You can suggest usage of new tools (changes in wrangler.toml file) to add more primitives like:

R2: File storage
KV: Key-value storage
AI: AI multimodal inference
others primitives in wrangler.toml

In the terminal, you are also an expert at suggesting wrangler commands.

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': 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 A Cursor rule that pins down how the agent writes TypeScript: types, naming, error handling. Useful when several people touch the same codebase. ★ 41,024repo stars typescript-vuejs-cursorrules-prompt-file A Cursor rule that tells the agent how to write TypeScript inside Vue.js projects. Useful when you want edits across components to follow the same conventions. ★ 41,024repo stars typescript-vite-tailwind-cursorrules-prompt-file A Cursor rule that pins down TypeScript code style for Vue projects built with Vite and styled with Tailwind. Useful when you want the agent's output to stay predictable. ★ 41,024repo stars typescript-react-nextui-supabase-cursorrules-promp This rule gives an agent context for a TypeScript app built with React, NextUI, and Supabase. Use it when working on the UI, user dashboard, or authentication flows. ★ 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-nextjs-cursorrules-prompt-file 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. ★ 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