AGENT SKILL
flutter-firestore-repository
暂无简介
- License 许可
- MIT
- 最近更新
- 2026-05-26
- Stars
- ★ 0
- Forks
- 0
03 SKILL.md 正文
flutter-firestore-repository
Purpose
Build a Firestore-backed repository with explicit DTO mapping, query boundaries, and clean domain output.
Use when
- A feature needs document or collection persistence
- You need query logic isolated from UI and domain
- The feature needs mapping between Firestore data and domain entities
Do NOT use when
- The feature only needs in-memory state
- There is no Firestore dependency in the project
- You want to return
Map<String, dynamic>directly to the presentation layer
Inputs required
- Collection path
- Entity shape
- Query and pagination rules
- Offline or cache expectations
Constraints
- Keep Firestore SDK calls in the data layer
- Map raw documents into typed DTOs before domain use
- Keep query rules explicit and documented
- Handle null and missing-field cases deliberately
Step-by-step workflow
- Define the repository contract in the domain layer.
- Define DTOs and mappers in the data layer.
- Implement Firestore queries in the datasource or repository adapter.
- Convert raw documents into typed domain entities.
- Add tests for mapping and query edge cases.
- Document collection paths and indexing assumptions.
Output contract
- Domain repository contract
- DTO and mapper files
- Firestore repository implementation
- Query or mapping tests
Validation checklist
- Firestore documents are never exposed raw to UI
- Missing fields are handled safely
- Query scope is narrow and documented
- Mapper tests cover schema drift
Related skills
flutter-firebase-auth-adapterflutter-riverpod-state-skeletonflutter-clean-architecture-audit
References
Real example
profiles collection documents map to a Profile entity via ProfileDto.fromJson and never leak DocumentSnapshot objects into presentation.
Real file output sample
lib/features/profile/data/datasources/profile_firestore_data_source.dart
lib/features/profile/data/repositories/profile_repository_impl.dart
lib/features/profile/data/dtos/profile_dto.dart
04 同仓库更多 Skills
toolkit-i18n-operator
Use the toolkit-i18n CLI for repeated Flutter localization workflows with compact outputs, CSV validation, key coverage reporting, generated JSON exports, and safe non-mutating behavior.
★ 0
toolkit-design-operator
Use the toolkit-design CLI for repeated repository workflows.
★ 0
toolkit-ci-operator
Use the toolkit-ci CLI for repeated repository workflows.
★ 0
toolkit-arch-operator
Use the toolkit-arch CLI for repeated repository workflows, including Flutter i18n usage scans, layer checks, and localization coverage.
★ 0
web-testing
暂无简介
★ 0
web-state
暂无简介
★ 0