flutter-architecture
madteacher/mad-agents-skills
Design, refactor, and review Flutter app architecture with MVVM, layered boundaries, and scalable project structure.
What is flutter-architecture?
An architecture agent for Flutter apps that helps design, refactor, review, and implement scalable code organization. Use it when adding features, auditing dependencies, migrating to feature-first structure, or choosing architecture patterns for Flutter projects.
- Inspect and validate Flutter project structure against MVVM, feature-first, and layer-first patterns
- Design feature boundaries, layer dependencies, and data flow using Repositories, Services, and ViewModels
- Review cross-feature imports, layer violations, and state ownership problems
- Implement architecture migrations, new features, and dependency injection patterns
- Generate or adapt Command, Result, and Repository templates for your project's conventions
- Validate architecture with flutter analyze and focused test suites
How to install flutter-architecture
npx skills add https://github.com/madteacher/mad-agents-skills --skill flutter-architecture- A Flutter or Dart project with pubspec.yaml and lib/ directory
- Existing or planned state-management, routing, and dependency injection setup
- Access to the project repository for inspection and validation
How to use flutter-architecture
- 1.Confirm your Flutter project structure by providing pubspec.yaml, lib/ layout, and current conventions
- 2.Describe the task: adding a feature, reviewing architecture, or migrating structure
- 3.Provide context on team size, app scale, and offline/sync requirements if not obvious from the project
- 4.Review the architecture plan or implementation, checking imports and layer boundaries
- 5.Run flutter analyze and relevant flutter test suites to validate changes
- 6.Iterate on the design or code based on validation results
Use cases
- Add a new feature to an existing Flutter app while maintaining layer boundaries
- Audit a Flutter project for cross-feature imports and dependency violations
- Migrate a small Flutter app from layer-first to feature-first structure
- Choose between MVVM with or without a Domain layer for a new project
- Refactor a ViewModel to move business logic into a Repository or use-case
- Flutter developers building medium to large apps
- Teams working on feature-driven Flutter projects
- Developers migrating existing Flutter codebases to scalable architecture
- Solo developers choosing the right structure for a new Flutter app
- Code reviewers auditing Flutter app organization and dependencies
flutter-architecture FAQ
Use feature-first for medium/large apps, team work, frequent feature changes, or clearly bounded business capabilities. Use layer-first for small apps, solo work, or simple CRUD flows. The skill will help you choose based on your project context.
No. Use a Domain layer only for complex, reusable, or multi-repository business logic. ViewModels may call Repositories directly for simple flows. Add it only when it reduces duplication or isolates complex logic.
Yes. The skill can audit your current structure, identify violations, and plan incremental or all-at-once migrations. It will preserve existing conventions unless they conflict with architecture requirements.
It checks imports respect layer/feature boundaries, ViewModels don't perform I/O directly, Repositories stay UI-independent, and runs flutter analyze and focused test suites. It reports commands run, failures, and residual risks.
Yes, but only after adapting them to your project's import paths, state-management style, and naming conventions. The skill will check fit before suggesting templates.
Full instructions (SKILL.md)
Source of truth, from madteacher/mad-agents-skills.
name: flutter-architecture description: >- Design, refactor, review, or implement Flutter app architecture using MVVM, layered UI/Data/optional Domain boundaries, feature-first or layer-first project structure, repositories, services, dependency injection, Result and Command patterns, offline-first or optimistic UI flows. Use when asked to add a Flutter feature, audit layer dependencies, fix cross-feature imports, migrate to feature-first, choose architecture for a Flutter project, or create scalable maintainable Flutter code organization. metadata: author: Stanislav [MADTeacher] Chernyshev version: "1.0"
Flutter Architecture
You are an architecture agent for Flutter apps. Turn existing project facts into concrete structure, code organization, dependency rules, and validation steps. Do not treat this skill as a report: use it to inspect, decide, implement or review, and verify.
Core Contract
- Confirm the target is a Flutter or Dart package by inspecting
pubspec.yaml,lib/, and existing state-management, routing, DI, networking, persistence, and test conventions. - Preserve existing conventions unless they conflict with a clear architecture requirement or the user explicitly asks to migrate.
- Choose the smallest architecture that fits the project:
- Use feature-first for medium/large apps, team work, frequent feature changes, or clearly bounded business capabilities.
- Use layer-first for small apps, solo work, or simple CRUD flows.
- Use a Domain layer only for complex, reusable, or multi-repository business logic. ViewModels may call Repositories directly for simple flows.
- Keep Views declarative and thin, ViewModels responsible for UI state and commands, Repositories as the single source of truth for app data, and Services as stateless wrappers around external data sources.
- For implementation tasks, change the project structure and code using local patterns first. Add templates from this skill only after checking that their imports, Dart SDK features, state-management style, and naming fit the app.
- For review tasks, report layer violations, cross-feature imports, state ownership problems, missing tests, and unclear dependency boundaries before broad style advice.
- Validate with the repo's normal commands. Prefer
flutter analyzeand relevantflutter testsuites when available; otherwise explain the missing verification.
Clarification Rules
Ask the user only when a high-impact decision cannot be inferred from the project:
- product boundary of a new feature;
- expected scale of team or app when structure choice is ambiguous;
- offline-first, sync, or conflict-resolution requirements;
- whether a migration should be incremental or all-at-once.
If the project is unavailable or is not a Flutter project, give an architecture plan or review based on the provided context, do not invent repository facts, and state that code validation could not be performed.
Resource Routing
Read only the references needed for the current task:
| Need | Read | Use for |
|---|---|---|
| Basic principles or vocabulary | concepts.md | Separation of concerns, SSOT, UDF, UI as state |
| Layer boundaries or tests | layers.md | UI/Data/optional Domain responsibilities and validation |
| Feature-first structure or migration | feature-first.md | Folder layout, shared code, cross-feature dependency rules |
| MVVM relationships | mvvm.md | View, ViewModel, Repository, Service relationships |
| Command, Result, Repository, DI, offline, optimistic UI | design-patterns.md | Pattern selection and code examples |
| Command template | command.dart | Copy only after adapting import path and state-management fit |
| Result template | result.dart | Copy only when the app lacks an equivalent typed result/error model |
| Illustrative snippets | examples/README.md | Use as examples, not as a required workflow |
Architecture Defaults
- Canonical dependency rule: lower layers must not depend on upper layers. ViewModels may call Repositories directly for simple operations; use-cases are introduced only when they reduce duplication or isolate complex business logic.
- Feature modules should not import another feature's implementation files.
Move shared behavior to
shared/, depend on stable interfaces through DI, or merge features when the boundary is artificial. - Repositories own data mutation and synchronization for their data type. Services should stay stateless and should not own business state.
- Do not add folders just to satisfy a diagram. Empty
domain/,use-cases/, or barrel files are optional until the feature needs them.
Validation
Before finishing an implementation or review:
- Check that new imports respect the chosen feature/layer boundary.
- Check that ViewModels do not perform platform, file, or network I/O directly.
- Check that repositories remain UI-independent and service interactions are testable.
- Run the closest available validation:
flutter analyze- focused
flutter testsuites for changed features - template-only validation with
dart format --output=none --set-exit-if-changedfor copied Dart assets
- Report commands run, failures, skipped checks, and residual architecture risks.
Related skills
More from madteacher/mad-agents-skills and the wider catalog.

flutter-networking
>-

flutter-testing
Write, fix, and debug Flutter tests across unit, widget, integration, and plugin layers.

flutter-adaptive-ui
Build responsive Flutter UIs that adapt to any screen size, input method, and platform without device detection.

flutter-animations
Add, fix, refactor, debug, test, and explain Flutter animations and motion effects.

frontend-design
Generate and guide UI development with concept-led design spanning editorial warmth, bright product design, and high-contrast neon systems.

magicpath
Find, preview, inspect, install, export, and edit UI components via MagicPath CLI.