evanca/flutter-ai-rules/flutter-app-architecture
Claude Code and agent skill by evanca/flutter-ai-rules
- community
Checking that the SKILL.md file is still in the repository.
Use when scaffolding a project, refactoring into layers, creating view models/repositories, configuring dependency injection, or implementing unidirectional data flow (MVVM).
Install
npx vskill@latest install evanca/flutter-ai-rules/flutter-app-architectureSKILL.md
Flutter App Architecture Skill
This skill defines how to structure Flutter applications using layered architecture, proper data flow, and MVVM patterns for maintainability and testability.
When to Use
Use this skill when:
- Scaffolding a new Flutter project with layered architecture.
- Creating or refactoring View Models, Repositories, or Services.
- Wiring dependency injection between architectural components.
- Implementing unidirectional data flow across layers.
- Adding a Domain (Logic) Layer for complex business logic or shared use cases.
1. Layer Structure
Separate every app into a UI Layer and a Data Layer. Add a Logic (Domain) Layer only for complex apps.
Rules:
- Only adjacent layers may communicate. The UI layer must never access a Service directly.
- Data changes always happen in the Data layer (SSOT = Repository). No mutation in UI or Logic layers.
- Follow unidirectional data flow: state flows down (Data → UI), events flow up (UI → Data).
2. Component Responsibilities
View
- Describes how to present data; keep logic minimal and UI-related only.
- Passes events to the ViewModel in response to user interactions.
ViewModel
- Converts app data into UI state and maintains the current state needed by the View.
- Exposes callbacks (commands) to the View and retrieves/transforms data from Repositories.
Repository (Single Source of Truth)
- The only class that may mutate its data; all other classes read from it.
- Handles caching, error handling, and data refresh logic.
- Transforms raw data from Services into domain models.
Service
- Wraps API endpoints and exposes asynchronous response objects.
- Isolates data-loading and holds no state.
3. Dependency Injection
Supply dependencies via constructors. Define abstract interfaces so implementations can be swapped for testing.
4. Use Cases (Domain Layer)
Introduce use cases only when:
- Logic is complex or does not fit cleanly in the UI or Data layers.
- Logic is reused across multiple ViewModels or merges data from multiple Repositories.
5. Workflow: Scaffold a New Feature
- Create the Service — implement the API wrapper with typed response parsing.
- Create the Repository — inject the Service, implement caching and error-handling logic.
- Create the ViewModel — inject the Repository, expose UI state and commands.
- Create the View — bind to the ViewModel, render state, dispatch events.
- Wire DI — register all components in the dependency injection container.
- Verify — confirm the View never accesses the Service directly and data flows unidirectionally.
6. Data Storage
- Use key-value storage (e.g.,
shared_preferences) for configuration and preferences. - Use SQL storage (e.g.,
drift,sqflite) for complex relational data. - Implement optimistic updates to improve perceived responsiveness by updating UI before server confirms.
- Support offline-first by combining local and remote data sources in Repositories.
7. Coding Conventions
- Use
StatelessWidgetwhen possible; avoid unnecessaryStatefulWidgets. - Keep build methods simple and focused on rendering.
- Prefer
finalfor fields and top-level variables. Preferconstconstructors when the class supports it. - Prefer explicit typing on public APIs (e.g.,
Command0<void>over dynamic signatures). - Use descriptive constant names (e.g.,
_todoTableNameover_kTableTodo).
References
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/flutter-app-architecture/SKILL.md
Popularity
- Repository stars
- 500
- Repository forks
- 51
- 7-day trend score
- 31
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 24 Mar 2026, 7 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/evanca/flutter-ai-rules/flutter-app-architecture)