android-state
БесплатноБез исполняемых скриптовНе проверенConfigure ViewModel state emission with StateFlow, SharedFlow, and sealed UiState classes in Android. Use for state modeling and sharing policies; defer…
от HoangNguyen0403★ 598 звёзд на GitHubОб этом скилле
Android State Management
Priority: P0 (CRITICAL)
1. Structure ViewModel
- Expose ONE
StateFlow<UiState>via.asStateFlow(). - Use
viewModelScopefor all coroutines. - Trigger initial load in
initblock.
See templates for ViewModel and UiState examples.
2. Define UI State (LCE Pattern)
- Use sealed interface with Loading, Content, Error variants.
- Mark data classes
@Immutable.
See templates for sealed UiState pattern.
3. Collect State Lifecycle-Safely
- Use
collectAsStateWithLifecycle()in Compose. - 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.
Verification
- Each ViewModel exposes exactly one
StateFlow<UiState>. - UiState is a sealed interface with Loading, Content, Error variants.
- UI collects with
collectAsStateWithLifecycle(). -
./gradlew testpasses for ViewModel tests.
References
Установить android-state в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл android-state?
Configure ViewModel state emission with StateFlow, SharedFlow, and sealed UiState classes in Android. Use for state modeling and sharing policies; defer generic lifecycle collection, navigation-event plumbing, Hilt injection, test code, and configuration-change recipes to their specific skills.
Как установить скилл android-state?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл android-state запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic