agentsclimarketplace

Android legacy state

Skill ComeOnOliver/skillshub/skills/HoangNguyen0403/agent-skills-standard/android-legacy-state

Standards for State integration with Views using Coroutines and Lifecycle. Use when managing state with ViewModels and Lifecycle-aware coroutines in Android. (triggers: **/*Fragment.kt, **/*Activity.kt, repeatOnLifecycle, launchWhenStarted)From its SKILL.md

Install
npx -y skills add ComeOnOliver/skillshub --skill android-legacy-state

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

SKILL.md

1.0 KB, 164 tokens by cl100k_base, as published. Nobody here has run it

Android Legacy State Standards

Priority: P1

Implementation Guidelines

Flow Consumption

  • Rule: ALWAYS use repeatOnLifecycle(Lifecycle.State.STARTED) to collect flows in Views.
  • Why: Prevents crashes (collecting while view is destroyed) and saves resources (stops collecting in background).

LiveData vs Flow

  • New Code: Use StateFlow exclusively.
  • Legacy: If using LiveData, observe with viewLifecycleOwner (Fragment), NOT this.

Anti-Patterns

  • No launchWhenStarted/Resumed: Deprecated. Use repeatOnLifecycle instead.
  • No observe(this) in Fragments: Use viewLifecycleOwner to prevent lifecycle leaks.

References

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.