common-architecture-di…
Draw architecture diagrams as editable draw.io files with a fixed house style, C4 levels, and evidence-tagged shapes. Use when producing a system context,…
Implement functional repository error recovery with Either/Failure patterns in Flutter. Use when handling exceptions or dartz Either types in data flows; defer UI-only retry buttons.
$ npx -y skills add hoangnguyen0403/agent-skills-standard --skill flutter-error-handling --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/flutter-error-handlingContext preview
The summary Claude sees to decide when to auto-load this skill.
Implement functional repository error recovery with Either/Failure patterns in Flutter. Use when handling exceptions or dartz Either types in data flows; defer UI-only retry buttons.
name: flutter-error-handling
description: Implement functional repository error recovery with Either/Failure patterns in Flutter. Use when handling exceptions or dartz Either types in data flows; defer UI-only retry buttons.
metadata:
triggers:
files:
- 'lib/domain/**'
- 'lib/infrastructure/**'
keywords:
- Either
- fold
- Left
- Right
- Failure
- dartz1. **Define failures** — Create domain-specific failures using `@freezed` unions (e.g., `UnauthorizedFailure`, `OutOfStockFailure`). 2. **Return Either** — Repositories return `Either<Failure, T>`. No exceptions in UI/BLoC. 3. **Catch in Infrastructure only** — Infrastructure catches exceptions (e.g., `DioException`) and returns `Left(Failure)`. Never rethrow to UI. 4. **Fold in BLoC** — Use `.fold(failure, success)` in BLoC to emit corresponding states. Remove try/catch from BLoC. 5. **Localize messages** — Use `failure.failureMessage` (returns `TRObject` or localized string) for UI-safe text. 6. **Log with stable templates** — Use low-cardinality message templates; pass variable data via metadata/context. 7. **No Silent Catch**: Never swallow errors without logging or documented retry. 8. **Crashlytics Routing**: All UI/BLoC `catch` blocks MUST route errors via `AppLogger.error(AppException.fromException(e).message, error: e, stackTrace: st)` for observability and type-safe UI messages.
See [implementation examples](references/implementation.md) for repository error mapping and BLoC consumption patterns.
For Failure definitions and API error mapping: See [references/REFERENCE.md](references/REFERENCE.md).
layer-based-clean-architecture | bloc-state-management
When this skill applies, preserve the following domain terminology or equivalent concrete examples in the answer when relevant:
The portable SDLC standards layer for AI coding agents. Sync once, then work in your own runtime.
Repo: hoangnguyen0403/agent-skills-standard
Draw architecture diagrams as editable draw.io files with a fixed house style, C4 levels, and evidence-tagged shapes. Use when producing a system context,…
Enforce SOLID principles, guard-clause style, function size limits, and intention-revealing naming across all languages. Use when refactoring for readability,…
Standardize BRD and BRD-lite discovery for business goals, stakeholder impact, current-to-future state, and measurable value outcomes. Use when creating BRD,…
Conduct high-quality, persona-driven code reviews. Use when reviewing PRs, critiquing code quality, or analyzing changes for team feedback.
Maximize context window efficiency, reduce latency, and prevent lost-in-middle issues through strategic masking and compaction. Use when token budgets are…
Standardize dynamic application security testing for backend APIs, frontend web apps, and mobile clients. Covers ZAP, Nuclei, Nikto, sqlmap, ffuf, browser…