compose-ui

Enforce stateless design and state hoisting in Jetpack Compose UIs.

Updated Dec 4, 2025
One-click install
npx skills add https://github.com/thinhtt264/Snaplet-App --skill compose-ui
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: compose-ui
Source: https://github.com/thinhtt264/Snaplet-App/tree/main/.cursor/skills/compose-ui
Command: npx skills add https://github.com/thinhtt264/Snaplet-App --skill compose-ui

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Jetpack Compose is powerful but can become hard to maintain without proper patterns. This Skill provides best practices for stateless UI through state hoisting, proper modifier usage, performance optimizations, and consistent theming to create scalable, testable Composables.

Core Features & Use Cases

  • Stateless by design: push state up to callers and pass down via parameters.
  • Performance tips: remember, derivedStateOf, and stable lambdas to reduce recompositions.
  • Theming guidance: use MaterialTheme.colorScheme and typography; organize shared UI components.

Use cases include creating reusable UI components, refactoring screens to improve testability, and implementing design system components across features.

Quick Start

  • Create a stateless Composable with a value and onValueChange
  • Use modifier: Modifier = Modifier and apply it to the root layout
  • Add remember and derivedStateOf where appropriate
  • Follow MaterialTheme colorScheme and typography guidelines
  • Add private previews for public composables

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 UI components?

State hoisting in Jetpack Compose pushes state up to callers and passes data down via parameters. This stateless design pattern creates scalable, testable Composables by separating state management from UI rendering logic.

What's the best way to optimize Jetpack Compose performance and reduce unnecessary recompositions?

Optimize Jetpack Compose performance by using remember to store values, derivedStateOf to limit recompositions, and stable lambdas. These techniques prevent redundant UI redraws and improve rendering efficiency across app features.

How do I apply MaterialTheme colorScheme and typography to a reusable Composable?

Apply MaterialTheme.colorScheme and typography guidelines to ensure consistent theming across shared UI components. Organize reusable Composables by following Material design standards and adding private previews for public interfaces.

How do I properly use Modifier parameters in reusable Jetpack Compose components?

Proper Modifier usage in Jetpack Compose requires accepting a modifier: Modifier = Modifier parameter and applying it to the root layout. This pattern ensures Composables remain flexible and reusable across different parent layouts.

When do I need derivedStateOf in Jetpack Compose state management?

Use derivedStateOf in Jetpack Compose when a calculated value depends on other states but changes less frequently than its dependencies. This prevents unnecessary recompositions by only triggering updates when the derived result actually changes.

Can I refactor existing Jetpack Compose screens to improve testability using stateless design?

Refactoring Jetpack Compose screens to stateless design improves testability by pushing state up to callers. This separation allows UI components to be tested independently through parameterized value and onValueChange callbacks.