compose-ui

Enforce state hoisting, modifiers, and theming in Jetpack Compose UI.

1|2|Updated Jan 25, 2026
One-click install
npx skills add https://github.com/jhparktime/OnGuard --skill compose-ui-jhparktime
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: compose-ui
Source: https://github.com/jhparktime/OnGuard/tree/main/.claude/skills/compose-ui
Command: npx skills add https://github.com/jhparktime/OnGuard --skill compose-ui-jhparktime

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Enables developers to write performant, reusable Jetpack Compose UI by enforcing state hoisting, proper modifiers, and a consistent theming approach.

Core Features & Use Cases

  • Stateless Composables and Unidirectional Data Flow: Move state up and pass callbacks down to keep components testable.
  • Modifier Best Practices: Always include a default modifier and apply layout-affecting modifiers in the correct order.
  • Performance Optimizations: Use remember, derivedStateOf, and stable lambdas to minimize recompositions.
  • Theming and Design System: Leverage MaterialTheme and a cohesive design language across components.
  • Previews and Testing: Structure shared UI components for previews and maintainable tests.

Quick Start

Apply these Compose UI guidelines to your project by refactoring components to be stateless, wiring them to a ViewModel, and adopting the recommended theming and modifier patterns.

Frequently Asked Questions about compose-ui

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

FAQPage Schema
How do I reduce unnecessary Jetpack Compose recompositions in my Android app?

Reduce Jetpack Compose recompositions by using remember, derivedStateOf, and stable lambdas to optimize performance. This approach minimizes redundant UI redraws by ensuring composables only recompose when their observed state actually changes.

What is state hoisting in Jetpack Compose and when should I apply it?

State hoisting in Jetpack Compose moves state up to the parent while passing callbacks down to child components. Apply this pattern to create stateless, testable composables that follow unidirectional data flow, making your UI components highly reusable.

How do I structure Jetpack Compose modifiers to avoid layout issues?

Structure Jetpack Compose modifiers by including a default modifier parameter and applying layout-affecting modifiers in a specific order. This pattern prevents unexpected layout behaviors and ensures your composable components remain flexible and maintainable.

Can I integrate ViewModel with stateless Compose UI components?

Yes, you can integrate ViewModel with stateless Compose UI components by hoisting state to the ViewModel and passing required data and callbacks down. This architecture maintains unidirectional data flow while keeping your UI components completely stateless.

What is the best way to apply consistent theming across Jetpack Compose screens?

The best way to apply consistent theming across Jetpack Compose screens is leveraging MaterialTheme to establish a cohesive design language. This approach enforces consistent typography, colors, and shapes across all shared UI components.

Why do my Jetpack Compose previews break when refactoring to stateless composables?

Jetpack Compose previews break when stateless composables lack required state parameters. Fix this by passing mock data and state directly into your preview functions, ensuring the shared UI components are structured properly for previews.