kotlin-project-state-management

Implement state-management patterns for Kotlin Multiplatform projects across Android, iOS, desktop, and web.

63|6|Updated Mar 27, 2026
One-click install
npx skills add https://github.com/mmiani/kotlin-kmp-claude-agent-skills --skill kotlin-project-state-management-mmiani
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kotlin-project-state-management
Source: https://github.com/mmiani/kotlin-kmp-claude-agent-skills/tree/main/skills/kotlin-project-state-management
Command: npx skills add https://github.com/mmiani/kotlin-kmp-claude-agent-skills --skill kotlin-project-state-management-mmiani

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Use when choosing, implementing, or reviewing state-holder patterns in a Kotlin Multiplatform project — including ViewModel, shared presenter, MVI, and StateFlow-in-common — with a focus on effect handling, UiState modeling, and testability.

Core Features & Use Cases

  • Clarifies the invariant state contract and pattern families for KMP UI
  • Composes testable state holders across commonMain and platform-specific wiring
  • Guides correct handling of one-time effects vs persistent state across platform lifecycles

Quick Start

Review the recommended patterns and implement a shared UiState with platform-specific lifecycle wiring for your KMP UI.

Frequently Asked Questions about kotlin-project-state-management

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

FAQPage Schema
How do I implement state management for Kotlin Multiplatform UI shared across Android and iOS?

Implement state management for Kotlin Multiplatform UI by selecting patterns like ViewModel, shared presenter, MVI, or StateFlow in commonMain. Compose testable state holders with explicit lifecycle wiring and UiState modeling to ensure consistent behavior across Android, iOS, desktop, and web targets.

What is the best way to handle one-time effects versus persistent state in KMP?

Handling one-time effects in KMP requires distinguishing them from persistent UI state. Use explicit guidance on effect handling to align with platform lifecycles, ensuring effects execute once while UiState maintains continuous representation across Android and iOS targets.

Can I use ViewModel with StateFlow in commonMain for Kotlin Multiplatform projects?

You can use ViewModel with StateFlow in commonMain by composing testable state holders across shared code and platform-specific wiring. This approach aligns dependency placement and test strategies with platform behavior while avoiding common anti-patterns in KMP projects.

How do I test state holders and UiState in a Kotlin Multiplatform project?

Test state holders and UiState in Kotlin Multiplatform by ensuring test strategies align with platform behavior. Compose testable state holders across commonMain and platform-specific wiring, verifying lifecycle handling and effect execution to avoid common anti-patterns.

When should I choose MVI over a shared presenter pattern for KMP state management?

Choosing MVI over a shared presenter for KMP state management depends on your invariant state contract needs. MVI provides strict unidirectional data flow with explicit UiState modeling, while shared presenters offer flexible wiring across Android, iOS, desktop, and web targets.

Why does my Kotlin Multiplatform state management lose UI state across platform lifecycle changes?

Losing UI state across platform lifecycle changes happens when state holders lack proper lifecycle wiring. Apply correct handling of one-time effects versus persistent state, ensuring dependency placement and lifecycle alignment match platform behavior across Android and iOS targets.