Kotlin & Android Best Practices
kotlin_best_practicesObtain official Kotlin and Android code patterns with ready-to-use snippets and anti-patterns for coroutines, Compose, Room, Hilt, and more.
Instructions
Returns official Kotlin and Android code patterns with ready-to-use snippets and explicit anti-patterns. All snippets are sourced from developer.android.com and kotlinlang.org. Call this when generating coroutine code, StateFlow/LiveData usage, Compose state, Room DAOs, Hilt injection, Navigation, or WorkManager tasks. Available patterns: coroutines-viewmodel, stateflow-ui, compose-state, room-dao, hilt-injection, navigation-compose, workmanager-task, sealed-result. Pass any topic keyword or call with no topic to list all patterns.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| topic | No | Pattern name or keyword. E.g. 'coroutines', 'compose state', 'room', 'hilt'. Leave empty to list all. |