compose-state-holder-ui-split

Separate state-holder wiring from UI rendering in Jetpack Compose screens.

1|Updated Apr 2, 2026
One-click install
npx skills add https://github.com/leogallego/ansible-jane --skill compose-state-holder-ui-split-leogallego
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: compose-state-holder-ui-split
Source: https://github.com/leogallego/ansible-jane/tree/main/skills/compose-state-holder-ui-split
Command: npx skills add https://github.com/leogallego/ansible-jane --skill compose-state-holder-ui-split-leogallego

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Separate state-holder wiring from UI rendering in Jetpack Compose screens, enabling easier preview, testability, and reuse across Android, Desktop, and multiplatform targets.

Core Features & Use Cases

  • Public state-holder composable that wires to a ViewModel, component, navigator, or repository, while the UI composable renders plain UI state and callbacks.
  • Collects state and side effects in the state holder, preventing business logic from leaking into UI code.
  • Improves testability, DI independence, and layout reusability by isolating state management from layout.

Quick Start

Create a small public state-holder composable exposing a UI state and events, then render a separate plain UI composable that consumes that state.

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 decouple state management from UI rendering in Jetpack Compose?

Decoupling state management from UI rendering in Jetpack Compose involves introducing a dedicated state-holder composable that wires to a ViewModel while a separate plain UI composable renders layout, improving testability and reuse across Android and multiplatform targets.

Why does business logic leak into my Jetpack Compose UI code?

Business logic leaks into Jetpack Compose UI code when state and side effects are collected directly inside layout composables, which you prevent by collecting them in a dedicated state-holder composable that exposes plain UI state and callbacks.

What's the best way to separate state wiring from layout in Android Kotlin Compose screens?

Separating state wiring from layout in Android Kotlin Compose screens is best done by creating a small public state-holder composable that handles ViewModel connections and side effects, rendering a plain UI composable that only consumes plain UI state and navigation callbacks.

Can I use a state-holder pattern to improve Compose UI testability and preview?

Using a state-holder pattern improves Compose UI testability and preview by isolating state management from layout, allowing the plain UI composable to render independently of dependency injection and ViewModel wiring for direct testing.

Does this Compose state-holder approach work with Android multiplatform targets?

This Compose state-holder approach works with Android multiplatform targets by isolating state management from layout, enabling the plain UI composable to render consistently across Android, Desktop, and other multiplatform environments without business logic dependencies.

When should I not use a separate state-holder composable in Jetpack Compose?

You should not use a separate state-holder composable in Jetpack Compose for simple screens lacking ViewModels, navigators, or side effects, as the added architectural overhead provides little value without complex state wiring to isolate.