compose-state-holder-ui-split

Separate Compose state-holder wiring from UI rendering into distinct composables.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/soygabimoreno/Los-ANDROIDES --skill compose-state-holder-ui-split
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: compose-state-holder-ui-split
Source: https://github.com/soygabimoreno/Los-ANDROIDES/tree/main/.agents/skills/compose-state-holder-ui-split
Command: npx skills add https://github.com/soygabimoreno/Los-ANDROIDES --skill compose-state-holder-ui-split

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It solves the problem of Compose screens becoming tightly coupled to ViewModels, navigation, and side effects, making them hard to preview and test.

Core Features & Use Cases

  • State-holder vs UI split: Keep wiring and state/effect collection in a dedicated composable, while layout lives in a plain UI composable.
  • Preview-friendly UI: Build a UI layer that only depends on immutable UI state and callback lambdas.
  • Cleaner testing strategy: Test layout branches by supplying plain state and callbacks instead of constructing the full app graph.

Quick Start

Create a small state-holder composable that collects state/effects from your component or ViewModel, then pass plain ui state and event callbacks into a separate UI composable that renders the screen layout.

Frequently Asked Questions about compose-state-holder-ui-split

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

FAQPage Schema
How do I make Jetpack Compose screens previewable and testable?

To make Jetpack Compose screens previewable and testable, split your code into a state-holder composable for wiring and a UI composable that only accepts immutable state and callbacks, decoupling layout from ViewModels and side effects.

What is the state-holder pattern in Jetpack Compose UI architecture?

The state-holder pattern in Jetpack Compose UI architecture separates state and side-effect collection from layout rendering. A dedicated composable handles ViewModel wiring, while a plain UI composable renders layout using only immutable state.

How to test Compose UI layout branches without constructing the full app graph?

To test Compose UI layout branches without the full app graph, supply plain immutable UI state and callback lambdas directly to a decoupled UI composable, bypassing ViewModel dependencies and navigation side effects entirely.

Can I use Jetpack Compose Preview with ViewModel collection and one-shot effects?

Yes, you can use Jetpack Compose Preview by isolating ViewModel collection and one-shot effects in a state-holder composable, allowing the separate UI composable to render previews using static, immutable state inputs.

Why does my Jetpack Compose screen fail to render in Preview?

A Jetpack Compose screen fails to render in Preview when the UI composable is tightly coupled to ViewModels, navigation, or side effects. Moving this wiring into a state-holder composable fixes the issue by enabling stateless rendering.

Best way to handle navigation and snackbars in Compose while keeping UI testable?

The best way to handle navigation and snackbars while keeping Compose UI testable is routing these side effects through a state-holder composable, passing only necessary event callbacks to a stateless UI composable for rendering.