cmp-code-ruleslisted
Install: claude install-skill whinstudio/skills
# Code rules
Rules for every Kotlin change in this project. How to scaffold a screen or a module is in
`cmp-feature`; build commands and failure recipes are in `cmp-verify`.
## 1. Read first
- Before the first edit read the existing feature module(s) under `feature/`,
`shared/src/commonMain/.../di/initKoin.kt`, `shared/src/commonMain/.../MainScreen.kt`, the
`core/*` modules that exist, and the convention plugins in `build-logic/src/main/kotlin/convention/`
(read only, never edit).
- The code that works in this project sets the conventions, not this document. When the two
disagree, follow the code and mention the difference in your final summary.
## 2. Layers and boundaries
- `contract`: navigation destinations (`@Serializable`, implementing `NavigationCommand.Destination`)
and the interfaces and models other features may use. A feature reaches another feature
**only through that feature's `contract`**.
- `domain`: plain Kotlin. Models, repository interfaces, one use case per operation. No Android,
iOS, Ktor, Room or Compose imports.
- `data`: repository implementations, DTOs, database entities, mappers. DTOs and entities never
leave `data` (or `core/database`, where shared entities live).
- `presentation`: ViewModel, UiState, actions, Route and Content composables, the navigation
provider, test tags.
- When a `contract` type changes, find its users with `grep` and update them in the same change.
## 3. Visibility
- Default to `internal`. `Content` comp