Agent skill
data
Room ORM, SQLite, SharedPreferences, DataStore, encryption.
Install this agent skill to your Project
npx add-skill https://github.com/pluginagentmarketplace/custom-plugin-android/tree/main/skills/data
SKILL.md
Data Persistence Skill
Quick Start
Room Entity & DAO
@Entity
data class User(@PrimaryKey val id: Int, val name: String)
@Dao
interface UserDao {
@Query("SELECT * FROM User")
suspend fun getAllUsers(): List<User>
@Insert
suspend fun insert(user: User)
}
EncryptedSharedPreferences
val prefs = EncryptedSharedPreferences.create(context, "secret",
MasterKey.Builder(context).setKeyScheme(AES256_GCM).build(),
AES256_SIV, AES256_GCM)
prefs.edit { putString("token", value) }
DataStore
val dataStore = context.createDataStore("settings")
val preferences = dataStore.data.map { it[KEY] ?: "" }
Key Concepts
Room Advantages
- Type-safe queries
- Compile-time checks
- Suspend/Flow support
- Migration management
SharedPreferences
- Simple key-value store
- Use Encrypted version for sensitive data
- Limited to small data
DataStore
- Modern SharedPreferences
- Coroutine-native
- Type-safe
- ACID transactions
Best Practices
✅ Use Room for complex data ✅ Encrypt sensitive data ✅ Implement proper migrations ✅ Handle database errors ✅ Test database operations
Resources
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
platform
Android core components lifecycle, Activities, Fragments, Services, Intent system.
ui
XML layouts, ConstraintLayout, Jetpack Compose, Material Design 3.
architecture
MVVM pattern, Clean Architecture, Repository pattern, dependency injection, SOLID principles.
production
Unit testing, performance optimization, security implementation, Play Store deployment.
networking
Retrofit, OkHttp, REST APIs, JSON serialization, network security.
fundamentals
Master Kotlin syntax, OOP principles, SOLID practices, functional programming, and data structures.
Didn't find tool you were looking for?