70 lines
2.0 KiB
Cheetah
70 lines
2.0 KiB
Cheetah
# Scaffold Feature — {{PROJECT_NAME}}
|
|
|
|
Scaffolds a complete new feature module following **{{ARCHITECTURE}}** architecture with **{{STATE_MANAGEMENT}}** state management.
|
|
|
|
## Usage
|
|
```
|
|
Create a feature called [feature_name] with [description]
|
|
```
|
|
|
|
## What gets generated
|
|
|
|
### For {{ARCHITECTURE}} architecture:
|
|
The AI will create all necessary files for the `[feature_name]` feature following {{ARCHITECTURE}} patterns.
|
|
|
|
### File structure to create:
|
|
|
|
**Clean Architecture:**
|
|
```
|
|
lib/features/[feature_name]/
|
|
domain/
|
|
entities/[feature_name].dart
|
|
repositories/[feature_name]_repository.dart
|
|
usecases/
|
|
get_[feature_name]_usecase.dart
|
|
create_[feature_name]_usecase.dart
|
|
data/
|
|
models/[feature_name]_dto.dart
|
|
datasources/[feature_name]_remote_datasource.dart
|
|
repositories/[feature_name]_repository_impl.dart
|
|
presentation/
|
|
[state_files]/ ← based on {{STATE_MANAGEMENT}}
|
|
pages/[feature_name]_page.dart
|
|
widgets/
|
|
```
|
|
|
|
**Feature-First:**
|
|
```
|
|
lib/features/[feature_name]/
|
|
[feature_name]_screen.dart
|
|
[feature_name]_provider.dart ← or [feature_name]_bloc.dart
|
|
[feature_name]_repository.dart
|
|
[feature_name]_model.dart
|
|
widgets/
|
|
```
|
|
|
|
## State management boilerplate
|
|
|
|
### For {{STATE_MANAGEMENT}}:
|
|
Generate the appropriate state management files with:
|
|
- Initial/loading/success/error states
|
|
- All necessary events (for BLoC)
|
|
- Repository connection
|
|
- Dependency injection registration
|
|
|
|
## Steps the AI takes
|
|
1. Ask: "What is the feature name and brief description?"
|
|
2. Ask: "What data does this feature manage? (e.g., list of products, single user profile)"
|
|
3. Generate all files with correct imports and patterns
|
|
4. Add the feature to the DI container
|
|
5. Add the route to {{ROUTING}} router
|
|
6. Create a placeholder test file
|
|
|
|
## Code generation
|
|
{{#if codegen_freezed}}
|
|
- Generate Freezed model: run `dart run build_runner build` after scaffolding
|
|
{{/if}}
|
|
{{#if codegen_injectable}}
|
|
- Register in injectable: add `@lazySingleton` to repository
|
|
{{/if}}
|