-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.cursorrules
193 lines (193 loc) · 7.75 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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
{
"name": "Temperature Procedure Controller",
"description": "A temperature procedure controller application with React/TypeScript frontend and Python FastAPI backend",
"domainKnowledge": {
"temperatureControl": {
"concepts": [
"PID control for temperature regulation",
"Temperature setpoints and ramp rates",
"Temperature overshoot and undershoot handling",
"Thermal inertia and system response time",
"Temperature sensor calibration and accuracy"
],
"procedures": [
"Temperature ramping with controlled rates",
"Temperature hold/soak periods",
"Multi-step temperature profiles",
"Emergency cooling procedures",
"Temperature limit safety controls"
],
"measurements": {
"unit": "Celsius",
"precision": "0.1 degree resolution",
"sampleRate": "Typical sampling every 100ms"
},
"safety": [
"Over-temperature protection",
"Rate-of-change limits",
"Sensor failure detection",
"Emergency shutdown procedures",
"Temperature limit alarms"
]
}
},
"rules": {
"architecture": {
"frontend": {
"pattern": "TypeScript/React with Redux for state management",
"apiCalls": {
"rules": [
"Use axios instead of fetch for all API calls",
"Manage all API calls through Redux using createAsyncThunk",
"Keep API call logic in Redux slices",
"Components should only dispatch actions and read state",
"Use typed response data for better type safety",
"Handle API errors in Redux reducers"
]
}
},
"backend": "Clean Architecture with Domain-Driven Design",
"layers": {
"domain": {
"description": "Core business logic and domain models",
"components": [
"Domain entities (Temperature, Procedure, Device)",
"Value objects (SetPoint, Measurement, Range)",
"Domain events",
"Repository interfaces",
"Domain services"
]
},
"application": {
"description": "Application use cases and orchestration",
"components": [
"Use cases/Application services",
"DTOs",
"Input/Output ports",
"Event handlers"
]
},
"infrastructure": {
"description": "External concerns and implementations",
"components": [
"Repository implementations",
"Serial port adapters",
"WebSocket handlers",
"External service adapters"
]
},
"presentation": {
"description": "API endpoints and controllers",
"components": [
"FastAPI routes",
"Request/Response models",
"API documentation"
]
}
}
},
"communication": "WebSocket and REST APIs",
"hardware": "Serial port communication handled by backend"
},
"codeStyle": {
"frontend": [
"Use functional components with hooks",
"Use TypeScript with strict type checking",
"Follow Redux Toolkit patterns",
"Use PascalCase for component files",
"Prefix interfaces with 'I'",
"Use CSS modules for styling",
"Keep components focused and modular",
"Maximum line length of 80 characters",
"Use 2 spaces for indentation",
"Use single quotes for strings",
"Use trailing commas in multiline statements",
"Break imports into multiple lines when they exceed line length",
"Sort imports: React, external libraries, internal modules",
"Use ESLint and Prettier for code formatting",
"Use yarn as package manager",
"Keep yarn.lock in version control",
"Use yarn commands instead of npm (e.g., yarn add instead of npm install)",
"Specify exact yarn version in packageManager field"
],
"backend": [
"Follow PEP 8 style guidelines",
"Use type hints",
"Follow PEP 585 for type annotations (use built-in collection types like list[str] instead of List[str])",
"Requires Python 3.9+ for built-in collection type annotations",
"Use async/await for async operations",
"Keep functions under 50 lines",
"Use dependency injection",
"Follow SOLID principles",
"Use rich domain models",
"Implement bounded contexts",
"Use value objects for immutable concepts",
"Keep domain logic pure and isolated",
"Use repository pattern for data access",
"Implement aggregate roots for consistency",
"Do not include docstrings in generated code"
]
},
"projectStructure": {
"directories": {
"frontend": "/frontend",
"backend": {
"root": "/backend",
"domain": "/backend/domain",
"application": "/backend/application",
"infrastructure": "/backend/infrastructure",
"presentation": "/backend/presentation",
"tests": "/backend/tests"
},
"components": "/frontend/src/components",
"reduxStore": "/frontend/src/store/slices"
},
"packageManager": {
"tool": "yarn",
"commands": {
"install": "yarn install",
"add": "yarn add",
"remove": "yarn remove",
"addDev": "yarn add -D",
"run": "yarn",
"format": "yarn format",
"lint": "yarn lint",
"lintFix": "yarn lint:fix"
}
}
},
"testing": [
"Write unit tests for critical functionality",
"Test Redux reducers and actions",
"Test API endpoints",
"Mock serial port communications",
"Write domain model unit tests",
"Test use cases in isolation",
"Use in-memory repositories for testing",
"Test domain invariants and business rules"
],
"errorHandling": [
"Use React error boundaries",
"Implement serial port error handling",
"Log errors on both frontend and backend",
"Provide user-friendly error messages",
"Use domain exceptions for business rule violations",
"Implement proper error translation between layers"
],
"performance": [
"Optimize Redux selectors",
"Minimize re-renders",
"Efficient WebSocket handling",
"Proper serial port connection cleanup",
"Use appropriate aggregate boundaries",
"Implement caching where necessary"
],
"security": [
"Validate all user inputs",
"Handle serial port operations safely",
"Sanitize data",
"Manage serial port permissions",
"Validate domain invariants",
"Implement proper access control"
]
}