sutechs/abcd_architecture_flutter/abcd-architecture-flutter
Claude Code and agent skill by sutechs/abcd_architecture_flutter
- community
Checking that the SKILL.md file is still in the repository.
Install
npx vskill@latest install sutechs/abcd_architecture_flutter/abcd-architecture-flutterSKILL.md
ABCD Architecture Guidelines for AI Agents
Provide this document as context to AI agents modifying, generating, or reviewing code within this repository.
ABCD Architecture enforces a strict unidirectional data flow designed for scalability and maintainability. It is a foundational architecture, not a specific application template. (Note: Todo is only a reference feature).
Architectural Flow
Implement features adhering to the following strict boundary flow:
Layer Definitions
- API (`lib/data/api/`): Interfaces with external services and defines backend contracts.
- Bloc (`lib/data/bloc/`): Manages application and feature state.
- Command (`lib/data/command/`): Orchestrates user actions, side effects, and state mutations.
- Display (`lib/screens/`): Renders Flutter UI components.
Supporting Structures
- Models (`lib/data/data/`): Immutable
Freezeddata classes. - Shared Widgets (`lib/widgets/`): Reusable UI components.
- Application Shell (`lib/app/`): Routing, configuration, and theme definitions.
Do not introduce external architectural patterns (e.g., Clean Architecture, MVVM) unless explicitly instructed by the user.
Technology Stack
Utilize the established technology stack unless instructed otherwise:
- State Management:
flutter_riverpod - Routing:
go_router - Serialization:
freezed,json_serializable - Local Storage:
hive_ce - Backend Implementations: Firebase, Supabase, and REST (
dio) behindBaseApiService - Monetization:
google_mobile_ads,in_app_purchase - Observability: Firebase Analytics, Crashlytics, FCM
- Validation:
flutter_test,flutter_lints
Core Principles
- No direct API access from UI: Display components must never instantiate or call API services.
- Unidirectional state observation: Screens observe Bloc state and invoke Commands.
- Centralized orchestration: Commands orchestrate all user workflows (authentication, persistence, file uploads).
- Decoupled API layer: API services accept inputs and return outputs without knowledge of UI or State components.
- Restricted Bloc mutation: Blocs maintain state and expose synchronous mutation methods. They do not handle asynchronous side effects triggered by user actions.
- Startup hydration: Blocs may hydrate their initial state during startup if no user action is required.
Pre-implementation Requirements
Before generating or modifying code:
- Review the existing feature implementation that most closely matches the requested work.
- Review
lib/data/api/core/base_api_service.dartandlib/data/api/providers.dartfor dependency injection patterns. - Verify existing route, bloc, and command naming conventions.
- Utilize
rg(ripgrep) to search for existing components before creating duplicates. - Conform to the repository's current stylistic conventions over external best practices.
Layer Implementation Standards
1. Display Layer
Location: lib/screens/<feature>/
Do:
- Extend
ConsumerWidgetorConsumerStatefulWidgetwhen accessing Riverpod state. - Utilize
ref.watch()to observe Bloc state. - Invoke Commands for user interactions.
- Implement discrete visual states (loading, empty, error, success).
- Reuse components from
lib/widgets/.
Do Not:
- Interface directly with Firebase, Supabase, Dio, Hive, or
apiServiceProvider. - Implement data mapping or DTO conversions.
- Implement asynchronous workflow logic.
2. Command Layer
Location: lib/data/command/<feature>/<feature>_command.dart
Do:
- Extend
BaseCommand. - Access dependencies via inherited getters (
api,localStorage,userBloc). - Encapsulate business workflows and user-triggered actions.
- Validate inputs.
- Generate necessary identifiers and timestamps.
- Invoke API methods for persistence.
- Mutate Bloc state.
- Implement optimistic updates matching existing repository patterns.
- Revert or invalidate Bloc state upon API failure.
- Return scalar values or
Future<void>to the Display layer.
Do Not:
- Accept
WidgetReforRefas parameters from the Display layer. - Import concrete backend SDK classes.
- Maintain mutable instance state outside of explicit lifecycle requirements.
3. Bloc Layer
Location: lib/data/bloc/<feature>_bloc.dart
Do:
- Implement
NotifierorAsyncNotifierfor state management. - Maintain the single source of truth for the Display layer.
- Expose synchronous mutation helpers (e.g.,
addLocally,updateLocally). - Observe other Blocs only for reactive state derivations.
Do Not:
- Handle user interaction workflows.
- Execute asynchronous CRUD operations targeting the API layer.
- Trigger UI side effects (e.g., Snackbars, dialogs).
- Maintain a dependency on
BuildContext.
4. API Services
Location: lib/data/api/
Do:
- Maintain
BaseApiServiceas an abstract, backend-agnostic interface. - Define feature contracts via mixins in
lib/data/api/core/. - Implement concrete logic within backend-specific repositories (e.g.,
lib/data/api/firebase/repo/). - Return strongly-typed
Freezedapplication models.
Do Not:
- Import Display, Command, or Bloc components.
- Maintain awareness of application state or UI lifecycles.
- Return raw backend payloads (e.g.,
DocumentSnapshot,Response).
5. Data Models
Location: lib/data/data/<feature>/<feature>_data.dart
Do:
- Define models using
@freezed. - Include standard generation directives (
part '<name>.freezed.dart';,part '<name>.g.dart';). - Implement standard JSON serialization factories.
- Define
const <Model>._();to support custom getters. - Execute the build runner after modifications:
``bash dart run build_runner build --delete-conflicting-outputs ``
Naming Conventions
Adhere to the following conventions:
- Model Class:
<Feature>Data(e.g.,NoteData) - API Mixin:
<Feature>ApiMixin(e.g.,NoteApiMixin) - Bloc Class:
<Feature>Bloc(e.g.,NoteBloc) - Bloc Provider:
<feature>BlocProvider(e.g.,noteBlocProvider) - Command Class:
<Feature>Command(e.g.,NoteCommand) - Routing Constant:
AppRoutes.<feature>(e.g.,AppRoutes.notes)
Feature Implementation Checklist
- Define the
Freezeddata model. - Define the API mixin contract.
- Implement the contract across enabled backend repositories.
- Implement the Bloc state notifier.
- Implement the Command to orchestrate actions.
- Implement Display components in
lib/screens/<feature>/. - Define navigation routes.
- Implement test coverage.
- Execute static analysis, format, and tests.
Feature Templates
Reference these templates when generating new feature components.
1. API Mixin Contract
Requirement: Append this mixin to BaseApiService.
2. Bloc Implementation
3. Command Implementation
Backend Integration Standards
Mock Environment
- Persist data via
LocalStorageServiceto survive application restarts. - Maintain simple authentication patterns (e.g., static OTP
123456). - Mock must function entirely without external service configuration.
Firebase Integration
- Initialize via
FirebaseInit.initialize(). - Access SDK functionality directly via
FirebaseNative. - Maintain stable, simple Firestore collection naming conventions.
- Treat successful bootstrap execution as the implicit dependency contract.
- Return
nullorfalsefor expected user-action failures requiring graceful UI handling.
Supabase Integration
- Read configuration keys (
URL,anon_key,web_client_id) viaAppConfig. - Initialize via
SupabaseInit.initialize(). - Do not access
Supabase.instance.clientprior to successful initialization. - Return
nullorfalsefor expected user-action failures requiring graceful UI handling.
REST Integration (HTTP)
- Access networking via
HttpNativeanddio. - Define endpoint constants exclusively within repository mixins.
- Deserialize responses immediately into
Freezedmodels. - Return empty lists or null only when defining explicit absence of data.
Monetization Rules
Advertisements: (lib/widgets/ads/)
- Utilize Google test ad unit IDs for debug builds.
- Retrieve production ad unit IDs from
AppConfig. - Suppress ad rendering for authenticated premium users.
- Rewarded ad callbacks must deterministically resolve to
trueorfalse.
In-App Purchases:
- Core logic resides in
iap_service.dart,purchase_command.dart,purchase_bloc.dart, andpurchase_state.dart. - Utilize mock purchase plans during mock mode to ensure the premium flow remains fully testable offline.
Testing Standards
Command Testing Guidelines:
- Instantiate
ProviderContainerwith overrides. - Override
apiServiceProviderwithMockService. - Override
localStorageProviderwith memory-based storage. - Initialize the command via
BaseCommand.init(container). - Dispose the container via
addTearDown(container.dispose). - Await literal Futures or inspect synchronous optimistic state rather than implementing arbitrary delays (
Future.delayed).
UI Testing Guidelines:
- Extract complex UI mathematics into isolated helper classes for unit testing.
- Test edge cases deterministically.
Review and Validation Requirements
Prior to finalizing changes, verify:
- Zero API calls originate from the Display layer.
- New Commands inherit from
BaseCommand. - Generated files (
.g.dart,.freezed.dart) are fully up-to-date. - Implementations span all active backend repositories.
- Mock mode functions independently of external configuration.
- Premium users are correctly exempted from advertisements.
- Exposed configuration keys are documented in
README.md.
Identified Anti-Patterns
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 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 repositoryCheckingarchitecture_skill.md
Popularity
- Repository stars
- 161
- Repository forks
- 46
- 7-day trend score
- 25
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 16 Aug 2026, 2 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/sutechs/abcd_architecture_flutter/abcd-architecture-flutter)