AGENT SKILL
android-persistence
Standards for Room Database and DataStore. Use when implementing Room database schemas or DataStore preferences in Android. (triggers: **/*Dao.kt, **/*Database.kt, **/*Entity.kt, @Dao, @Entity, RoomDatabase)
- License 许可
- MIT
- 最近更新
- 2026-06-24
- Stars
- ★ 67
- Forks
- 24
01 前言 Front Matter
- name
- android-persistence
- description
- Standards for Room Database and DataStore. Use when implementing Room database schemas or DataStore preferences in Android. (triggers: **/*Dao.kt, **/*Database.kt, **/*Entity.kt, @Dao, @Entity, RoomDatabase)
02 资源文件 11
- 参考文档forms.md11.6 KB
- 许可证LICENSE.txt1.4 KB
- 参考文档reference.md16.3 KB
- 脚本scripts/check_bounding_boxes.py2.7 KB
- 脚本scripts/check_fillable_fields.py268 B
- 脚本scripts/convert_pdf_to_images.py1008 B
- 脚本scripts/create_validation_image.py1.2 KB
- 脚本scripts/extract_form_field_info.py4.2 KB
- 脚本scripts/extract_form_structure.py3.9 KB
- 脚本scripts/fill_fillable_fields.py3.7 KB
- 脚本scripts/fill_pdf_form_with_annotations.py3.2 KB
03 SKILL.md 正文
Android Persistence Standards
Priority: P0
Implementation Guidelines
Room
- Async: Return
Flow<List<T>>for queries, usesuspendfor Write/Insert. - Entities: Keep simple
@Entitydata classes. Map to Domain models in Repository. - Transactions: Use
@Transactionfor multi-table queries (Relations).
DataStore
- Usage: Replace
SharedPreferenceswithProtoDataStore(Type-safe) orPreferencesDataStore. - Scope: Inject singleton instance via Hilt.
Anti-Patterns
- No IO on Main Thread: Room handles dispatchers, but verify Flow is collected off-main.
- No @Entity in UI Layer: Map to Domain or UI models in Repository.