CtrlK
BlogDocsLog inGet started
Tessl Logo

android-legacy-state

Integrate ViewModel state with XML Views using Coroutines and Lifecycle on Android. Use when managing state with repeatOnLifecycle or lifecycle-aware coroutines in Fragment/Activity; defer Compose state and generic Flow design to their specific skills.

66

Quality

81%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide

SecuritybySnyk

Passed

No findings from the security scan

SKILL.md
Quality
Evals
Security

Android Legacy State Standards

Priority: P1 (HIGH)

Implementation Guidelines

Flow Consumption

  • Rule: ALWAYS use repeatOnLifecycle(Lifecycle.State.STARTED) to collect flows in Views.
  • Why: Prevents crashes (collecting while view 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

  • Flow Consumption Template
Repository
HoangNguyen0403/agent-skills-standard
Last updated
First committed

Is this your skill?

If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.