Skip to content

Commit aeac972

Browse files
authored
Cursorrules For flutter with riverpod (#38)
* added-flutter-riverpod-cursorrules * fix typo
1 parent dbd7a7c commit aeac972

File tree

1 file changed

+264
-0
lines changed

1 file changed

+264
-0
lines changed
Lines changed: 264 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,264 @@
1+
# AI Assistant Technical Instructions
2+
3+
You are an AI assistant with advanced problem-solving capabilities. Please follow these instructions to execute tasks efficiently and accurately.
4+
5+
First, confirm the instructions received from the user:
6+
<instructions>
7+
{{instructions}}
8+
</instructions>
9+
10+
Please proceed with the following process based on these instructions:
11+
12+
---
13+
14+
## 1. Instruction Analysis and Planning
15+
<Task Analysis>
16+
- Summarize the main tasks concisely
17+
- Review the specified tech stack and consider implementation methods within those constraints
18+
**Note: Do not change versions listed in the tech stack without approval**
19+
- Identify key requirements and constraints
20+
- List potential challenges
21+
- Enumerate specific steps for task execution in detail
22+
- Determine the optimal execution order for these steps
23+
24+
### Preventing Duplicate Implementation
25+
Before implementation, verify:
26+
- Existence of similar functionality
27+
- Functions or components with identical or similar names
28+
- Duplicate API endpoints
29+
- Identification of processes that can be shared
30+
31+
Take sufficient time for this section as it guides the entire subsequent process. Conduct thorough and comprehensive analysis.
32+
</Task Analysis>
33+
34+
---
35+
36+
## 2. Task Execution
37+
- Execute identified steps one by one
38+
- Report progress concisely after completing each step
39+
- Pay attention to the following during implementation:
40+
- Adherence to proper directory structure
41+
- Consistency in naming conventions
42+
- Appropriate placement of shared processes
43+
44+
---
45+
46+
## 3. Quality Control and Problem Resolution
47+
- Quickly verify the execution results of each task
48+
- If errors or inconsistencies occur, address them through the following process:
49+
a. Problem isolation and cause identification (log analysis, debug information verification)
50+
b. Creation and implementation of countermeasures
51+
c. Post-fix operation verification
52+
d. Debug log confirmation and analysis
53+
54+
- Record verification results in the following format:
55+
a. Verification items and expected results
56+
b. Actual results and discrepancies
57+
c. Required countermeasures (if applicable)
58+
59+
---
60+
61+
## 4. Final Confirmation
62+
- Evaluate the entire deliverable once all tasks are completed
63+
- Verify consistency with original instructions and make adjustments as needed
64+
- Perform final confirmation that there are no duplicates in implemented functions
65+
66+
---
67+
68+
## 5. Results Report
69+
Please report final results in the following format:
70+
markdown
71+
# Execution Results Report
72+
73+
## Overview
74+
[Brief description of overall summary]
75+
76+
## Execution Steps
77+
1. [Step 1 description and results]
78+
2. [Step 2 description and results]
79+
...
80+
81+
## Final Deliverables
82+
[Details of deliverables, links if applicable]
83+
84+
## Issue Resolution (if applicable)
85+
- Problems encountered and responses
86+
- Future considerations
87+
88+
## Notes & Improvement Suggestions
89+
- [List any observations or suggestions for improvement]
90+
91+
92+
---
93+
94+
## Important Notes
95+
96+
- Always confirm any unclear points before beginning work
97+
- Report and obtain approval for any important decisions as they arise
98+
- Report unexpected problems immediately and propose solutions
99+
- **Do not make changes that are not explicitly instructed.** If changes seem necessary, first report them as proposals and implement only after approval
100+
- **UI/UX design changes (layout, colors, fonts, spacing, etc.) are prohibited** unless approved after presenting justification
101+
- **Do not arbitrarily change versions listed in the tech stack** (APIs, frameworks, libraries, etc.). If changes are necessary, clearly explain the reason and wait for approval before making any changes
102+
103+
---
104+
105+
# Tech Stack
106+
107+
## Core Technologies
108+
- **AI Model: GPT-4**
109+
110+
## Frontend
111+
- Flutter: ^3.22.0
112+
113+
### State Management
114+
- Riverpod: ^2.6.1
115+
116+
## BaaS
117+
- Firebase
118+
---
119+
120+
121+
---
122+
123+
## Project Structure
124+
125+
Please implement following this directory structure:
126+
127+
lib/features/products/
128+
β”œβ”€β”€ data/
129+
β”‚ β”œβ”€β”€ models/
130+
β”‚ β”‚ β”œβ”€β”€ product_dto.dart
131+
β”‚ β”‚ └── product_category_dto.dart
132+
β”‚ └── product_repository.dart
133+
β”œβ”€β”€ presentation/
134+
β”‚ β”œβ”€β”€ screens/
135+
β”‚ β”‚ β”œβ”€β”€ product_list_screen.dart
136+
β”‚ β”‚ └── product_details_screen.dart
137+
β”‚ β”œβ”€β”€ controllers/
138+
β”‚ β”‚ └── product_list_controller.dart
139+
β”‚ β”œβ”€β”€ widgets/
140+
β”‚ └── product_card.dart
141+
β”œβ”€β”€ domain/
142+
β”‚ β”œβ”€β”€ models/
143+
β”‚ β”‚ β”œβ”€β”€ product.dart
144+
β”‚ β”‚ └── product_category.dart
145+
β”‚ └── get_products_use_case.dart
146+
└── shared/
147+
└── models/
148+
└── address.dart
149+
150+
151+
## Placement Rules
152+
### Flutter Project Structure Placement Rules
153+
154+
This document outlines the placement rules for files and folders within the recommended Flutter project structure, focusing on scalability, maintainability, and adherence to Clean Architecture principles.
155+
156+
#### Top-Level Structure
157+
158+
lib/
159+
β”œβ”€β”€ features/
160+
β”œβ”€β”€ models/
161+
β”œβ”€β”€ providers/
162+
β”œβ”€β”€ routes/
163+
β”œβ”€β”€ core/
164+
β”œβ”€β”€ app.dart
165+
└── main.dart
166+
167+
168+
* **lib/**: Contains all Dart code.
169+
* **features/**: Feature-specific code.
170+
* **models/**: Global models (use sparingly).
171+
* **providers/**: Global providers (minimize use).
172+
* **routes/**: App navigation.
173+
* **core/**: Core app logic (networking, errors, DI).
174+
* **app.dart**: Root widget.
175+
* **main.dart**: Entry point.
176+
177+
#### features/ Structure
178+
lib/features/
179+
└── <feature_name>/
180+
β”œβ”€β”€ data/
181+
β”‚ β”œβ”€β”€ models/
182+
β”‚ └── <feature_name>_repository.dart
183+
β”œβ”€β”€ presentation/
184+
β”‚ β”œβ”€β”€ screens/
185+
β”‚ β”œβ”€β”€ controllers/
186+
β”‚ β”œβ”€β”€ widgets/
187+
β”œβ”€β”€ domain/
188+
β”‚ β”œβ”€β”€ models/
189+
β”‚ └── <feature_name>.dart
190+
β”œβ”€β”€ use_cases/
191+
└── shared/
192+
└── models/
193+
194+
* **<feature_name>/**: A feature (e.g., authentication, products).
195+
* **data/**: Data access.
196+
* **models/**: Data Transfer Objects (DTOs).
197+
* **<feature_name>_repository.dart**: Data access logic.
198+
* **presentation/**: UI.
199+
* **screens/**: UI screens (<feature_name>_<screen_name>_screen.dart).
200+
* **controllers/**: State management (<feature_name>_controller.dart).
201+
* **widgets/**: Feature-specific widgets (<widget_name>.dart).
202+
* **domain/**: Business logic.
203+
* **models/**: Domain models.
204+
* **<feature_name>.dart**: Main entity.
205+
* **use_cases/**: User interactions (<use_case_name>.dart).
206+
* **shared/models/**: Models shared between *related* features.
207+
208+
#### shared/ (Top-Level) Structure
209+
210+
lib/shared/
211+
β”œβ”€β”€ providers/
212+
β”œβ”€β”€ widgets/
213+
β”œβ”€β”€ models/
214+
└── services/
215+
216+
* **providers/**: Providers shared across *unrelated* features.
217+
* **widgets/**: Widgets shared across *unrelated* features.
218+
* **models/**: Models shared across *unrelated* features (use cautiously).
219+
* **services/**: Utility classes.
220+
221+
#### models/ (Top-Level) Structure
222+
223+
lib/models/
224+
└── <model_name>.dart
225+
226+
* Global models (use sparingly).
227+
228+
#### providers/ (Top-Level) Structure
229+
230+
lib/providers/
231+
└── <provider_name>.dart
232+
233+
* Global providers (minimize use).
234+
235+
#### core/ Structure
236+
237+
lib/core/
238+
β”œβ”€β”€ network/
239+
β”‚ └── api_client.dart
240+
β”œβ”€β”€ errors/
241+
β”‚ └── exceptions.dart
242+
└── di/
243+
└── injection.dart
244+
245+
* **network/**: Networking code.
246+
* **errors/**: Error handling.
247+
* **di/**: Dependency injection.
248+
249+
## Naming Conventions
250+
251+
* **Files:** snake_case (e.g., product_list_screen.dart).
252+
* **Classes:** PascalCase (e.g., ProductListScreen).
253+
* **Variables/Functions:** camelCase (e.g., productList).
254+
255+
## Key Principles
256+
257+
* **Feature Isolation:** Self-contained feature code.
258+
* **Separation of Concerns:** Separate data, logic, and UI.
259+
* **Single Responsibility:** One purpose per class/file.
260+
* **DRY:** Avoid code duplication.
261+
* **Prefer Feature-Specific:** Prioritize feature-level placement.
262+
263+
264+
Please adhere to the above content when executing tasks.

0 commit comments

Comments
Β (0)