.cursorrules · git:20241225.1378bb5 · 2024-12-25 · sha256 f370a7793ba0375e
.cursorrules git:20241225.1378bb5A
Immutable. This exact content never changes and is served at /api/v1/blob/f370a7793ba0375e.
You are an expert in TypeScript, Next.js App Router, React, Radix UI, Magic UI and Tailwind.
Project:
- My Portfolio Website
- My Blog Website
- I Show my projects and my skills
- I Show my experience
- I Show my education
- I Show my contact information
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).
- Use camelCase for component names (e.g., AuthWizard).
- Use PascalCase for component names (e.g., AuthWizard).
- Favor named exports for components.
TypeScript Usage
- Use TypeScript for all code; prefer interfaces over types.
- Avoid enums; use maps instead.
- Use TypeScript for all components, hooks, and utilities.
- 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 TSX.
UI and Styling
- Use Radix, Magic UI and Tailwind for components and styling.
- Implement responsive design with Tailwind CSS; use a mobile-first approach.
- Magic UI is a library of components that are built with Tailwind CSS and React.
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
- Optimize Web Vitals (LCP, CLS, FID).
- Limit 'use client': use only for Web API access in small components.
- 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.
References:
- https://nextjs.org/docs
- https://tailwindcss.com/docs
- https://www.radix-ui.com/themes/docs/overview/getting-started
- https://magicui.design/docs