flutter-riverpod-architecture
Clean Architecture patterns for Flutter with Riverpod state management. Use when building or reviewing Flutter apps with layered architecture (Domain, Data, Application, Presentation).
What this skill does
# Flutter + Riverpod Clean Architecture
## Overview
This skill provides architectural patterns and rules for building Flutter applications using Clean Architecture with Riverpod for state management. Follow these patterns to maintain clear layer boundaries, testability, and scalability.
## Architecture Layers
```
┌─────────────────────────────────────────┐
│ Presentation Layer │ Flutter UI, Widgets, Routing
├─────────────────────────────────────────┤
│ Application Layer │ Riverpod Providers, State Management
├─────────────────────────────────────────┤
│ Data Layer │ Repositories, External APIs
├─────────────────────────────────────────┤
│ Domain Layer │ Entities, Value Objects, Business Rules
└─────────────────────────────────────────┘
```
## Layer Dependency Rules
| Layer | Can Depend On | Cannot Depend On |
|-------|---------------|------------------|
| **Domain** | Nothing (pure Dart) | Flutter, Riverpod, Firebase, any SDK |
| **Data** | Domain | Flutter, Riverpod, Presentation |
| **Application** | Domain, Data | Flutter UI classes |
| **Presentation** | Application, Domain | Data (direct access) |
## Quick Reference
| Layer | Primary Purpose | Key Technology |
|-------|-----------------|----------------|
| Domain | Business entities, Value Objects | Freezed, pure Dart |
| Data | Repository implementations, API calls | Firebase, HTTP clients |
| Application | State management, Provider definitions | Riverpod, AsyncNotifier |
| Presentation | UI components, routing | ConsumerWidget, go_router |
## Layer References
- `references/domain-layer.md` - Freezed entities, Value Objects, immutable data
- `references/data-layer.md` - Repository pattern, dependency injection
- `references/application-layer.md` - Riverpod providers, AsyncNotifier pattern
- `references/presentation-layer.md` - ConsumerWidget, type-safe routing
- `references/ui-patterns.md` - Widget composition, anti-patterns
## Core Principles
### 1. Dependency Inversion
- Inner layers don't know about outer layers
- Domain is completely independent
- Data depends only on Domain
- Dependencies flow inward
### 2. Single Responsibility
- Each layer has a clear purpose
- Repositories handle data access only
- Providers handle state management only
- Widgets handle UI rendering only
### 3. Testability
- Domain layer is easily unit-testable (no dependencies)
- Data layer can mock external services
- Application layer can mock repositories
- Presentation layer can mock providers
## Directory Structure (Recommended)
```
lib/
├── app/
│ ├── route/ # go_router configuration
│ └── providers/ # App-wide providers
├── features/
│ └── {feature}/
│ ├── domain/ # Entities, Value Objects
│ ├── data/ # Repositories
│ ├── application/ # Providers, Notifiers
│ └── presentation/# Screens, Widgets
└── shared/
├── domain/ # Shared entities
├── data/ # Shared repositories
└── widgets/ # Shared UI components
```
## Getting Started
1. **New Entity?** -> See `references/domain-layer.md`
2. **API Integration?** -> See `references/data-layer.md`
3. **State Management?** -> See `references/application-layer.md`
4. **Building UI?** -> See `references/presentation-layer.md`
5. **Widget Patterns?** -> See `references/ui-patterns.md`
## Compliance Verification
```bash
# Verify Domain layer purity
grep -r "package:flutter" lib/features/*/domain/
grep -r "riverpod" lib/features/*/domain/
# Verify Data layer isolation
grep -r "package:flutter" lib/features/*/data/
grep -r "riverpod" lib/features/*/data/
# Verify Presentation doesn't access Data directly
grep -r "features/.*/data/.*_repository" lib/features/*/presentation/
```
All commands should return empty results if architecture is properly maintained.
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.