shared-models

Create Kotlin Multiplatform domain models with @Serializable data classes and sealed hierarchies.

61|17|Updated Feb 2, 2026
One-click install
npx skills add https://github.com/ahmed3elshaer/everything-claude-code-mobile --skill shared-models
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: shared-models
Source: https://github.com/ahmed3elshaer/everything-claude-code-mobile/tree/main/skills/shared-models
Command: npx skills add https://github.com/ahmed3elshaer/everything-claude-code-mobile --skill shared-models

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill simplifies building reusable, cross-platform data models for Kotlin Multiplatform projects by standardizing domain models and serialization across Android, iOS, and desktop modules.

Core Features & Use Cases

  • Immutable data classes annotated with @Serializable to ensure consistent cross-platform serialization.
  • Sealed hierarchies for UI states and results, enabling predictable state modeling across platforms.
  • Validation utilities and shared configuration to enforce consistent data integrity across all targets.

Quick Start

Define your models in shared/commonMain using @Serializable and sealed classes; enable kotlinx.serialization and the Kotlin Multiplatform plugin in the shared module; then reuse the same models from Android, iOS, and desktop targets.

Frequently Asked Questions about shared-models

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

FAQPage Schema
How do I share data models across Android, iOS, and desktop in Kotlin Multiplatform?

Shared data models in Kotlin Multiplatform use @Serializable data classes defined in shared/commonMain, enabling consistent serialization across all platform targets. Place domain models in the shared module, apply kotlinx.serialization annotations, and import them from Android, iOS, and desktop targets to ensure unified data interchange.

What's the best way to validate data consistently across Kotlin Multiplatform targets?

Validation utilities placed in shared/commonMain enforce consistent data integrity across all platforms. Implement validation logic once in the shared module using simple validation utilities alongside your @Serializable models, then reuse that logic from every target to prevent platform-specific inconsistencies.

Can I use sealed classes for UI state modeling in Kotlin Multiplatform?

Yes, sealed hierarchies are ideal for modeling UI states and results in Kotlin Multiplatform projects. Define sealed classes in shared/commonMain with @Serializable annotations to create predictable, type-safe state representations that serialize consistently across Android, iOS, and desktop platforms.

Do I need kotlinx.serialization to build shared Kotlin Multiplatform models?

Yes, kotlinx.serialization is required for consistent cross-platform serialization. Enable the Kotlin Multiplatform plugin and kotlinx.serialization in your shared module, then annotate data classes with @Serializable to ensure reliable data interchange across all targets.

Why should I use immutable data classes for multiplatform domain models?

Immutable @Serializable data classes ensure predictable behavior and thread-safe data interchange across Android, iOS, and desktop targets. Immutability prevents accidental mutations that could cause platform-specific bugs and simplifies serialization/deserialization logic in shared models.