dimitriremoiville/cc-mobile/kmm-architecture
Claude Code and agent skill by dimitriremoiville/cc-mobile
- community
Checking that the SKILL.md file is still in the repository.
How MVVM + Clean Architecture is applied in this Kotlin Multiplatform codebase — source-set placement, `expect`/`actual` vs. interface injection, layer boundaries inside `commonMain`, and how ViewModels reach both Android and iOS. Load when designing a feature, deciding where code belongs, or reviewing layer boundaries in the shared module.
Install
npx vskill@latest install dimitriremoiville/cc-mobile/kmm-architectureSKILL.md
The same SKILL.md was published earlier as dimitriremoiville/cc-mobile/kmm-architecture.
KMM architecture
The three layers, inside commonMain
Dependency rule: presentation → domain ← data. Same as the native Android and iOS setups. The domain layer imports only Foundation-equivalent Kotlin + coroutines + kotlinx-* (serialization, datetime).
Source-set decision tree
When adding code, ask:
- Does it compile on both JVM and Native with only
kotlinx-*dependencies? → `commonMain`. - Does it need a JVM-only library (OkHttp, Room, Android Context)? → `androidMain`.
- Does it need an Apple framework (
Foundation,UIKit,Securityfor Keychain)? → `iosMain`. - Does a single narrow operation differ per platform (like getting a
HttpClientengine)? →expect/actual. - Does a wider surface differ per platform (a
KeyValueStore, aCryptoProvider)? → interface in `commonMain`, implementations in platform source sets, bound via Koin.
Prefer the higher-numbered options only when the lower ones don't fit. commonMain-first.
expect / actual vs. interface + Koin
Use `expect` / `actual` when:
- The surface is small (one or two functions).
- There's no reasonable common implementation.
- The caller wouldn't benefit from swapping the implementation (it's truly platform-fixed).
Use an interface + Koin when:
- The surface has multiple methods.
- Tests need to substitute a fake.
- The abstraction is useful even within a single platform (e.g. a
KeyValueStorewith in-memory, file-backed, and encrypted variants).
What goes where
| Layer | commonMain | androidMain | iosMain | |
|---|---|---|---|---|
| Domain models | ✓ | |||
| Use cases | ✓ | |||
| Repository interfaces | ✓ | |||
| Repository impls | ✓ (when using HttpClient + SQLDelight) | Android-specific impls only | iOS-specific impls only | |
DTOs (@Serializable) | ✓ | |||
| Mappers | ✓ | |||
Ktor HttpClient config | ✓ | Platform engine (OkHttp) | Platform engine (Darwin) | |
| SQLDelight schema | ✓ | SqlDriver (Android driver) | SqlDriver (Native driver) | |
| ViewModels | ✓ | |||
| Koin modules | core modules common; platform-specific as needed | androidModule (binds Context, SharedPreferences, etc.) | iosModule (binds Darwin-specific impls) | |
| Navigation | ✓ (Navigation-Compose) | ✓ (NavigationStack in Swift) | ||
| UI | ✓ (Jetpack Compose) | ✓ (SwiftUI) |
Feature skeleton (for a new feature called orders)
ViewModel reaches for both platforms
A shared ViewModel extends androidx.lifecycle.ViewModel (multiplatform-ready):
- Android collects
statein a Composable viaviewModel.state.collectAsStateWithLifecycle()and sends actions withviewModel::onAction. - iOS wraps the ViewModel in a
@ObservableSwift class that subscribes tostateand exposes Swift-friendly properties. Seekmm-ios-interopskill.
Layer checklist for a new feature
- [ ] Domain model in
commonMain/.../domain/model/ - [ ] Repository interface in
commonMain/.../domain/repository/ - [ ] Use case(s) in
commonMain/.../domain/usecase/(if warranted) - [ ] DTO + mapper in
commonMain/.../data/ - [ ] Ktor API wrapper in
commonMain/.../data/remote/ - [ ] RepositoryImpl in
commonMain/.../data/repository/ - [ ] Koin module in
commonMain/.../data/di/, registered at the root - [ ] UiState / UiAction / UiEvent in
commonMain/.../presentation/<feature>/ - [ ] ViewModel in
commonMain/.../presentation/<feature>/ - [ ] Platform-specific impls only if truly necessary (and bound via Koin)
- [ ] Tests in
commonTest/for use cases, mappers, repository (with MockEngine), ViewModel - [ ] Android UI consuming
:shared(in../android/) - [ ] iOS UI consuming the framework (in
../ios/)
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingplugins/cc-mobile-kmm/skills/kmm-architecture/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/dimitriremoiville/cc-mobile/kmm-architecture)