From teikk-agents-skills
Handles data operations and concurrency in Kotlin. Use when writing Kotlin Coroutines, flows (StateFlow, SharedFlow), Retrofit network requests, Kotlin Serialization converters, or Room database operations.
How this skill is triggered — by the user, by Claude, or both
Slash command
/teikk-agents-skills:android-data-and-concurrency-kotlinThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Manage asynchronous data streams, networking, serialization, and local databases in Kotlin. Follow Clean Architecture by separating concerns between network sources, local Room databases, repositories, and domain thread-concurrency boundaries.
Manage asynchronous data streams, networking, serialization, and local databases in Kotlin. Follow Clean Architecture by separating concerns between network sources, local Room databases, repositories, and domain thread-concurrency boundaries.
android-data-and-concurrency-java instead).viewModelScope.launch and switch dispatchers explicitly inside use-cases or repositories.Dispatchers.IO. Use withContext(Dispatchers.IO) in repositories.class TaskRepositoryImpl @Inject constructor(
private val apiService: TaskApiService,
private val taskDao: TaskDao
) : TaskRepository {
override suspend fun getTasks(): List<Task> = withContext(Dispatchers.IO) {
val remoteTasks = apiService.fetchTasks()
taskDao.insertTasks(remoteTasks.map { it.toEntity() })
taskDao.getTasksOnce()
}
}
Flow<List<Entity>> from DAOs to get real-time updates from database.collectAsStateWithLifecycle() to respect Android Lifecycle and save resources.StateFlow for state (requires initial value), use SharedFlow or Channel for one-time events (like navigation, toast alerts).@Dao
interface TaskDao {
@Query("SELECT * FROM tasks")
fun getTasksFlow(): Flow<List<TaskEntity>>
}
@Serializable and use kotlinx.serialization converter.@Serializable
data class TaskDto(
@SerialName("id") val id: String,
@SerialName("title") val title: String,
@SerialName("is_completed") val isCompleted: Boolean
)
interface TaskApiService {
@GET("tasks")
suspend fun fetchTasks(): List<TaskDto>
}
suspend unless they return Flow.@Transaction for multi-step database operations to guarantee atomicity.@Database(entities = [TaskEntity::class], version = 1, exportSchema = false)
abstract class AppDatabase : RoomDatabase() {
abstract fun taskDao(): TaskDao
}
| Rationalization | Reality |
|---|---|
| "I'll just block the current thread using runBlocking" | runBlocking blocks the executing thread (like the Main thread), causing ANRs (Application Not Responding). Use suspend functions and start coroutines in the correct scope. |
| "collectAsState() is fine for collecting StateFlow" | collectAsState() keeps collecting flow events when the app is in the background, wasting CPU and battery. Use collectAsStateWithLifecycle() to automatically pause collection. |
| "I don't need Dispatchers.IO because Retrofit does it automatically" | While Retrofit runs enqueue/suspend calls asynchronously under the hood, parsing JSON and Room database queries must be explicitly directed to Dispatchers.IO to ensure no Main thread blockage. |
GlobalScope or runBlocking in application code.suspend or returning Flow.collectAsState() instead of collectAsStateWithLifecycle().Dispatchers.Main.suspend or return a Flow.try-catch blocks).collectAsStateWithLifecycle().viewModelScope or lifecycleScope).Provides behavioral guidelines to reduce common LLM coding mistakes, focusing on simplicity, surgical changes, assumption surfacing, and verifiable success criteria.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub 22teikk/22teikk-agent-skills-hub --plugin teikk-agents-skills