compose-ui

Guide Jetpack Compose UI development with state hoisting and performance optimizations.

10.4k|519|Updated Apr 15, 2023
One-click install
npx skills add https://github.com/maxrave-dev/SimpMusic --skill compose-ui-maxrave-dev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: compose-ui
Source: https://github.com/maxrave-dev/SimpMusic/tree/main/.claude/skills/compose-ui
Command: npx skills add https://github.com/maxrave-dev/SimpMusic --skill compose-ui-maxrave-dev

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides best practices for building efficient, maintainable, and visually consistent user interfaces with Jetpack Compose, addressing common challenges in state management, performance, and theming.

Core Features & Use Cases

  • State Hoisting: Implements unidirectional data flow for better testability and reusability.
  • Modifier Best Practices: Guides on correct modifier usage and ordering for predictable layouts.
  • Performance Optimizations: Details on using remember and derivedStateOf to prevent unnecessary recompositions.
  • Theming & Resources: Encourages the use of MaterialTheme and organized resource management.
  • Previews: Emphasizes the importance of @Preview for rapid UI iteration.
  • Use Case: Refactor a complex screen with multiple stateful components to follow state hoisting principles, improving its performance and making it easier to test individual UI elements.

Quick Start

Apply state hoisting to the UserProfileCard composable by moving its internal state to its parent.

Frequently Asked Questions about compose-ui

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

FAQPage Schema
How do I apply state hoisting in Jetpack Compose to make my UI components testable?

Modifier ordering in Jetpack Compose dictates how layout constraints cascade through the UI tree. Applying modifiers in the correct sequence ensures predictable layouts and prevents unexpected sizing or positioning behavior in your composable functions.

How do I prevent unnecessary recompositions in Jetpack Compose using derivedStateOf?

MaterialTheme in Jetpack Compose centralizes your visual design system, providing consistent typography, colors, and shapes. Applying MaterialTheme ensures your composable functions maintain a unified visual identity across the entire Android UI.

Can I use Jetpack Compose previews to iterate on stateful UI components without running the app?

Yes, Jetpack Compose previews allow rapid UI iteration without running the Android app. By hoisting state out of your composables, you can render multiple visual states of a component directly in the IDE for immediate feedback.

What is the best way to structure Jetpack Compose modifiers for predictable layouts?

The best way to structure Jetpack Compose modifiers is to apply them in a logical order from outer to inner layout constraints. Correct modifier usage ensures predictable layout sizing and prevents unexpected clipping or padding behavior.