Flutter layer based clean architecture

From HoangNguyen0403/agent-skills-standard · View interactive version

Flutter layer based clean architecture is an AI agent skill from the GitHub repository HoangNguyen0403/agent-skills-standard. Enforce inward dependency flow, pure domain layers, and DTO-to-entity mapping in Flutter DDD architecture. Use when structuring layers or boundaries; defer navigation-only routing and feature implementation such as notifications.

How to use this skill

Skill file

Layer-Based Clean Architecture

**Priority: P0 (CRITICAL)**

Workflow: Add New Feature Across Layers

  1. Define domain entity with @freezed in lib/domain/entities/
  2. Define repository interface in lib/domain/repositories/
  3. Create DTO in lib/infrastructure/dtos/ with fromJson/toEntity mapper
  4. Implement repository in lib/infrastructure/repositories/
  5. Wire BLoC/Cubit in lib/application/ consuming repository interface
  6. Register bindings in get_it injection container
  7. Build screen in lib/presentation/ using BlocBuilder

Structure

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

See DTO-to-Entity mapping example.

Anti-Patterns

Reference & Examples

For full implementation templates and DTO-to-Domain mapping examples:

See references/REFERENCE.md.

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.