| trigger |
|---|
always_on |
These rules define how API integration should be generated, structured, and maintained across the project.
The agent must always follow these standards when creating API-related files or methods.
rules:
- "Use Retrofit for all API integrations."
- "Use JsonSerializable for request and response models."
- "Follow the multi-repository pattern, where each feature module has its own repository."
- "Add all standard API endpoints to api_service.dart, unless a special case requires its own custom Retrofit service."
- "All API responses must use APIResponse<T> and convert to ApiResult<T> through the custom MyCallAdapter."
- "Model only the 'data' portion of the API response, not the entire wrapper structure."
- "Use snake_case for all file and folder names."
- "Request models must use @JsonSerializable(includeIfNull: false, createFactory: false)."
- "Response models must use @JsonSerializable(), include fromJson() and toJson(), and be immutable."
- "Each feature module must include its own repository that extends the base Repository class."
- "Repository methods must directly call the corresponding apiService method and return ApiResult<T>."
- "Generated code must remain consistent with existing project architecture and naming conventions."agent_behavior:
- "Automatically determine the correct HTTP method based on context or payload structure."
- "Generate request and response models only when required."
- "Ensure every generated API method includes proper Retrofit annotations (@GET, @POST, etc.)."
- "Ensure every repository method is clean, minimal, and limited to calling the API service."
- "Do not create business logicβonly integration and structural code."
- "Automatically fix inconsistent naming and follow project conventions."
- "Generate all required imports and ensure paths are accurate."
- "Notify when build_runner generation is needed."
- "Summarize generated files and their locations after completion."When generating API integration, the agent should maintain the following folder pattern:
lib/repositories/
βββ api_repositories/
β βββ api_service.dart
β βββ api_repository.dart
βββ <feature>_repository/
β βββ <feature>_repository.dart
β βββ model/
β βββ <feature>_req_dm.dart
β βββ <feature>_res_dm.dart
quality:
- "Follow Dart formatting and null-safety standards."
- "Ensure all models are immutable and strongly typed."
- "Avoid duplicate code or logic."
- "Keep generated code minimal, clean, and scalable."
- "Maintain consistent naming across services, repositories, and models."