flutter-layer-based-clean-architecture
Enforce inward dependency flow, pure domain layers, and DTO-to-entity mapping in Flutter DDD architecture. Use when structuring lib/domain/, lib/infrastructure/, lib/application/, or lib/presentation/ layers, defining repository interfaces, or wiring BLoCs with get_it. (triggers: lib/domain/**, lib/infrastructure/**, lib/application/**, dto, mapper, Either, Failure)
Best use case
flutter-layer-based-clean-architecture is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Enforce inward dependency flow, pure domain layers, and DTO-to-entity mapping in Flutter DDD architecture. Use when structuring lib/domain/, lib/infrastructure/, lib/application/, or lib/presentation/ layers, defining repository interfaces, or wiring BLoCs with get_it. (triggers: lib/domain/**, lib/infrastructure/**, lib/application/**, dto, mapper, Either, Failure)
Teams using flutter-layer-based-clean-architecture should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/flutter-layer-based-clean-architecture/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How flutter-layer-based-clean-architecture Compares
| Feature / Agent | flutter-layer-based-clean-architecture | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Enforce inward dependency flow, pure domain layers, and DTO-to-entity mapping in Flutter DDD architecture. Use when structuring lib/domain/, lib/infrastructure/, lib/application/, or lib/presentation/ layers, defining repository interfaces, or wiring BLoCs with get_it. (triggers: lib/domain/**, lib/infrastructure/**, lib/application/**, dto, mapper, Either, Failure)
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Layer-Based Clean Architecture ## **Priority: P0 (CRITICAL)** Standardized separation of concerns and dependency flow using DDD principles. ## Workflow: Add a New Feature Across Layers 1. Define the domain entity with `@freezed` in `lib/domain/entities/` 2. Define the repository interface in `lib/domain/repositories/` 3. Create the DTO in `lib/infrastructure/dtos/` with `fromJson`/`toEntity` mapper 4. Implement the repository in `lib/infrastructure/repositories/` 5. Wire the BLoC/Cubit in `lib/application/` consuming the repository interface 6. Register bindings in `get_it` injection container 7. Build the screen in `lib/presentation/` using `BlocBuilder` ## Structure ```text lib/ ├── domain/ # Pure Dart: entities (@freezed), failures, repository interfaces ├── infrastructure/ # Implementation: DTOs, data sources, mappers, repo impls ├── application/ # Orchestration: BLoCs / Cubits └── presentation/ # UI: Screens, reusable components ``` ## Implementation Guidelines - **Dependency Flow**: `Presentation -> Application -> Domain <- Infrastructure`. Dependencies point inward. - **Pure Domain**: No Flutter (Material/Store) or Infrastructure (Dio/Hive) dependencies in `Domain`. - **Functional Error Handling**: Repositories must return `Either<Failure, Success>`. - **Always Map**: Infrastructure must map DTOs to Domain Entities; do not leak DTOs to UI. See [DTO-to-Entity mapping example](references/REFERENCE.md). - **Immutability**: Use `@freezed` for all entities and failures. - **Logic Placement**: No business logic in UI; widgets only display state and emit events. - **Inversion of Control**: Use `get_it` to inject repository implementations into BLoCs. ## Anti-Patterns - **No DTOs in UI**: Never import a `.g.dart` or Data class directly in a Widget. - **No Material in Domain**: Do not import `package:flutter/material.dart` in the `domain` layer. - **No Shared Prefs in Repo**: Do not use `shared_preferences` directly in a Repository; use a Data Source. ## Reference & Examples For full implementation templates and DTO-to-Domain mapping examples: See [references/REFERENCE.md](references/REFERENCE.md). ## Related Topics feature-based-clean-architecture | bloc-state-management | dependency-injection | error-handling
Related Skills
spring-boot-architecture
Structure Spring Boot 3+ projects with feature packaging and clean layering. Use when structuring Spring Boot 3 projects, defining layers, or applying architecture patterns. (triggers: pom.xml, build.gradle, structure, layering, dto, controller, @RestController, @Service, @Repository, @Entity, @Bean, @Configuration)
react-native-architecture
Structure React Native projects with feature-first organization and separation of concerns. Use when structuring a React Native project or applying clean architecture patterns. (triggers: src/**/*.tsx, src/**/*.ts, app.json, feature, module, directory structure, separation of concerns, Expo, React Navigation, StyleSheet.create, react-native, mobile architecture)
nextjs-data-access-layer
Build secure, reusable data access patterns with DTOs, taint checks, and colocated authorization in Next.js. Use when centralizing database queries, transforming raw data to DTOs, adding server-only guards, or preventing sensitive data from reaching Client Components. (triggers: **/lib/data.ts, **/services/*.ts, **/dal/**, DAL, Data Access Layer, server-only, DTO)
nextjs-architecture
Structure Next.js projects with Feature-Sliced Design layers, domain-grouped slices, and strict import hierarchy. Use when organizing features into FSD layers, enforcing slice boundaries, or keeping page.tsx thin. (triggers: src/features/**, src/entities/**, src/widgets/**, FSD, Feature Sliced Design, slices, segments)
nestjs-architecture
Design decoupled, testable NestJS module boundaries with feature, core, and shared modules. Use when structuring module imports, creating feature modules, or enforcing separation of concerns in NestJS. (triggers: **/*.module.ts, main.ts, NestFactory, Module, Controller, Injectable)
laravel-clean-architecture
Implement Domain-Driven Design with typed DTOs, repository interfaces, and single-responsibility Action classes in Laravel. Use when creating domain folders, binding repository contracts in providers, or passing DTOs between layers. (triggers: app/Domains/**/*.php, app/Providers/*.php, domain, dto, repository, contract, adapter)
laravel-architecture
Enforce core architectural standards for scalable Laravel applications. Use when structuring controllers, service layers, action classes, Form Requests, or Service Container bindings in Laravel projects. (triggers: app/Http/Controllers/**/*.php, routes/*.php, controller, service, action, request, container)
ios-architecture
Apply MVVM, Coordinators, and Clean Architecture (VIP/VIPER) in iOS apps. Use when applying MVVM, Coordinators, or VIP/VIPER architecture in iOS apps. (triggers: **/*ViewModel.swift, **/*Coordinator.swift, **/*ViewController.swift, MVVM, Coordinator, ViewState, Output, Input)
golang-architecture
Structure Go projects with Clean Architecture and standard layout conventions. Use when structuring Go projects or applying Clean Architecture in Go. (triggers: go.mod, internal/**, architecture, structure, folder layout, clean arch, dependency injection)
flutter-widgets
Build maintainable Flutter UI components with composition and theming. Use when building, refactoring, or reviewing Flutter widget implementations for maintainability. (triggers: **_page.dart, **_screen.dart, **/widgets/**, StatelessWidget, const, Theme, ListView)
flutter-testing
Write unit, widget, and integration tests with robots, widget keys, and Patrol in Flutter. Use when writing Flutter unit tests, widget tests, or integration tests with Patrol. (triggers: **/test/**.dart, **/integration_test/**.dart, **/robots/**.dart, lib/core/keys/**.dart, test, patrol, robot, WidgetKeys, patrolTest, blocTest, mocktail)
flutter-security
Enforce OWASP Mobile security standards for Flutter apps. Use when storing data, making network calls, handling tokens/PII, or preparing a release build. (triggers: lib/infrastructure/**, pubspec.yaml, secure_storage, obfuscate, jailbreak, pinning, PII, OWASP)