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.
.cursor/rules/typescript-react-nextjs-cloudflare-cursorrules-pro.mdcWhat 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.tomledits - keep Tailwind styling mobile-first
Example prompts for the agent
- Write the order list component following our project rules
- Suggest a
wrangler.tomlchange 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.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.claude/rules/typescript-react-nextjs-cloudflare-cursorrules-pro.mdThe paths frontmatter field limits the files: move globs from the source into paths
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.github/instructions/typescript-react-nextjs-cloudflare-cursorrules-pro.instructions.mdThe applyTo field sets which files it applies to: move globs from the source into applyTo
Manually: put the files in place
.devin/rules/typescript-react-nextjs-cloudflare-cursorrules-pro.mdManually: put the files in place
.clinerules/typescript-react-nextjs-cloudflare-cursorrules-pro.mdStep 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