AGENT SKILL

vkpriyesh__ai-stuff__mobile-apps__.claude__skills__android__compose-ui

暂无简介

License 许可
MIT
最近更新
2026-09-22
Stars
★ 0
Forks
0

03 SKILL.md 正文

Android Compose UI Skill

Purpose

Create declarative UI components and screens using Jetpack Compose.

Standards

  • No Business Logic: Composables should only render state and emit events.
  • State Hoisting: State goes up, events go down.
  • Previews: Include @Preview for multiple configurations (Light/Dark, Font Scale).

Architecture

  • ScreenComposable: Receives UiState and (Event) -> Unit lambda.
  • ViewModel: Exposes StateFlow<UiState>.

Pattern

@Composable
fun MyScreen(viewModel: MyViewModel = hiltViewModel()) {
    val state by viewModel.uiState.collectAsStateWithLifecycle()
    MyScreenContent(state = state, onEvent = viewModel::onEvent)
}

@Composable
fun MyScreenContent(state: MyUiState, onEvent: (MyEvent) -> Unit) {
    // UI Implementation
}

Checklist

  • [ ] Remember to use remember and rememberSaveable.
  • [ ] Handle configuration changes.
  • [ ] Handle Loading, Error, and Empty states visually.
  • [ ] Accessibility: Set contentDescription, support larger fonts.

04 同仓库更多 Skills