Skillsandroid-persistence
android-persistence

android-persistence

Standards for Room Database and DataStore

android-persistenceHoangNguyen0403
144 stars
2.9k downloads
Updated 1w ago

Readme

android-persistence follows the SKILL.md standard. Use the install command to add it to your agent stack.

---
name: Android Persistence
description: Standards for Room Database and DataStore
metadata:
  labels: [android, persistence, room, database]
  triggers:
    files: ['**/*Dao.kt', '**/*Database.kt', '**/*Entity.kt']
    keywords: ['@Dao', '@Entity', 'RoomDatabase']
---

# Android Persistence Standards

## **Priority: P0**

## Implementation Guidelines

### Room

- **Async**: Return `Flow<List<T>>` for queries, use `suspend` for Write/Insert.
- **Entities**: Keep simple `@Entity` data classes. Map to Domain models in Repository.
- **Transactions**: Use `@Transaction` for multi-table queries (Relations).

### DataStore

- **Usage**: Replace `SharedPreferences` with `ProtoDataStore` (Type-safe) or `PreferencesDataStore`.
- **Scope**: Inject singleton instance via Hilt.

## Anti-Patterns

- **Main Thread**: `**No IO on Main**: Use Dispatchers.IO (Room helper does this, but verify flow collection).`
- **Domain Leak**: `**No Entities in UI**: Map to Domain/UI Models.`

## References

- [DAO Templates](references/implementation.md)

Install

Requires askill CLI v1.0+

Metadata

LicenseUnknown
Version-
Updated1w ago
PublisherHoangNguyen0403

Tags

No tags yet.