android-data-persistence

android-data-persistence is a skill for Claude Code, Codex from GuillemRoca/agent-skills-android. It costs 41 tokens per session (2,464 once invoked), scanned A, original, MIT.

Guidance for storing Android app data locally, including structured records, preferences, and data used when the network is unavailable. It covers Room, DataStore, migrations, pagination, and repositories that separate storage from the rest of the app.

In plain words
What is it for?
Adding Room databases and migrations, storing settings with DataStore, building offline-first behavior, paging through large data sets, and organizing data access with repositories.
Why use it?
Apps need data to survive restarts and often need to remain useful without a connection. Clear storage choices also make database changes and large data sets easier to manage safely.

Skill for Claude CodeCodex

Part of the agent-skills-android plugin — 29 skills, 7 commands, 3 agents, 1 hook shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/guillemroca/agent-skills-android/android-data-persistence
Any agent
npx skills add GuillemRoca/agent-skills-android --skill android-data-persistence
Clone the repo
git clone --depth 1 https://github.com/GuillemRoca/agent-skills-android

Made for: Claude Code, Codex.

Or install agent-skills-android, the plugin that ships this one along with the rest of its 29 skills, 7 commands, 3 agents, 1 hook.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for android-data-persistence

README.md
[![agentmods](https://agentmods.dev/badge/skills/guillemroca/agent-skills-android/android-data-persistence.svg)](https://agentmods.dev/skills/guillemroca/agent-skills-android/android-data-persistence)
Your own site
<a href="https://agentmods.dev/skills/guillemroca/agent-skills-android/android-data-persistence"><img src="https://agentmods.dev/badge/skills/guillemroca/agent-skills-android/android-data-persistence.svg" alt="Measured on agentmods" height="20"></a>
Per session 41 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,464 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00041 $0.02464
Opus 5 $0.00020 $0.01232
Sonnet 5 $0.00008 $0.00493
Haiku 4.5 $0.00004 $0.00246

Measured 4d ago against content hash 4914ec3091a1, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

android-data-persistence scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/android-data-persistence/SKILL.md · 366 lines

How it starts

The opening of the file, as written. The whole thing — 366 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Android Data Persistence

Overview

Reliable data persistence is critical for Android apps. This skill covers Room (SQLite abstraction), DataStore (key-value and proto), offline-first architecture, Paging3 for large datasets, and the repository pattern that abstracts data sources from the rest of the app.

When to Use

  • Setting up or modifying a Room database
  • Writing database migrations
  • Implementing offline-first data access
  • Adding pagination for large datasets
  • Choosing between Room, DataStore, and SharedPreferences
  • Implementing the repository pattern

Skip when: Data is purely in-memory or comes only from a remote API with no caching.

Data Storage Decision Guide

Requirement Solution
Structured data with relations Room
User preferences (key-value) DataStore (Preferences)
Typed settings with schema DataStore (Proto)
Large datasets with pagination Room + Paging3
Simple flags or tokens DataStore (Preferences)
Never use SharedPreferences (for new code)

Core Process

Step 1: Room Setup

  1. Define entities:
@Entity(
    tableName = "tasks",
    indices = [Index(value = ["created_at"])],
)
data class TaskEntity(
    @PrimaryKey
    val id: String,
    @ColumnInfo(name = "title")
    val title: String,
    @ColumnInfo(name = "description")
    val description: String?,
    @ColumnInfo(name = "completed")
    val completed: Boolean = false,
    @ColumnInfo(name = "created_at")
    val createdAt: Long = System.currentTimeMillis(),
    @ColumnInfo(name = "updated_at")
    val updatedAt: Long = System.currentTimeMillis(),
)
  1. Define DAOs:
@Dao
interface TaskDao {
    @Query("SELECT * FROM tasks ORDER BY created_at DESC")
    fun observeAll(): Flow<List<TaskEntity>>

    @Query("SELECT * FROM tasks WHERE id = :taskId")
    suspend fun getById(taskId: String): TaskEntity?

    @Query("SELECT * FROM tasks WHERE completed = :completed ORDER BY created_at DESC")
    fun observeByStatus(completed: Boolean): Flow<List<TaskEntity>>

    @Upsert
    suspend fun upsert(task: TaskEntity)

    @Upsert
    suspend fun upsertAll(tasks: List<TaskEntity>)

    @Query("DELETE FROM tasks WHERE id = :taskId")
    suspend fun deleteById(taskId: String)

    @Query("DELETE FROM tasks WHERE completed = 1")
    suspend fun deleteCompleted()

    @Transaction
    suspend fun replaceAll(tasks: List<TaskEntity>) {
        deleteAll()
        upsertAll(tasks)
    }

    @Query("DELETE FROM tasks")
    suspend fun deleteAll()
}

Read the full file on GitHub · 366 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 366 lines · 41 tokens per session scan A 4914ec3091a1

Subscribe to this mod's changes

android-data-persistence is a skill published in the GitHub repository GuillemRoca/agent-skills-android (2 stars, last pushed 2mo ago), licensed MIT. It adds 41 tokens to every session and 2,464 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

engineering-backend-architect

Design backend system architecture for new products, large features, platform refactors, API and database design, microservices decomposition, event-driven systems, scaling, reliability, observability, and cloud deployment.

flc1125/skills · 45 tokens

monorepo-sync-types

Regenerate backend types and re-export them via packages/shared/types/ in a turborepo monorepo so both apps/web/ and apps/mobile/ consume a single typed surface. Supports Supabase (via supabase gen types typescript), neon-drizzle (via drizzle-kit introspect/pull + InferSelectModel/InferInsertModel re-exports — the…

lukedj78/dev-flow · 209 tokens

offline-first-expert

Expert guidance for offline-first KMP and Android architectures using Store5, Room, SQLDelight, Ktor. Always trigger this skill when designing repositories, databases, caching, offline sync, Fetchers, SourceOfTruth, Updaters, Bookkeepers.

JosephSanjaya/skills · 57 tokens

flutter-drift

Implement, fix, review, migrate, test, or debug Drift persistence in Flutter apps using SQLite, driftflutter, type-safe Dart queries, generated tables, StreamBuilder or Riverpod StreamProvider UI, write operations, transactions, schema migrations, web assets, isolate sharing, and local database testing. Use when a…

MADTeacher/mad-agents-skills · 111 tokens

rubber-duck

Invoke a Rubber Duck Reviewer subagent to independently critique plans and implementations before proceeding. Use when the agent is about to implement a non-trivial plan (multi-file changes, architectural decisions, security-sensitive logic, database schema changes), after completing a self-contained unit of work…

jim60105/copilot-prompt · 118 tokens

claude-android-ninja

Use when building Android apps with Kotlin, Jetpack Compose, MVVM, Hilt, Room 3 (KSP, SQLiteDriver, Flow/suspend DAOs), and multi-module architecture. Triggers on requests to create Android projects, modules, screens, ViewModels, repositories, or Android architecture questions. Not for iOS, Flutter, React Native…

dinglebear-ai/dendrite · 99 tokens