android-state
FreeNo executable scriptsNot checkedStandards for ViewModel, StateFlow, and UI State Patterns. Use whenever someone works with ViewModel files, asks about UiState sealed classes…
by ComeOnOliver★ 67 GitHub starsAbout this skill
Android State Management
Priority: P0
Implementation Guidelines
ViewModel Pattern
- Exposure: Expose ONE
StateFlow<UiState>via.asStateFlow(). - Scope: Use
viewModelScopefor all coroutines. - Initialization: Trigger initial load in
initorLaunchedEffect(once).
UI State (LCE)
- Type: sealed interface
UiState(Loading, Content, Error). - Immutability: Data classes inside should be
@Immutable.
Flow Lifecycle
- Collection: Use
collectAsStateWithLifecycle()in Compose. - Hot Flows: Use
SharingStarted.WhileSubscribed(5000)for shared resources.
Anti-Patterns
- No LiveData for New Code: Use StateFlow — lifecycle-safe and Compose-compatible.
- No Public MutableStateFlow: Expose only
.asStateFlow()to consumers. - No Context in ViewModel: Leaks Activity. Use Application context if truly needed.
References
Install android-state in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
FAQ
What does the android-state skill do?
Standards for ViewModel, StateFlow, and UI State Patterns. Use whenever someone works with ViewModel files, asks about UiState sealed classes, MutableStateFlow vs LiveData, collectAsStateWithLifecycle, viewModelScope, or exposing state from Android ViewModels — even indirectly. (triggers: **/*ViewModel.kt, **/*UiState.kt, viewmodel, stateflow, livedata, uistate, MutableStateFlow, collectAsState, viewModelScope, UiState)
How do I install the android-state skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the android-state skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
frontend-design
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
by Anthropicwebapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
by Anthropicbrand-guidelines
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
by Anthropicweb-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…
by Anthropic