feat: add best practices documentation as cursor project rules
This commit is contained in:
parent
5dc5c09306
commit
c49410f040
9
.cursor/rules/ai-sdk-best-practices.mdc
Normal file
9
.cursor/rules/ai-sdk-best-practices.mdc
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
description: Best practices for using Vercel AI SDK
|
||||
globs: **/*.{ts,tsx}
|
||||
---
|
||||
|
||||
- Use the AI SDK to simplify OpenAI API integration
|
||||
- Implement proper error handling and rate limiting for API calls
|
||||
- Utilize streaming responses for improved user experience in chat applications
|
||||
- Follow OpenAI's guidelines for responsible AI usage and data privacy
|
9
.cursor/rules/drizzle-orm-best-practices.mdc
Normal file
9
.cursor/rules/drizzle-orm-best-practices.mdc
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
description: Best practices for using Drizzle ORM with database
|
||||
globs: **/*.{ts}
|
||||
---
|
||||
|
||||
- Use Drizzle's type-safe query builder for better code completion and safety.
|
||||
- Implement migrations using Drizzle Kit for database schema management.
|
||||
- Utilize Drizzle's relation system to define and query relationships.
|
||||
- Use Drizzle's transaction API for complex, atomic operations.
|
9
.cursor/rules/nextjs-best-practices.mdc
Normal file
9
.cursor/rules/nextjs-best-practices.mdc
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
description: Best practices for Next.js applications and routing
|
||||
globs: **/*.{ts,tsx}
|
||||
---
|
||||
|
||||
- Utilize Next.js 15's new features like Server Actions for improved performance and security
|
||||
- Implement proper error handling with `error.tsx` and `not-found.tsx` for better user experience
|
||||
- Use `next-safe-action` for secure form submissions and API calls
|
||||
- Leverage `next-themes` for easy theme management and dark mode support
|
9
.cursor/rules/radix-ui-best-practices.mdc
Normal file
9
.cursor/rules/radix-ui-best-practices.mdc
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
description: Best practices for using Radix UI components
|
||||
globs: **/*.{ts,tsx}
|
||||
---
|
||||
|
||||
- Use Radix UI primitives for building custom, accessible components
|
||||
- Follow Radix UI's composition patterns for consistent component structure
|
||||
- Implement proper ARIA attributes and keyboard navigation for accessibility
|
||||
- Utilize Radix UI's built-in state management for complex components
|
9
.cursor/rules/react-best-practices.mdc
Normal file
9
.cursor/rules/react-best-practices.mdc
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
description: Best practices for React component development
|
||||
globs: **/*.{ts,tsx,js,jsx}
|
||||
---
|
||||
|
||||
- Use functional components with hooks instead of class components
|
||||
- Implement proper state management using `useState` and `useReducer`
|
||||
- Utilize `useCallback` and `useMemo` for performance optimization
|
||||
- Leverage `react-hook-form` for efficient form handling and validation
|
9
.cursor/rules/react-hook-form-best-practices.mdc
Normal file
9
.cursor/rules/react-hook-form-best-practices.mdc
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
description: Best practices for form handling with React Hook Form
|
||||
globs: **/*.{ts,tsx}
|
||||
---
|
||||
|
||||
- Use the `useForm` hook with TypeScript for better type safety.
|
||||
- Implement validation using Zod or Yup for complex form schemas.
|
||||
- Utilize the `Controller` component for controlled inputs.
|
||||
- Use `formState` to handle form state changes efficiently.
|
9
.cursor/rules/stripe-best-practices.mdc
Normal file
9
.cursor/rules/stripe-best-practices.mdc
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
description: Best practices for integrating Stripe payments
|
||||
globs: **/*.{ts,tsx}
|
||||
---
|
||||
|
||||
- Use `@stripe/stripe-js` for client-side Stripe integration
|
||||
- Implement proper error handling and user feedback for payment flows
|
||||
- Utilize Stripe's Elements for secure and customizable payment forms
|
||||
- Follow Stripe's best practices for PCI compliance and security
|
9
.cursor/rules/tailwindcss-best-practices.mdc
Normal file
9
.cursor/rules/tailwindcss-best-practices.mdc
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
description: Best practices for styling with Tailwind CSS
|
||||
globs: **/*.{ts,tsx,css}
|
||||
---
|
||||
|
||||
- Use utility-first approach for rapid development and maintainability
|
||||
- Implement responsive design using Tailwind's responsive modifiers
|
||||
- Utilize `tailwind-merge` for efficient class merging and overriding
|
||||
- Leverage `tailwindcss-animate` for easy animation implementation
|
9
.cursor/rules/typescript-best-practices.mdc
Normal file
9
.cursor/rules/typescript-best-practices.mdc
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
description: TypeScript coding standards and type safety guidelines
|
||||
globs: **/*.{ts,tsx}
|
||||
---
|
||||
|
||||
- Enable strict mode in your `tsconfig.json` for better type checking.
|
||||
- Use interfaces for object shapes and types for unions or intersections.
|
||||
- Leverage type inference where possible to reduce type annotations.
|
||||
- Use generics for reusable components and functions.
|
9
.cursor/rules/zod-best-practices.mdc
Normal file
9
.cursor/rules/zod-best-practices.mdc
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
description: Best practices for schema validation with Zod
|
||||
globs: **/*.{ts,tsx}
|
||||
---
|
||||
|
||||
- Define clear and reusable schemas for data validation
|
||||
- Use Zod's type inference for TypeScript integration and type safety
|
||||
- Implement custom validation rules using Zod's `refine` method
|
||||
- Utilize Zod with `react-hook-form` for seamless form validation
|
Loading…
Reference in New Issue
Block a user