compose-multiplatform-patterns

Implement cross-platform Compose UI patterns with ViewModel, StateFlow, and Material 3 theming.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/Maelwalser/claude-config --skill compose-multiplatform-patterns-maelwalser
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: compose-multiplatform-patterns
Source: https://github.com/Maelwalser/claude-config/tree/main/skills/compose-multiplatform-patterns
Command: npx skills add https://github.com/Maelwalser/claude-config --skill compose-multiplatform-patterns-maelwalser

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides practical patterns and guidance to build consistent, reusable UI across Android, iOS, Desktop, and Web using Compose Multiplatform and Jetpack Compose, reducing duplication, lifecycle bugs, and platform-specific divergence.

Core Features & Use Cases

  • State management: Single immutable state objects exposed via StateFlow and managed in ViewModel for predictable UI updates.
  • Navigation: Type-safe route objects and dialog/bottom-sheet overlay patterns for clear navigation flows across platforms.
  • Composable design & theming: Slot-based APIs, proper modifier ordering, and Material 3 dynamic theming for reusable design systems.
  • Performance: Stability annotations, correct use of keys in lazy lists, derivedStateOf to defer reads, and allocation avoidance in recomposition.
  • KMP platform integration: expect/actual composables for platform-specific UI needs while keeping shared logic in commonMain.
  • Use Case: Implement a cross-platform item list screen with a shared ViewModel, platform-specific status bar handling, and consistent theming across Android, iOS, Desktop, and Web.

Quick Start

Add a single-screen ViewModel exposing a StateFlow, collect it in your composable with collectAsStateWithLifecycle, and use expect/actual for any platform-specific composables.

Frequently Asked Questions about compose-multiplatform-patterns

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

FAQPage Schema
How do I manage state in Jetpack Compose Multiplatform using ViewModel and StateFlow?

Manage state in Compose Multiplatform by exposing a single immutable state object via StateFlow in a shared ViewModel, then collect it in your composable using collectAsStateWithLifecycle for predictable UI updates across platforms.

What is the best way to handle navigation in Compose Multiplatform?

The best way to handle navigation in Compose Multiplatform is using type-safe route objects combined with dialog and bottom-sheet overlay patterns to maintain clear navigation flows across Android, iOS, Desktop, and Web.

How do I use expect and actual composables for platform-specific UI in KMP?

Use expect/actual composables in KMP by declaring expected composable signatures in commonMain and providing actual implementations for platform-specific UI needs, keeping shared logic centralized while enabling native integration.

Why does my Compose Multiplatform UI suffer from unnecessary recompositions?

Unnecessary recompositions in Compose Multiplatform often occur due to missing stability annotations, incorrect keys in lazy lists, or improper allocation handling. Apply stability annotations, use derivedStateOf to defer reads, and avoid allocations to optimize recomposition performance.

Can I build a shared item list screen for Android and iOS with Compose Multiplatform?

You can build a shared cross-platform item list screen for Android and iOS using Compose Multiplatform by implementing a shared ViewModel, platform-specific status bar handling via expect/actual, and consistent Material 3 theming.

Does Compose Multiplatform support Material 3 dynamic theming across all platforms?

Compose Multiplatform supports Material 3 dynamic theming across Android, iOS, Desktop, and Web, enabling consistent design systems and reusable composables through slot-based APIs and proper modifier ordering.