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.
.cursor/rules/typescript-nextjs-cursorrules-prompt-file.mdcWhat 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 clientanduseEffect - build responsive UI with Daisy UI and Tailwind
Example prompts for the agent
- Follow
typescript-nextjs-cursorrules-prompt-filewhile 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
nuqsto 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.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.claude/rules/typescript-nextjs-cursorrules-prompt-file.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-nextjs-cursorrules-prompt-file.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-nextjs-cursorrules-prompt-file.mdManually: put the files in place
.clinerules/typescript-nextjs-cursorrules-prompt-file.mdStep 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