compose-state-holder-ui-split

compose-state-holder-ui-split is a skill for Claude Code, Codex from ashtanko/compose-android-template. It costs 43 tokens per session (1,557 once invoked), scanned A, original, MIT.

A Jetpack Compose design pattern that separates screen wiring from UI drawing. One composable connects to a ViewModel or other state holder, while another receives plain UI state and callbacks and renders the layout.

In plain words
What is it for?
Use it when a Compose screen collects state, handles navigation or side effects, or passes a ViewModel, controller, or service directly into layout code.
Why use it?
Separating these responsibilities makes screens easier to preview, test, reuse, and move across Android, Desktop, TV, or Kotlin Multiplatform targets. It avoids requiring the full app stack just to test a layout.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/ashtanko/compose-android-template/compose-state-holder-ui-split
Any agent
npx skills add ashtanko/compose-android-template --skill compose-state-holder-ui-split
Clone the repo
git clone --depth 1 https://github.com/ashtanko/compose-android-template

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for compose-state-holder-ui-split

README.md
[![agentmods](https://agentmods.dev/badge/skills/ashtanko/compose-android-template/compose-state-holder-ui-split.svg)](https://agentmods.dev/skills/ashtanko/compose-android-template/compose-state-holder-ui-split)
Your own site
<a href="https://agentmods.dev/skills/ashtanko/compose-android-template/compose-state-holder-ui-split"><img src="https://agentmods.dev/badge/skills/ashtanko/compose-android-template/compose-state-holder-ui-split.svg" alt="Measured on agentmods" height="20"></a>
Per session 43 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,557 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00043 $0.01557
Opus 5 $0.00022 $0.00779
Sonnet 5 $0.00009 $0.00311
Haiku 4.5 $0.00004 $0.00156

Measured 4d ago against content hash 53df7528b7f6, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

compose-state-holder-ui-split scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/skills/compose-state-holder-ui-split/SKILL.md · 157 lines

How it starts

The opening of the file, as written. The whole thing — 157 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Compose: state holder/UI split

Core principle

Separate state-holder wiring from UI rendering. The state-holder composable talks to ViewModels, components, flows, navigation, and side effects. The UI composable takes plain immutable UI state plus callbacks and describes layout.

This keeps screens previewable, testable, and easier to reuse across Android, Desktop, TV, and KMP/CMP targets.

When to use this skill

Use this when a Compose screen:

  • Takes a ViewModel, component, controller, navigator, repository, or service directly.
  • Collects app/business state or side effects in the same function that lays out most UI.
  • Passes a whole state holder into child composables instead of explicit state and callbacks.
  • Is hard to preview because it needs dependency injection, navigation, lifecycle, or fake services.
  • Has UI tests that must construct a full app stack to verify a simple layout branch.

The pattern

Use a small public state-holder composable:

@Composable
fun ProfileScreen(component: ProfileComponent, modifier: Modifier = Modifier) {
    val state by component.state.collectAsStateWithLifecycle()

    ProfileScreen(
        state = state,
        onNameChange = component::onNameChange,
        onSaveClick = component::save,
        onBackClick = component::back,
        modifier = modifier,
    )
}

Then put UI in a plain composable that knows nothing about the state holder:

@Composable
fun ProfileScreen(
    state: ProfileUiState,
    onNameChange: (String) -> Unit,
    onSaveClick: () -> Unit,
    onBackClick: () -> Unit,
    modifier: Modifier = Modifier,
) {
    ProfileContent(
        name = state.name,
        isSaving = state.isSaving,
        canSave = state.canSave,
        onNameChange = onNameChange,
        onSaveClick = onSaveClick,
        onBackClick = onBackClick,
        modifier = modifier,
    )
}

Private content functions can break up layout:

@Composable
private fun ProfileContent(
    name: String,
    isSaving: Boolean,
    canSave: Boolean,
    onNameChange: (String) -> Unit,
    onSaveClick: () -> Unit,
    onBackClick: () -> Unit,
    modifier: Modifier = Modifier,
) {
    // Layout only.
}

Read the full file on GitHub · 157 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 157 lines · 43 tokens per session scan A 53df7528b7f6

Subscribe to this mod's changes

compose-state-holder-ui-split is a skill published in the GitHub repository ashtanko/compose-android-template (10 stars, last pushed today), licensed MIT. It adds 43 tokens to every session and 1,557 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

sceneview-web

Build 3D and WebXR (AR/VR) experiences in the browser with SceneView for Web — Filament.js (WebGL2/WASM) wrapped in a Kotlin/JS DSL and a plain-JavaScript API on window.sceneview. Use whenever the user asks for "3D in the browser", "a web model viewer", "WebXR AR/VR", or any browser 3D/AR app where the dependency is…

sceneview/sceneview · 147 tokens

sceneview

Build 3D and AR apps with the SceneView SDK in Jetpack Compose, SwiftUI (iOS/macOS/visionOS via SceneViewSwift), Web (Filament.js), Flutter and React Native. Use whenever the user asks for "3D in Compose", "AR with ARCore in Compose", a model viewer, or any cross-platform 3D/AR app where the dependency is…

sceneview/sceneview · 156 tokens

to-plan

Use when one ready GitHub issue or an in-chat task needs a repository-aware implementation plan for a later implementation workflow.

chrisbanes/skills · 27 tokens

compose-animations

Use when writing or reviewing Jetpack Compose motion: visibility enter/exit, animating one property toward a target, color or size transitions, multiple properties from one state, switching composable content, or choosing between AnimatedVisibility, animateAsState, rememberTransition, AnimatedContent, and Crossfade.

chrisbanes/skills · 64 tokens

compose-focus-navigation

Use when writing or reviewing Jetpack Compose UI for TV, keyboard, desktop, accessibility focus, D-pad navigation, FocusRequester, focusProperties, key events, or initial focus behavior.

chrisbanes/skills · 41 tokens

kotlin-control-flow

Use when writing or reviewing Kotlin branching and control flow: when expressions, guard conditions, sealed type exhaustiveness, smart casts, nullable branching, early returns, or replacing complex if/else chains.

chrisbanes/skills · 44 tokens