compose-side-effects

Route Jetpack Compose side effects to appropriate effect APIs.

908|42|Updated May 12, 2026
One-click install
npx skills add https://github.com/chrisbanes/skills --skill compose-side-effects-chrisbanes
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: compose-side-effects
Source: https://github.com/chrisbanes/skills/tree/main/skills/compose-side-effects
Command: npx skills add https://github.com/chrisbanes/skills --skill compose-side-effects-chrisbanes

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Coordinate side effects in Jetpack Compose by routing outside-world work to the appropriate effect APIs, ensuring lifecycle safety and predictable UI behavior.

Core Features & Use Cases

  • Use LaunchedEffect, DisposableEffect, and SideEffect to manage side work tied to recompositions and lifecycle changes.
  • Employ rememberCoroutineScope for event-driven suspending work and rememberUpdatedState for stable callbacks without restarting effects.
  • Safely collect Flows with LaunchedEffect and snapshotFlow, and ensure proper registration/cleanup with DisposableEffect.

Quick Start

Add a LaunchedEffect block keyed to the relevant state to perform side effects after recomposition.

Frequently Asked Questions about compose-side-effects

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I manage Jetpack Compose side effects safely across lifecycle changes?

Manage Jetpack Compose side effects by routing outside-world work to effect APIs like LaunchedEffect and DisposableEffect, ensuring lifecycle safety and predictable UI behavior during recompositions.

When should I use rememberCoroutineScope instead of LaunchedEffect in Compose?

Use rememberCoroutineScope for event-driven suspending work triggered by user interactions, whereas LaunchedEffect handles side work tied directly to recomposition lifecycle state and specific state keys.

What's the best way to collect Flows safely in Jetpack Compose?

Safely collect Flows in Jetpack Compose using LaunchedEffect combined with snapshotFlow, ensuring collection respects the composition lifecycle and automatically cancels when the composition leaves.

How do I update callbacks in Compose without restarting a LaunchedEffect?

Use rememberUpdatedState to capture stable callback references inside a LaunchedEffect, allowing state updates to flow without restarting the effect or canceling its ongoing suspending work.

Why does my DisposableEffect cleanup code not run when the Compose screen exits?

DisposableEffect cleanup requires correct lifecycle keys; if the key changes or composition leaves, ensure proper registration and cleanup patterns execute to avoid leaking outside-world resources.

Does Jetpack Compose SideEffect run on every recomposition?

Yes, SideEffect runs after every successful recomposition to publish state changes to non-Compose code, making it distinct from LaunchedEffect which only runs when its keyed state changes.