Skip to content
Back to skills

Android Persistence

ASecurity

Implement Room database schemas and DataStore preferences with proper async patterns in Android. Use when defining Room entities, DAOs, migrations, or replacing SharedPreferences with DataStore.

  • 549 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added June 6, 2026
developmentdatabase

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned June 6, 2026

npx -y skills add HoangNguyen0403/agent-skills-standard --skill android-persistence --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Android Persistence?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Android Persistence
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/hoangnguyen0403-android-persistence/badge)](https://www.skillsdirectory.com/skills/hoangnguyen0403-android-persistence)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: android-persistence
description: Implement Room database schemas and DataStore preferences with proper async patterns in Android. Use when defining Room entities, DAOs, migrations, or replacing SharedPreferences with DataStore.
metadata:
  triggers:
    files:
    - '**/*Dao.kt'
    - '**/*Database.kt'
    - '**/*Entity.kt'
    keywords:
    - "@Dao"
    - "@Entity"
    - RoomDatabase
---
# Android Persistence Standards

## **Priority: P0**

## 1. Configure Room Database

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

See [DAO templates](references/implementation.md) for Room DAO patterns.

## 2. Migrate to DataStore

- Replace `SharedPreferences` with `ProtoDataStore` (type-safe) or `PreferencesDataStore`.
- Inject singleton DataStore instance via Hilt.

See [DAO templates](references/implementation.md) for DataStore migration patterns.

## Anti-Patterns

- **No IO on Main Thread**: Room handles dispatchers, but verify Flow collected off-main.
- **No @Entity in UI Layer**: Map to Domain or UI models in Repository.

## References

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

Files in this skill

  • SKILL.md1.2 KB
  • evals/evals.json2.7 KB
  • references/implementation.md1.3 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.