Back to directory

Collecting Flows Safely

Agent skill
1 skill

Use this skill to migrate Compose UI from collectAsState() to collectAsStateWithLifecycle(), hoist Flow parameters out of composables, and apply .conflate() / .distinctUntilChanged() / snapshotFlow so background CPU and battery stop draining and chatty flows stop invalidating the UI per emission. Covers ViewModel StateFlow/SharedFlow consumers, sensor and location streams, and the "Flow as composable parameter" antipattern. Trigger when the user mentions collectAsState, collectAsStateWithLifecycle, lifecycle-aware flow collection, Lifecycle.State.STARTED, background battery drain from a Compose screen, snapshotFlow, Flow parameter on a composable, conflate, or distinctUntilChanged.

Install with
Claude CodeCodexCursorGitHub CopilotGemini CLI

Supported by the Atlas install prompt. Skill-specific requirements vary.

Skill stats

Skills1CategoryGeneralStars0

About this skill

Use this skill to migrate Compose UI from collectAsState() to collectAsStateWithLifecycle(), hoist Flow parameters out of composables, and apply .conflate() / .distinctUntilChanged() / snapshotFlow so background CPU and battery stop draining and chatty flows stop invalidating the UI per emission. Covers ViewModel StateFlow/SharedFlow consumers, sensor and location streams, and the "Flow as composable parameter" antipattern. Trigger when the user mentions collectAsState, collectAsStateWithLifecycle, lifecycle-aware flow collection, Lifecycle.State.STARTED, background battery drain from a Compose screen, snapshotFlow, Flow parameter on a composable, conflate, or distinctUntilChanged.

Quick start

  1. Copy the install prompt. Use the green button above this README.
  2. Send it to your agent. Paste it into your coding agent’s chat and send.
  3. Review the setup. Your agent checks the skill’s instructions, requirements, and installation scope.
Review, license & listing details
Review the source before using this skill

This is an imported listing. We haven’t certified its safety, license, or compatibility. Skills may include executable scripts.

Automated security scan: Partial

Only SKILL.md was scanned. Supporting files and scripts were not checked. No safety grade has been assigned.

0 potential findings · Scanned 11/4/2026 · Scanner 0.2.1

Content SHA-256: 8a90d3f8c95ea6c12838df27e0aad9d893456dbe00602371ddfc6b4a6bdd4b75

About scan coverage and limitations

About this listing

Category
General
Reported license
Apache-2.0
Listing language (estimated)
English
Review status
Not individually reviewed
Agent compatibility
Atlas installation supports Claude Code, Codex, and Cursor. Skill-specific dependencies and features are checked during setup.
Collecting Flows Safely | Agent Skills Atlas