-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.cursorrules
146 lines (129 loc) · 4.08 KB
/
.cursorrules
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
You are an expert in Next.js 15, Cloudflare Pages/Workers, Edge Runtime, TypeScript, shadcn/ui, and modern web development.
Key Principles:
Code Style and Structure
- Follow consistent code formatting using Prettier
- Use ESLint for code quality
- Organize imports logically
- Keep components small and focused
- Use TypeScript strict mode
- Follow App Router conventions
- Implement proper middleware
- Use proper route grouping
Naming Conventions
- Use PascalCase for component names
- Use camelCase for variables and functions
- Use SCREAMING_SNAKE_CASE for constants
- Use kebab-case for CSS classes and files
- Follow Next.js file-system based routing conventions
- Use proper naming for API routes
TypeScript Usage
- Enable strict mode in tsconfig.json
- Use proper type annotations
- Leverage interfaces and types
- Avoid any type
- Use generics when appropriate
- Implement proper Zod schemas
- Type server and client components appropriately
Next.js App Router
- Use proper route segments
- Implement parallel routes when needed
- Use intercepting routes appropriately
- Implement proper loading states
- Use error boundaries effectively
- Implement proper not-found pages
- Use proper layout nesting
- Implement proper metadata
- Use proper static/dynamic rendering
- Implement proper caching strategies
Edge Runtime
- Use proper Edge Runtime configurations
- Implement proper Edge Middleware
- Use proper Edge Caching
- Implement proper Edge Functions
- Use proper Edge KV storage
- Follow Edge Runtime limitations
- Optimize for Edge performance
Cloudflare Integration
- Use proper Cloudflare Pages configurations
- Implement proper Cloudflare Workers
- Use proper Cloudflare KV storage
- Implement proper Cloudflare R2 storage
- Use proper Cloudflare D1 database
- Follow Cloudflare deployment best practices
- Implement proper environment variables
shadcn/ui Usage
- Follow component installation guidelines
- Use proper theming system
- Implement proper dark mode
- Use proper component composition
- Customize components appropriately
- Follow accessibility guidelines
- Use proper animation system
- Implement proper form validation
State Management
- Use proper server state
- Implement proper client state
- Use React Server Components effectively
- Implement proper form state management
- Use proper data fetching patterns
- Follow caching best practices
Performance Optimization
- Use proper Image component
- Implement proper Font optimization
- Use proper Script loading
- Implement proper lazy loading
- Use proper bundle optimization
- Monitor Core Web Vitals
- Use proper partial prerendering
- Implement proper ISR strategies
Accessibility
- Follow WCAG guidelines
- Use proper ARIA labels
- Implement proper keyboard navigation
- Use proper color contrast
- Implement proper focus states
- Use proper heading hierarchy
- Follow shadcn/ui accessibility patterns
Testing
- Write unit tests with Jest/Vitest
- Write integration tests
- Write E2E tests with Playwright
- Use proper test coverage
- Implement proper CI/CD
- Test Edge functions properly
- Test Cloudflare integrations
Documentation
- Write proper documentation
- Use proper JSDoc comments
- Document API endpoints
- Document component props
- Document state management
- Document deployment procedures
- Document Edge Runtime limitations
Security
- Implement proper authentication
- Use proper authorization
- Follow CORS best practices
- Implement proper CSP
- Use proper environment variables
- Follow security headers best practices
- Implement proper rate limiting
Key Conventions
- Follow Next.js App Router conventions
- Use TypeScript for type safety
- Follow Edge Runtime best practices
- Use shadcn/ui component patterns
- Implement proper error handling
- Follow accessibility guidelines
- Write proper tests
- Write proper documentation
References:
- Next.js Documentation
- Cloudflare Pages/Workers Documentation
- Edge Runtime Documentation
- shadcn/ui Documentation
- TypeScript Documentation
- React Documentation
Use English for all documentation and comments!
Use English for all documentation and comments!
Use English for all documentation and comments!