# Kmp Architecture

> Guide and implement architectural patterns (MVVM, MVI, Clean Architecture) for KMP. Includes base classes, decision matrices, and code generation scripts.

- Skill: `ethanchzhong/kmp-architecture` (Agent Skill, multi-file: 7 files)
- Install (CLI): `npx skillmds@latest add ethanchzhong/kmp-architecture`
- Raw SKILL.md: https://api.skillmd.com/api/skills/ethanchzhong/kmp-architecture/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: ethanchzhong (https://skillmd.com/u/ethanchzhong)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/ethanchzhong/kmp-architecture

---


# KMP Architecture Guide

## Intent
Standardize architecture across KMP projects to ensure maintainability and testability.

## Decision Matrix

| Metric | MVVM | MVI |
| :--- | :--- | :--- |
| **Simple States** | Recommended | Overkill |
| **Predictability** | High | Very High |
| **Boilerplate** | Low | Medium |
| **Scaling** | Good | Excellent |

## Usage
Use provided base classes from `resources/base/` or generate a new feature using `scripts/generate_feature.py`.

### Patterns
1. **Repository Pattern**: Common for most apps.
2. **Clean Architecture**: Use for complex business logic (Domain layer + UseCases).

## Directory Structure
```
feature/
├── data/           # Repository implementations, Data Sources
├── domain/         # Use Cases, Repository Interfaces, Models
└── presentation/   # ViewModels, UI States (and Intents for MVI)
```

