compose-ui

Implement stateless Jetpack Compose UI components with state hoisting and Modifier guidelines.

Updated Mar 9, 2025
One-click install
npx skills add https://github.com/rock-hu/vitamin-compose --skill compose-ui-rock-hu
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: compose-ui
Source: https://github.com/rock-hu/vitamin-compose/tree/main/.github/skills/compose-ui
Command: npx skills add https://github.com/rock-hu/vitamin-compose --skill compose-ui-rock-hu

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides guidance to help Android developers build robust, reusable UI components with Jetpack Compose by applying state hoisting, proper modifier usage, and consistent theming, reducing churn and bugs in UI code.

Core Features & Use Cases

  • Unidirectional data flow and state hoisting: write stateless Composables that receive values and emit events to callers.
  • Modifier guidelines: always include a default Modifier parameter and apply it to the root layout; understand modifier ordering effects.
  • Performance optimization: leverage remember and derivedStateOf to minimize recompositions and ensure smooth UI.
  • Theming and resources: adopt MaterialTheme colorScheme and typography to maintain visual consistency across features.
  • Previews: provide private previews for public Composables to verify appearance across themes.

Quick Start

Start by converting a stateful Composable to a stateless one, pass state through parameters and emit events to the caller. Add a Modifier parameter with a default value Modifier and apply it to the root layout. Create a private preview for the composable to verify appearance in Light and Dark modes.

Frequently Asked Questions about compose-ui

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

FAQPage Schema
How do I implement state hoisting in Jetpack Compose to create stateless Composables?

Proper Modifier usage in Jetpack Compose requires always including a default Modifier parameter and applying it to the root layout. You must understand modifier ordering effects to ensure UI components render and behave predictably.

How can I optimize Jetpack Compose performance to reduce unnecessary recompositions?

Optimize Jetpack Compose performance by leveraging `remember` and `derivedStateOf` to minimize recompositions. This ensures smooth UI rendering by preventing Composables from recomposing when their inputs remain unchanged.

What is the best way to maintain visual consistency across Jetpack Compose UI features?

Maintain visual consistency across Jetpack Compose UI features by adopting MaterialTheme colorScheme and typography. This approach ensures consistent styling and reduces layout inconsistencies across different application screens.

How do I add accessible previews for public Composables in Jetpack Compose?

Add accessible previews for public Composables by creating private preview functions. This allows you to verify the UI appearance across both Light and Dark themes during development without affecting production code.