{"id":"bc294aa6-436a-4311-b4f3-9d74feb677d3","shortId":"skZB6h","kind":"skill","title":"android-state-management","tagline":"Model screen state, events, reducers, and side effects for Android UIs with predictable lifecycle-aware ownership.","description":"# Android State Management\n\n## When To Use\n- Use this skill when the request is about: android ui state reducer, state management in compose or xml android, one-off events in android screen.\n- Primary outcome: Model screen state, events, reducers, and side effects for Android UIs with predictable lifecycle-aware ownership.\n- Handoff skills when the scope expands:\n- `android-coroutines-flow`\n- `android-ui-states-validation`\n\n## Workflow\n1. Confirm the user-visible journey, target device behavior, and failure states that matter.\n2. Identify the owning screens, activities, destinations, and state holders for the flow.\n3. Implement the flow with explicit loading, success, empty, and error handling.\n4. Validate accessibility, configuration changes, and back-stack behavior in the showcase apps.\n5. Escalate data, architecture, or release concerns to the specialized skills called out in the handoff notes.\n\n## Guardrails\n- Treat loading, empty, error, offline, and permission-denied states as first-class UI states.\n- Do not hide navigation or permission side effects inside reusable UI components.\n- Prefer lifecycle-aware APIs over manual callback chains.\n- Keep deep links, intents, and permission prompts testable and observable.\n\n## Anti-Patterns\n- Assuming the happy path is enough for product flows.\n- Hard-coding request codes or route strings in multiple places.\n- Triggering navigation directly from repositories or network layers.\n- Shipping flows without recovery UI for denied permissions or broken state.\n\n## Remediation Examples\n### Keep one immutable UI state surface\n```kotlin\ndata class TaskBoardState(\n    val tasks: List<TaskUiModel> = emptyList(),\n    val isLoading: Boolean = false,\n    val errorMessage: String? = null,\n)\n```\n\n### Separate persistent state from one-off events\n```kotlin\nprivate val _uiState = MutableStateFlow(TaskBoardState())\nval uiState: StateFlow<TaskBoardState> = _uiState.asStateFlow()\n\nprivate val _events = MutableSharedFlow<TaskBoardEvent>(replay = 0)\nval events: SharedFlow<TaskBoardEvent> = _events\n```\n\n### Reduce state updates instead of mutating UI directly\n```kotlin\n_uiState.update { state ->\n    state.copy(isLoading = false, tasks = refreshedTasks, errorMessage = null)\n}\n```\n\n## Examples\n### Happy path\n- Scenario: Drive the Compose task board from a single immutable screen state.\n- Command: `cd examples/orbittasks-compose && ./gradlew :app:testDebugUnitTest`\n\n### Edge case\n- Scenario: Represent permission denied and sync failed states explicitly in the XML fixture.\n- Command: `cd examples/orbittasks-xml && ./gradlew :app:testDebugUnitTest`\n\n### Failure recovery\n- Scenario: Separate state requests from coroutines, navigation, and UI validation prompts.\n- Command: `python3 scripts/eval_triggers.py --skill android-state-management`\n\n## Done Checklist\n- The implementation path is explicit, minimal, and tied to the right Android surface.\n- Relevant example commands and benchmark prompts have been exercised or updated.\n- Handoffs to adjacent skills are documented when the request crosses boundaries.\n- Official references cover the chosen pattern and the main migration or troubleshooting path.\n\n## Official References\n- [https://developer.android.com/topic/architecture/ui-layer/state-production](https://developer.android.com/topic/architecture/ui-layer/state-production)\n- [https://developer.android.com/topic/architecture/ui-layer/events](https://developer.android.com/topic/architecture/ui-layer/events)\n- [https://developer.android.com/topic/libraries/architecture/viewmodel](https://developer.android.com/topic/libraries/architecture/viewmodel)\n- [https://developer.android.com/jetpack/compose/state](https://developer.android.com/jetpack/compose/state)","tags":["android","state","management","agent","skills","krutikjain","agent-skills","android-development","android-skills","androidx","claude-code","codex"],"capabilities":["skill","source-krutikjain","skill-android-state-management","topic-agent-skills","topic-android","topic-android-development","topic-android-skills","topic-androidx","topic-claude-code","topic-codex","topic-cursor","topic-jetpack-compose","topic-kotlin","topic-skills"],"categories":["android-agent-skills"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/krutikJain/android-agent-skills/android-state-management","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add krutikJain/android-agent-skills","source_repo":"https://github.com/krutikJain/android-agent-skills","install_from":"skills.sh"}},"qualityScore":"0.454","qualityRationale":"deterministic score 0.45 from registry signals: · indexed on github topic:agent-skills · 8 github stars · SKILL.md body (3,734 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-05-18T19:13:29.009Z","embedding":null,"createdAt":"2026-05-18T13:20:52.007Z","updatedAt":"2026-05-18T19:13:29.009Z","lastSeenAt":"2026-05-18T19:13:29.009Z","tsv":"'/gradlew':338,359 '/jetpack/compose/state](https://developer.android.com/jetpack/compose/state)':446 '/topic/architecture/ui-layer/events](https://developer.android.com/topic/architecture/ui-layer/events)':440 '/topic/architecture/ui-layer/state-production](https://developer.android.com/topic/architecture/ui-layer/state-production)':437 '/topic/libraries/architecture/viewmodel](https://developer.android.com/topic/libraries/architecture/viewmodel)':443 '0':297 '1':89 '2':104 '3':117 '4':129 '5':143 'access':131 'activ':109 'adjac':411 'android':2,14,22,36,46,52,65,80,84,380,396 'android-coroutines-flow':79 'android-state-manag':1,379 'android-ui-states-valid':83 'anti':209 'anti-pattern':208 'api':193 'app':142,339,360 'architectur':146 'assum':211 'awar':20,71,192 'back':136 'back-stack':135 'behavior':98,138 'benchmark':402 'board':328 'boolean':268 'boundari':419 'broken':248 'call':154 'callback':196 'case':342 'cd':336,357 'chain':197 'chang':133 'checklist':384 'chosen':424 'class':174,260 'code':222,224 'command':335,356,375,400 'compon':188 'compos':43,326 'concern':149 'configur':132 'confirm':90 'coroutin':81,369 'cover':422 'cross':418 'data':145,259 'deep':199 'deni':169,245,346 'destin':110 'developer.android.com':436,439,442,445 'developer.android.com/jetpack/compose/state](https://developer.android.com/jetpack/compose/state)':444 'developer.android.com/topic/architecture/ui-layer/events](https://developer.android.com/topic/architecture/ui-layer/events)':438 'developer.android.com/topic/architecture/ui-layer/state-production](https://developer.android.com/topic/architecture/ui-layer/state-production)':435 'developer.android.com/topic/libraries/architecture/viewmodel](https://developer.android.com/topic/libraries/architecture/viewmodel)':441 'devic':97 'direct':233,309 'document':414 'done':383 'drive':324 'edg':341 'effect':12,63,184 'empti':125,163 'emptylist':265 'enough':216 'error':127,164 'errormessag':271,318 'escal':144 'event':8,50,59,281,294,299,301 'exampl':251,320,399 'examples/orbittasks-compose':337 'examples/orbittasks-xml':358 'exercis':406 'expand':78 'explicit':122,351,389 'fail':349 'failur':100,362 'fals':269,315 'first':173 'first-class':172 'fixtur':355 'flow':82,116,120,219,240 'guardrail':160 'handl':128 'handoff':73,158,409 'happi':213,321 'hard':221 'hard-cod':220 'hide':179 'holder':113 'identifi':105 'immut':254,332 'implement':118,386 'insid':185 'instead':305 'intent':201 'isload':267,314 'journey':95 'keep':198,252 'kotlin':258,282,310 'layer':238 'lifecycl':19,70,191 'lifecycle-awar':18,69,190 'link':200 'list':264 'load':123,162 'main':428 'manag':4,24,41,382 'manual':195 'matter':103 'migrat':429 'minim':390 'model':5,56 'multipl':229 'mutablesharedflow':295 'mutablestateflow':286 'mutat':307 'navig':180,232,370 'network':237 'note':159 'null':273,319 'observ':207 'offici':420,433 'offlin':165 'one':48,253,279 'one-off':47,278 'outcom':55 'own':107 'ownership':21,72 'path':214,322,387,432 'pattern':210,425 'permiss':168,182,203,246,345 'permission-deni':167 'persist':275 'place':230 'predict':17,68 'prefer':189 'primari':54 'privat':283,292 'product':218 'prompt':204,374,403 'python3':376 'recoveri':242,363 'reduc':9,39,60,302 'refer':421,434 'refreshedtask':317 'releas':148 'relev':398 'remedi':250 'replay':296 'repositori':235 'repres':344 'request':33,223,367,417 'reusabl':186 'right':395 'rout':226 'scenario':323,343,364 'scope':77 'screen':6,53,57,108,333 'scripts/eval_triggers.py':377 'separ':274,365 'sharedflow':300 'ship':239 'showcas':141 'side':11,62,183 'singl':331 'skill':30,74,153,378,412 'skill-android-state-management' 'source-krutikjain' 'special':152 'stack':137 'state':3,7,23,38,40,58,86,101,112,170,176,249,256,276,303,312,334,350,366,381 'state.copy':313 'stateflow':290 'string':227,272 'success':124 'surfac':257,397 'sync':348 'target':96 'task':263,316,327 'taskboardst':261,287 'testabl':205 'testdebugunittest':340,361 'tie':392 'topic-agent-skills' 'topic-android' 'topic-android-development' 'topic-android-skills' 'topic-androidx' 'topic-claude-code' 'topic-codex' 'topic-cursor' 'topic-jetpack-compose' 'topic-kotlin' 'topic-skills' 'treat':161 'trigger':231 'troubleshoot':431 'ui':15,37,66,85,175,187,243,255,308,372 'uistat':285,289 'uistate.asstateflow':291 'uistate.update':311 'updat':304,408 'use':27,28 'user':93 'user-vis':92 'val':262,266,270,284,288,293,298 'valid':87,130,373 'visibl':94 'without':241 'workflow':88 'xml':45,354","prices":[{"id":"6538e754-b3d1-4ad1-910c-9da7bf57a94b","listingId":"bc294aa6-436a-4311-b4f3-9d74feb677d3","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"krutikJain","category":"android-agent-skills","install_from":"skills.sh"},"createdAt":"2026-05-18T13:20:52.007Z"}],"sources":[{"listingId":"bc294aa6-436a-4311-b4f3-9d74feb677d3","source":"github","sourceId":"krutikJain/android-agent-skills/android-state-management","sourceUrl":"https://github.com/krutikJain/android-agent-skills/tree/main/skills/android-state-management","isPrimary":false,"firstSeenAt":"2026-05-18T13:20:52.007Z","lastSeenAt":"2026-05-18T19:13:29.009Z"}],"details":{"listingId":"bc294aa6-436a-4311-b4f3-9d74feb677d3","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"krutikJain","slug":"android-state-management","github":{"repo":"krutikJain/android-agent-skills","stars":8,"topics":["agent-skills","android","android-development","android-skills","androidx","claude-code","codex","cursor","jetpack-compose","kotlin","skills"],"license":"mit","html_url":"https://github.com/krutikJain/android-agent-skills","pushed_at":"2026-03-25T05:47:20Z","description":"Android skills repository for Kotlin, Compose, XML, testing, CI, release work, and legacy upgrades","skill_md_sha":"600e2927c50966c3eca640f868563f33dd9425f6","skill_md_path":"skills/android-state-management/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/krutikJain/android-agent-skills/tree/main/skills/android-state-management"},"layout":"multi","source":"github","category":"android-agent-skills","frontmatter":{"name":"android-state-management","description":"Model screen state, events, reducers, and side effects for Android UIs with predictable lifecycle-aware ownership."},"skills_sh_url":"https://skills.sh/krutikJain/android-agent-skills/android-state-management"},"updatedAt":"2026-05-18T19:13:29.009Z"}}