mirror of
https://github.com/sanjeed5/awesome-cursor-rules-mdc.git
synced 2026-11-30 23:04:59 +08:00
add .mdc file
This commit is contained in:
+22
@@ -0,0 +1,22 @@
|
||||
---
|
||||
description: Rules for naming components and structuring directories within the src/components folder, including conventions for lowercase names with dashes.
|
||||
globs: src/components/**/*
|
||||
---
|
||||
- All components should go in src/components and be named like new-component.tsx
|
||||
- Use lowercase with dashes for directories (e.g., components/auth-wizard).
|
||||
- Favor named exports for components.
|
||||
- Within the /src/components folder, consider organizing components by type or feature:
|
||||
- By Type: Group components like forms, buttons, layout elements, etc.
|
||||
- By Feature: For larger applications, group components related to specific features or domains.
|
||||
For example:
|
||||
/src/components
|
||||
├── /ui
|
||||
│ ├── /Button
|
||||
│ ├── /Modal
|
||||
│ └── /Card
|
||||
├── /forms
|
||||
│ ├── /TextField
|
||||
│ └── /Select
|
||||
└── /layout
|
||||
├── /Navbar
|
||||
└── /Footer
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
---
|
||||
description: General rules for TypeScript, Node.js, and Next.js projects, covering code style, naming conventions, and TypeScript usage.
|
||||
globs: **/*.{ts,tsx,js,jsx}
|
||||
---
|
||||
- You are an expert in TypeScript, Node.js, Next.js App Router, React, Shadcn UI, and Tailwind and Framer Motion.
|
||||
- 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).
|
||||
- Use TypeScript for all code; prefer interfaces over types.
|
||||
- Avoid enums; use maps instead.
|
||||
- Use functional components with TypeScript interfaces.
|
||||
- Use the "function" keyword for pure functions.
|
||||
- Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.
|
||||
- Use declarative JSX.
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
---
|
||||
description: Rules for adhering to Next.js conventions, including data fetching, rendering, routing, and using 'nuqs' for URL search parameter state management.
|
||||
globs: src/**/*
|
||||
---
|
||||
- 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.
|
||||
- Place both the /app and /components folders under a /src directory.
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
---
|
||||
description: Rules for performance optimization in Next.js applications, including minimizing client-side logic, using Suspense, and optimizing images.
|
||||
globs: **/*.{ts,tsx,js,jsx}
|
||||
---
|
||||
- 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.
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
---
|
||||
description: Rule to use placekitten.com for placeholder images in seed data.
|
||||
globs: **/seed.ts
|
||||
---
|
||||
- While creating placeholder images as a part of your seed data, use https://placekitten.com/
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
---
|
||||
description: Rules for determining if a component should be private or shared, and where to place them based on their use-case.
|
||||
globs: src/**/*
|
||||
---
|
||||
- Private Components: For components used only within specific pages, you can create a _components folder within the relevant /app subdirectory.
|
||||
- Shared Components: The /src/components folder should contain reusable components used across multiple pages or features.
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
---
|
||||
description: Rules for UI development and styling using Shadcn UI and Tailwind CSS, emphasizing responsive design and a mobile-first approach.
|
||||
globs: **/*.{ts,tsx,js,jsx}
|
||||
---
|
||||
- Use Shadcn UI, and Tailwind for components and styling.
|
||||
- Implement responsive design with Tailwind CSS; use a mobile-first approach.
|
||||
Reference in New Issue
Block a user