Yokan / rebuild
Course 1 8624561

README.md

.codex/skills/compose-kotlin-agent-skills/examples/todo-mvi/README.md

documentation / design asset42 lines
1# Todo MVI Example23Minimal MVI todo list demonstrating patterns from this skill kit. **Not a compilable Gradle module** — reference snippets for agents and humans. Copy into your app module.45## MVI patterns demonstrated67| Pattern | Where |8|---|---|9| `UiState` / `UiEvent` / `UiEffect` sealed types | `TodoViewModel.kt` |10| Atomic `_state.update { it.copy(...) }` | `TodoViewModel.kt` |11| `SharedFlow` / `Channel` for one-shot effects | `TodoViewModel.kt` |12| `@HiltViewModel` + constructor injection | `TodoViewModel.kt` |13| `collectAsStateWithLifecycle()` | `TodoScreen.kt` |14| `LazyColumn` + `key` + `contentType` | `TodoScreen.kt` |15| `stringResource()` for all UI text | `TodoScreen.kt` |16| Repository + Room Flow offline-first | `TodoRepository.kt` |1718## Antipatterns avoided1920See [`references/00-banned-antipatterns.md`](../references/00-banned-antipatterns.md):2122| Row | Antipattern | How this example avoids it |23|---|---|---|24| 1 | `GlobalScope` | `viewModelScope` only |25| 3 | Hardcoded strings | `stringResource(R.string.*)` in screen |26| 4 | `collectAsState()` | `collectAsStateWithLifecycle()` |27| 5 | `_state.value =` | `_state.update { }` throughout VM |28| 6 | `mutableStateListOf` in VM | `StateFlow<List<TodoUi>>` |29| 7 | LazyColumn without key | `key = { it.id }` + `contentType` |30| 8 | Pass ViewModel to child | Pass `state` + `onEvent` lambda |3132## Files3334- [`TodoViewModel.kt`](TodoViewModel.kt) — MVI core35- [`TodoScreen.kt`](TodoScreen.kt) — Compose UI36- [`TodoRepository.kt`](TodoRepository.kt) — offline-first data3738## Verification prompt3940> "Review `examples/todo-mvi/TodoScreen.kt` in REVIEW MODE."4142Expected: 6-point checklist from [`skills/android-kotlin-compose/SKILL.md`](../skills/android-kotlin-compose/SKILL.md).43

Search chapters, reference and source filenames.