AgentSkillsCN

flutter-layer-implementation

详细指导各层(Domain/Infrastructure/Application/Presentation)的实现细节。 适用于“实现 Domain 层”“构建 Infrastructure 层”“编写 Application 层代码” “实现 Presentation 层”时使用。提供各层具体的实现模式与实践指南。

SKILL.md
--- frontmatter
name: flutter-layer-implementation
description: |
  Domain/Infrastructure/Application/Presentation各層の実装詳細をガイドするスキル。
  「Domain層を実装して」「Infrastructure層を作成」「Application層の書き方」
  「Presentation層の実装」時に使用。レイヤー別の具体的な実装パターンを提供。

🏛️ Flutter レイヤー別実装スキル

目的: 各レイヤーの実装詳細をガイドする

実装順序

code
1. Domain層       → ビジネスロジックの中心
2. Infrastructure層 → データアクセス
3. Application層   → 状態管理・DI
4. Presentation層  → UI表示

各レイヤーの詳細

Domain層 (1_domain/)

参照: AI/architecture/lib/features/1_domain/ 配下の instructions.md

ディレクトリ責務使用技術
1_entities/ビジネスエンティティFreezed
2_repositories/リポジトリIF抽象クラス
3_usecases/ユースケース純粋Dart
exceptions/ドメイン例外Exception継承

Infrastructure層 (2_infrastructure/)

参照: AI/architecture/lib/features/2_infrastructure/ 配下の instructions.md

ディレクトリ責務使用技術
1_models/DBモデルDrift
2_data_sources/1_local/ローカルDSDrift
2_data_sources/2_remote/リモートDShttp/dio
3_repositories/リポジトリ実装DomainのIF実装

Application層 (3_application/)

参照: AI/architecture/lib/features/3_application/ 配下の instructions.md

ディレクトリ責務使用技術
1_states/状態定義Freezed
2_providers/依存性注入Riverpod
3_notifiers/状態管理@riverpod

重要: Provider vs Notifier の責務

code
Notifier (3_notifiers/):
- UIの状態管理
- UseCaseの呼び出し
- 副作用の管理
- @riverpod アノテーション使用

Provider (2_providers/):
- 依存性注入のみ
- Repository/UseCaseのインスタンス生成
- ビジネスロジックは含めない

Presentation層 (4_presentation/)

参照: AI/architecture/lib/features/4_presentation/ 配下の instructions.md

ディレクトリ責務使用技術
2_pages/画面ページHookConsumerWidget
1_widgets/1_atoms/最小単位HookWidget
1_widgets/2_molecules/複合ウィジェットHookWidget
1_widgets/3_organisms/機能ウィジェットHookConsumerWidget

各レイヤー実装後のコマンド

bash
# 構造検証
/validate_structure

# ステータス更新
/status update

# 静的解析
/flutter_analyze

参照ドキュメント

  • resources/domain_layer.md - Domain層詳細
  • resources/infrastructure_layer.md - Infrastructure層詳細
  • resources/application_layer.md - Application層詳細
  • resources/presentation_layer.md - Presentation層詳細