affaan-m avatar

Compose Multiplatform Patterns

If you're building Compose UI across Android, iOS, desktop, or web, this covers the patterns you'll actually use: single state objects with StateFlow, type-safe navigation with serializable routes, slot-based composable design, and platform-specific UI with expect/actual. The event sink pattern is smart for screens with lots of user actions, and the performance section gets specific about stable types, derivedStateOf, and lazy list keys. It's opinionated aboutViewModel + StateFlow over raw mutableStateOf and warns against passing NavController down the tree. Most useful when you're past hello world and need to structure a real KMP app with shared UI that doesn't fight the framework.

skills.sh installs
5.6K
GitHub stars
300.3K
last updated
Aug 21, 2026

Install

$ npx -y skills add affaan-m/ecc --skill compose-multiplatform-patterns --agent claude-code

Installs into .claude/skills of the current project.

Files

Compose Multiplatform Patterns

Patterns for building shared UI across Android, iOS, Desktop, and Web using Compose Multiplatform and Jetpack Compose. Covers state management, navigation, theming, and performance.

When to Activate

  • Building Compose UI (Jetpack Compose or Compose Multiplatform)
  • Managing UI state with ViewModels and Compose state
  • Implementing navigation in KMP or Android projects
  • Designing reusable composables and design systems
  • Optimizing recomposition and rendering performance

State Management

ViewModel + Single State Object

Use a single data class for screen state. Expose it as StateFlow and collect in Compose:

data class ItemListState(
    val items: List<Item> = emptyList(),
    val isLoading: Boolean = false,
    val error: String? = null,
    val searchQuery: String = ""
)

class ItemListViewModel(
    private val getItems: GetItemsUseCase
) : ViewModel() {
    private val _state = MutableStateFlow(ItemListState())
    val state: StateFlow<ItemListState> = _state.asStateFlow()

    fun onSearch(query: String) {
        _state.update { it.copy(searchQuery = query) }
        loadItems(query)
    }

Sponsors

Details

Repository
github.com/affaan-m/ecc
Categories
Debugging, Mobile Development
First seen
Jul 14, 2026

More from affaan-m/ecc

All 263

Recommended

More Debugging
1affaan-m avatarswiftui-patternsaffaan-m/eccSwiftUI architecture patterns, state management with @Observable, view composition, navigation, performance optimization, and modern iOS/macOS UI best practices5.6Kskills.sh installs
2jeffallan avatarplaywright-expertjeffallan/claude-skillsUse when writing E2E tests with Playwright, setting up test infrastructure, or debugging flaky browser tests. Invoke to write test scripts, create page objects,5.6Kskills.sh installs
3wondelai avatarhigh-perf-browserwondelai/skillsOptimize web performance through network protocols, resource loading, and browser rendering internals. Use when the user mentions "my site is slow", "Core Web V5.5Kskills.sh installs
4affaan-m avatarnuxt4-patternsaffaan-m/eccNuxt 4 app patterns for hydration safety, performance, route rules, lazy loading, and SSR-safe data fetching with useFetch and useAsyncData.5.5Kskills.sh installs
5trailofbits avataraflpptrailofbits/skillsAFL++ is a fork of AFL with better fuzzing performance and advanced features. Use for multi-core fuzzing of C/C++ projects.5.5Kskills.sh installs
6wondelai avatardrive-motivationwondelai/skillsDesign motivation systems using Autonomy, Mastery, and Purpose (AMP) for products and teams. Use when the user mentions "intrinsic motivation", "gamification is5.5Kskills.sh installs