Flutter Architecture Skill
Purpose
Design and evolve Flutter application architecture with enforceable boundaries,
explicit ownership, and migration-safe sequencing under real delivery constraints.
Scope and authority
This skill is the lead authority for:
- feature-first folder structure and module/package topology
- architecture style selection (Clean / Vertical Slice / Modular Monolith / Package-First)
- layering decisions and dependency direction enforcement
- migration strategy from legacy codebases
- DI wiring strategy (Riverpod / get_it)
- monorepo vs single-package decisions
This skill is not the final authority for:
- critical security exposure →
flutter-security override
- release go/no-go →
flutter-build-release override
- runtime performance SLA →
flutter-performance runtime override
- rendering pipeline decisions →
flutter-rendering override
When to use
- Starting architecture for a new Flutter app or major feature set
- Refactoring from flat
screens/widgets/models/services structure
- Deciding architecture style fit for current team and product complexity
- Resolving layer violations or circular dependencies
- Designing migration paths from legacy codebases (Provider → Riverpod, etc.)
- Requesting ADR-ready architecture decisions
Required inputs
Collect the minimum set that changes the decision:
- team size and ownership model
- app complexity and domain richness (CRUD vs event-heavy)
- current architecture pain points (if any)
- build/CI constraints and delivery deadlines
- target platforms (mobile, web, desktop)
- offline requirements
- regulatory/security constraints
- migration risk tolerance
If key inputs are missing, proceed with explicit assumptions and lower confidence.
Decision engine workflow
- Frame constraints and decision domain.
- Classify architecture maturity (seed / scaling / multi-team / legacy-heavy).
- Select architecture style branch (see branching tree below).
- Define feature-first folder structure.
- Validate against global dependency constraints (
../../AGENTS.md).
- Run cross-skill checks (security / performance / testing / CI).
- Resolve conflicts using authority model.
- Return target-state design + phased migration plan + rollback points.
Branching decision tree
Branch A: team and product maturity
Seed team (1–4 engineers, fast iteration):
- Prefer modular monolith + feature-first within single package.
- Delay package split unless ownership/build pain is concrete.
- Default stack: Riverpod 3 + go_router + Drift + Dio.
Scaling team (5–12 engineers, multiple ownership zones):
- Introduce selective feature packages by ownership and change rate.
- Add package-level API boundaries where coordination overhead rises.
- Melos for workspace management.
Multi-team (12+ engineers, parallel delivery):
- Use explicit feature packages + strong domain/core contracts.
- Enforce strict dependency visibility (Melos + custom lint).
- Federated plugin pattern for platform integrations.
Legacy-heavy (GetX, Provider, flat structure, fragile builds):
- Strangler fig migration slices.
- Prioritize boundary stabilization before style purity.
- Never rewrite entire app; extract feature by feature.
Branch B: architecture style fit
Clean Architecture: enterprise apps with complex domain logic, regulatory compliance,
multiple teams. Highest testability, highest setup cost.
Vertical Slice / MVVM: startup MVPs, CRUD-heavy, time-pressured delivery.
Lowest setup cost, lowest scalability ceiling.
Modular Monolith: growth-stage apps (3–8 engineers). Balanced scalability.
Feature-first within single package, no Melos yet.
Package-First (Melos): monorepo with multiple apps or platform teams.
Maximum scalability, highest setup/maintenance cost.
Branch C: migration strategy
- Low risk tolerance: incremental adapters + compatibility seams. One feature at a time.
- Moderate tolerance: parallel module extraction with feature-by-feature cutover.
- High tolerance + strong tests: accelerated boundary rewrite with staged guardrails.
Conflict handling with other skills
Real-world tradeoff guidance
Allow context-justified non-ideal decisions when clearly labeled:
- "Temporary shared package" may be acceptable under deadline if ownership exit criteria is defined.
- "Hybrid architecture" is acceptable during migration if dependency direction remains enforceable.
- "Deferred package split" is acceptable when build pain is low and team size is stable.
Do NOT present temporary compromises as final architecture.
Anti-pattern detection
Flag and explain:
- Global
screens/, widgets/, models/, services/ directories at root
- Business logic inside widget
build() methods
- Repositories depending on BuildContext
- Domain models containing Flutter framework types
- Feature-to-feature direct package imports
- Domain contaminated by HTTP/DB transport concerns
- Over-modularization with no ownership or build ROI
- Under-modularization causing impossible parallel work
- Riverpod providers defined inside widgets (not in provider files)
- GetX usage in any form
Uncertainty protocol
Always report confidence:
High (≥ 0.80): constraints and evidence are strong
Medium (0.60–0.79): assumptions or tradeoff ambiguity exists
Low (< 0.60): key data missing or conflicts unresolved
If confidence is Medium/Low:
- List assumptions that could flip the decision
- Provide at least one viable alternative path
- Identify minimum missing data needed to finalize
- Escalate to supporting skills where uncertainty is cross-domain
Cross-skill handoff payload
Use the standard payload from ../../AGENTS.md.
Set requesting_skill to flutter-architecture.
Output contract
Follow the global section order from ../../AGENTS.md. Also include:
Proposed structure tree (full directory/package layout)
Dependency rules (allowed/forbidden)
Migration path with rollback-safe phases
ADR draft
DI wiring strategy
Related resources
references/architecture-styles.md
references/dependency-rules.md
references/feature-first-structure.md
templates/architecture-proposal.md
templates/adr.md
templates/feature-scaffold.md
1---2name: flutter-architecture3description: Lead authority for Flutter app architecture decisions. Use when structuring a new project, refactoring package/module boundaries, choosing architecture style, resolving dependency violations, or designing migration paths from legacy codebases.4---56# Flutter Architecture Skill78## Purpose910Design and evolve Flutter application architecture with enforceable boundaries,11explicit ownership, and migration-safe sequencing under real delivery constraints.1213## Scope and authority1415This skill is the **lead authority** for:1617- feature-first folder structure and module/package topology18- architecture style selection (Clean / Vertical Slice / Modular Monolith / Package-First)19- layering decisions and dependency direction enforcement20- migration strategy from legacy codebases21- DI wiring strategy (Riverpod / get_it)22- monorepo vs single-package decisions2324This skill is **not the final authority** for:2526- critical security exposure → `flutter-security` override27- release go/no-go → `flutter-build-release` override28- runtime performance SLA → `flutter-performance` runtime override29- rendering pipeline decisions → `flutter-rendering` override3031---3233## When to use3435- Starting architecture for a new Flutter app or major feature set36- Refactoring from flat `screens/widgets/models/services` structure37- Deciding architecture style fit for current team and product complexity38- Resolving layer violations or circular dependencies39- Designing migration paths from legacy codebases (Provider → Riverpod, etc.)40- Requesting ADR-ready architecture decisions4142---4344## Required inputs4546Collect the minimum set that changes the decision:4748- team size and ownership model49- app complexity and domain richness (CRUD vs event-heavy)50- current architecture pain points (if any)51- build/CI constraints and delivery deadlines52- target platforms (mobile, web, desktop)53- offline requirements54- regulatory/security constraints55- migration risk tolerance5657If key inputs are missing, proceed with explicit assumptions and lower confidence.5859---6061## Decision engine workflow62631. Frame constraints and decision domain.642. Classify architecture maturity (seed / scaling / multi-team / legacy-heavy).653. Select architecture style branch (see branching tree below).664. Define feature-first folder structure.675. Validate against global dependency constraints (`../../AGENTS.md`).686. Run cross-skill checks (security / performance / testing / CI).697. Resolve conflicts using authority model.708. Return target-state design + phased migration plan + rollback points.7172---7374## Branching decision tree7576### Branch A: team and product maturity7778- **Seed team (1–4 engineers, fast iteration)**:79 - Prefer modular monolith + feature-first within single package.80 - Delay package split unless ownership/build pain is concrete.81 - Default stack: Riverpod 3 + go_router + Drift + Dio.8283- **Scaling team (5–12 engineers, multiple ownership zones)**:84 - Introduce selective feature packages by ownership and change rate.85 - Add package-level API boundaries where coordination overhead rises.86 - Melos for workspace management.8788- **Multi-team (12+ engineers, parallel delivery)**:89 - Use explicit feature packages + strong domain/core contracts.90 - Enforce strict dependency visibility (Melos + custom lint).91 - Federated plugin pattern for platform integrations.9293- **Legacy-heavy (GetX, Provider, flat structure, fragile builds)**:94 - Strangler fig migration slices.95 - Prioritize boundary stabilization before style purity.96 - Never rewrite entire app; extract feature by feature.9798### Branch B: architecture style fit99100- **Clean Architecture**: enterprise apps with complex domain logic, regulatory compliance,101 multiple teams. Highest testability, highest setup cost.102103- **Vertical Slice / MVVM**: startup MVPs, CRUD-heavy, time-pressured delivery.104 Lowest setup cost, lowest scalability ceiling.105106- **Modular Monolith**: growth-stage apps (3–8 engineers). Balanced scalability.107 Feature-first within single package, no Melos yet.108109- **Package-First (Melos)**: monorepo with multiple apps or platform teams.110 Maximum scalability, highest setup/maintenance cost.111112### Branch C: migration strategy113114- **Low risk tolerance**: incremental adapters + compatibility seams. One feature at a time.115- **Moderate tolerance**: parallel module extraction with feature-by-feature cutover.116- **High tolerance + strong tests**: accelerated boundary rewrite with staged guardrails.117118---119120## Conflict handling with other skills121122- With `flutter-performance`:123 - Keep architectural boundaries unless measured frame-time/regression evidence requires exception.124 - If exception is needed: time-box it, define path back to target architecture.125126- With `flutter-state-management`:127 - State patterns must respect architecture ownership boundaries.128 - Reject ViewModel shortcuts that leak domain/data responsibilities.129130- With `flutter-ci-cd`:131 - Package proposals must be build-graph-feasible.132 - Avoid theoretical splits that harm CI throughput without ROI.133134- With `flutter-security`:135 - Security-critical controls override structural preferences.136137- With `flutter-testing`:138 - Increase verification scope before high-risk structural changes.139140---141142## Real-world tradeoff guidance143144Allow context-justified non-ideal decisions when clearly labeled:145146- "Temporary shared package" may be acceptable under deadline if ownership exit criteria is defined.147- "Hybrid architecture" is acceptable during migration if dependency direction remains enforceable.148- "Deferred package split" is acceptable when build pain is low and team size is stable.149150Do NOT present temporary compromises as final architecture.151152---153154## Anti-pattern detection155156Flag and explain:157158- Global `screens/`, `widgets/`, `models/`, `services/` directories at root159- Business logic inside widget `build()` methods160- Repositories depending on BuildContext161- Domain models containing Flutter framework types162- Feature-to-feature direct package imports163- Domain contaminated by HTTP/DB transport concerns164- Over-modularization with no ownership or build ROI165- Under-modularization causing impossible parallel work166- Riverpod providers defined inside widgets (not in provider files)167- GetX usage in any form168169---170171## Uncertainty protocol172173Always report confidence:174175- `High` (≥ 0.80): constraints and evidence are strong176- `Medium` (0.60–0.79): assumptions or tradeoff ambiguity exists177- `Low` (< 0.60): key data missing or conflicts unresolved178179If confidence is Medium/Low:180181- List assumptions that could flip the decision182- Provide at least one viable alternative path183- Identify minimum missing data needed to finalize184- Escalate to supporting skills where uncertainty is cross-domain185186---187188## Cross-skill handoff payload189190Use the standard payload from `../../AGENTS.md`.191Set `requesting_skill` to `flutter-architecture`.192193---194195## Output contract196197Follow the global section order from `../../AGENTS.md`. Also include:198199- `Proposed structure tree` (full directory/package layout)200- `Dependency rules (allowed/forbidden)`201- `Migration path with rollback-safe phases`202- `ADR draft`203- `DI wiring strategy`204205---206207## Related resources208209- `references/architecture-styles.md`210- `references/dependency-rules.md`211- `references/feature-first-structure.md`212- `templates/architecture-proposal.md`213- `templates/adr.md`214- `templates/feature-scaffold.md`