Agent skill
kotlin-compose
Jetpack Compose - composables, state, effects, theming
Stars
6
Forks
1
Install this agent skill to your Project
npx add-skill https://github.com/pluginagentmarketplace/custom-plugin-kotlin/tree/main/skills/kotlin-compose
SKILL.md
Kotlin Compose Skill
Build modern UIs with Jetpack Compose declarative patterns.
Topics Covered
State Management
kotlin
@Composable
fun Counter() {
var count by remember { mutableIntStateOf(0) }
Button(onClick = { count++ }) { Text("Count: $count") }
}
// Derived state
val isValid by remember { derivedStateOf { email.isNotBlank() && password.length >= 8 } }
Side Effects
kotlin
@Composable
fun UserScreen(userId: String) {
LaunchedEffect(userId) {
viewModel.loadUser(userId)
}
DisposableEffect(Unit) {
val listener = viewModel.addListener()
onDispose { listener.remove() }
}
}
Modifiers
kotlin
Box(
modifier = Modifier
.fillMaxSize()
.padding(16.dp)
.background(MaterialTheme.colorScheme.surface)
.clickable { onClick() }
)
Material 3 Theming
kotlin
@Composable
fun AppTheme(content: @Composable () -> Unit) {
val colorScheme = if (isSystemInDarkTheme()) darkColorScheme() else lightColorScheme()
MaterialTheme(colorScheme = colorScheme, typography = Typography, content = content)
}
Troubleshooting
| Issue | Resolution |
|---|---|
| Infinite recomposition | Use remember or derivedStateOf |
| State lost on rotation | Use rememberSaveable or ViewModel |
Usage
Skill("kotlin-compose")
Didn't find tool you were looking for?