skills/flutter-scaffold/SKILL.md
Scaffold Flutter features with screaming + clean architecture: domain-driven directories, layered separation, and project conventions. Trigger: When creating a new feature/domain, adding layers to an existing feature, or reviewing mobile app structure.
npx skillsauth add 333-333-333/agents flutter-scaffoldInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
auth, booking, pet)| Principle | Rule |
|-----------|------|
| Screaming Architecture | Directory names = business domains, NOT technical concerns |
| Clean Architecture | Dependencies point INWARD: infrastructure → application → domain |
| Ports & Adapters | Domain defines interfaces, infrastructure implements them |
| Feature-first | Each feature is self-contained with all 4 layers |
| Shared is shared | Only truly cross-feature code goes in shared/ |
Presentation → can import → Application, Domain
Application → can import → Domain ONLY
Domain → imports NOTHING (pure Dart)
Infrastructure → implements → Domain interfaces
Domain layer has ZERO dependencies on Flutter, Firebase, or any external package. Pure Dart only.
Every feature follows this exact structure:
features/{feature}/
domain/
entities/ # Business objects
{entity}.dart
repositories/ # Abstract interfaces (ports)
{feature}_repository.dart
value_objects/ # Immutable typed values
{value_object}.dart
application/
use_cases/ # One class per use case
{verb}_{noun}_use_case.dart
presentation/
providers/ # Riverpod providers
{feature}_providers.dart
pages/ # Full-screen widgets (Atomic: pages level)
{feature}_{action}_page.dart
widgets/ # Feature-specific widgets
{descriptive_name}.dart
infrastructure/
datasources/ # External data access
{source}_{feature}_datasource.dart
repositories/ # Concrete implementations (adapters)
{feature}_repository_impl.dart
models/ # DTOs / API response models
{entity}_model.dart
| Element | Pattern | Example |
|---------|---------|---------|
| Feature dir | singular noun | features/booking/ |
| Entity | singular PascalCase | Booking, Pet, User |
| Repository interface | {Feature}Repository | AuthRepository |
| Repository impl | {Feature}RepositoryImpl | AuthRepositoryImpl |
| Use case | {Verb}{Noun}UseCase | LoginUseCase, CreateBookingUseCase |
| Page | {Feature}{Action}Page | LoginPage, BookingDetailPage |
| Provider | {feature}{Purpose}Provider | authStateProvider, bookingListProvider |
| Datasource | {Source}{Feature}Datasource | FirebaseAuthDatasource |
| Model (DTO) | {Entity}Model | UserModel, BookingModel |
lib/features/{feature}/domain/, application/, presentation/, infrastructure/domain/entities/domain/repositories/application/use_cases/presentation/providers/presentation/pages/ and presentation/widgets/infrastructure/repositories/app/di/providers.dart if global# Create a new feature scaffold
mkdir -p lib/features/{feature}/{domain/{entities,repositories,value_objects},application/use_cases,presentation/{providers,pages,widgets},infrastructure/{datasources,repositories,models}}
# Verify structure
find lib/features/{feature} -type d | sort
| ❌ Don't | ✅ Do |
|----------|-------|
| lib/screens/login_screen.dart | lib/features/auth/presentation/pages/login_page.dart |
| lib/models/user.dart (global) | lib/features/auth/domain/entities/user.dart |
| Import Firebase in domain | Define interface in domain, implement in infrastructure |
| lib/utils/ grab bag | Put in the feature or shared/ where it belongs |
| Business logic in widgets | Widgets call providers, providers call use cases |
| One massive providers.dart | One provider file per feature, global DI in app/di/ |
| Domain entities with toJson | DTOs in infrastructure/models handle serialization |
testing
Review Flutter components and screens for UX/UI compliance. Trigger: When user invokes /ux-review command or requests UX audit.
development
TypeScript strict patterns and best practices. Trigger: When implementing or refactoring TypeScript in .ts/.tsx (types, interfaces, generics, const maps, type guards, removing any, tightening unknown).
testing
Testing philosophy and strategy for every feature: test pyramid, mandatory levels per change type, completion checklist, and skill delegation. Trigger: When planning tests for a feature, reviewing test coverage, defining acceptance criteria, or asking what tests a change needs.
development
Terraform security practices: sensitive variables, secret management, state protection, .gitignore patterns, and CI/CD credential handling. Trigger: When handling secrets in Terraform, configuring state backends, reviewing .gitignore for Terraform, or setting up CI/CD pipelines for infrastructure.