Compose ui

From hanamizuki/solopreneur · View interactive version

Compose ui is an AI agent skill from the GitHub repository hanamizuki/solopreneur. Best practices for building UI with Jetpack Compose, focusing on state hoisting, detailed performance optimizations, and theming. Use this when writing or refactoring Composable functions.

How to use this skill

Skill file

Jetpack Compose Best Practices

Instructions

Follow these guidelines to create performant, reusable, and testable Composables.

1. State Hoisting (Unidirectional Data Flow)

Make Composables stateless whenever possible by moving state to the caller.

```kotlin

@Composable

fun MyComponent(

value: String, // State flows down

onValueChange: (String) -> Unit, // Events flow up

modifier: Modifier = Modifier // Standard modifier parameter

)

```

2. Modifiers

3. Performance Optimization

```kotlin

val showButton by remember {

derivedStateOf { listState.firstVisibleItemIndex > 0 }

}

```

4. Theming and Resources

5. Previews

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.