android-compose-performance
Installation
SKILL.md
Android Compose & Kotlin Performance
Workflow
-
Identify the problem area:
- Compose UI jank / recomposition → See references/compose.md
- Coroutine communication / threading → See references/coroutines.md
-
Apply targeted fixes using the patterns in the relevant reference file.
-
Verify in release mode — debug builds disable Compose compiler optimizations and skippability, making profiling unreliable.
Quick Reference: Most Common Mistakes
Compose
- Reading state in parent when only child needs it — pass
() -> Tlambdas instead - Using
List/Map/Setparams (unstable) — usekotlinx.collections.immutableor@Immutable - Missing
keyinLazyColumn/LazyRowitems - Using
Modifier.offset(x, y)instead ofModifier.offset { IntOffset(x, y) }for animated values - Sorting/filtering inside composables instead of ViewModel
- Profiling in debug builds
Coroutines
- Using
GlobalScopeinstead ofviewModelScope/lifecycleScope - Using
synchronized/ReentrantLockinstead ofMutex.withLockin coroutine code - Collecting
StateFlowwithoutrepeatOnLifecycleorcollectAsStateWithLifecycle() - Using
ChannelwhenSharedFlowis appropriate (one-to-many) or vice versa - Running IO work on
Dispatchers.DefaultorDispatchers.Main
Recommended Architecture
- ViewModel:
MutableStateFlowfor UI state, exposed asStateFlow. Logic inviewModelScope. - Repository/data layer:
withContext(Dispatchers.IO)for disk/network. ExposeFlow. - Compose UI: Collect via
collectAsStateWithLifecycle(). Defer reads via lambdas. Use stable types. Provide keys to lazy layouts. - Cross-coroutine:
Channelfor one-to-one delivery,SharedFlowfor one-to-many broadcast. - Synchronization:
Mutex.withLockoversynchronizedin coroutine code.
Weekly Installs
2
Repository
hexoplon/skillsFirst Seen
Feb 9, 2026
Security Audits
Installed on
amp2
gemini-cli2
github-copilot2
codex2
kimi-cli2
opencode2