Skip to content

armgit / ECC

Public Imported from GitHub
0

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

fix: address remaining PR review comments for Kotlin/Android/KMP docs

aliab693f7b8a97
diff --git a/rules/kotlin/patterns.md b/rules/kotlin/patterns.md
index 483a68bfc..ee5e4f14f 100644
--- a/rules/kotlin/patterns.md
+++ b/rules/kotlin/patterns.md
@@ -15,14 +15,14 @@ Prefer constructor injection. Use Koin (KMP) or Hilt (Android-only):
// Koin — declare modules
val dataModule = module {
single<ItemRepository> { ItemRepositoryImpl(get(), get()) }
- factory { GetItemsUseCase(get()) }
+ factory { GetItemUseCase(get()) }
viewModelOf(::ItemListViewModel)
}
// Hilt — annotations
@HiltViewModel
class ItemListViewModel @Inject constructor(
- private val getItems: GetItemsUseCase
+ private val getItem: GetItemUseCase
) : ViewModel()
```
@@ -36,7 +36,7 @@ data class ScreenState(
val isLoading: Boolean = false
)
-class ScreenViewModel(private val useCase: GetItemsUseCase) : ViewModel() {
+class ScreenViewModel(private val useCase: GetItemUseCase) : ViewModel() {
private val _state = MutableStateFlow(ScreenState())
val state = _state.asStateFlow()
@@ -90,21 +90,21 @@ expect class SecureStorage {
actual fun platformName(): String = "Android"
actual class SecureStorage {
actual fun save(key: String, value: String) { /* EncryptedSharedPreferences */ }
- actual fun get(key: String): String? { /* ... */ }
+ actual fun get(key: String): String? = null /* ... */
}
// iosMain
actual fun platformName(): String = "iOS"
actual class SecureStorage {
actual fun save(key: String, value: String) { /* Keychain */ }
- actual fun get(key: String): String? { /* ... */ }
+ actual fun get(key: String): String? = null /* ... */
}
```
## Coroutine Patterns
- Use `viewModelScope` in ViewModels, `coroutineScope` for structured child work
-- Use `stateIn(WhileSubscribed(5_000))` for StateFlow from cold Flows
+- Use `stateIn(viewModelScope, SharingStarted.WhileSubscribed(5_000), initialValue)` for StateFlow from cold Flows
- Use `supervisorScope` when child failures should be independent
## Builder Pattern with DSL
diff --git a/rules/kotlin/testing.md b/rules/kotlin/testing.md
index 98a2e38dd..1356ec82b 100644
--- a/rules/kotlin/testing.md
+++ b/rules/kotlin/testing.md
@@ -21,7 +21,7 @@ paths:
fun `loading state emitted then data`() = runTest {
val repo = FakeItemRepository()
repo.addItem(testItem)
- val viewModel = ItemListViewModel(GetItemsUseCase(repo))
+ val viewModel = ItemListViewModel(GetItemUseCase(repo))
viewModel.state.test {
assertEquals(ItemListState(), awaitItem()) // initial state
diff --git a/skills/compose-multiplatform-patterns/SKILL.md b/skills/compose-multiplatform-patterns/SKILL.md
index 70e4ac655..62b01e286 100644
--- a/skills/compose-multiplatform-patterns/SKILL.md
+++ b/skills/compose-multiplatform-patterns/SKILL.md
@@ -31,7 +31,7 @@ data class ItemListState(
)
class ItemListViewModel(
- private val getItems: GetItemsUseCase
+ private val getItems: GetItemUseCase
) : ViewModel() {
private val _state = MutableStateFlow(ItemListState())
val state: StateFlow<ItemListState> = _state.asStateFlow()
diff --git a/skills/kotlin-coroutines-flows/SKILL.md b/skills/kotlin-coroutines-flows/SKILL.md
index 6650b0b71..12c8756db 100644
--- a/skills/kotlin-coroutines-flows/SKILL.md
+++ b/skills/kotlin-coroutines-flows/SKILL.md
@@ -218,7 +218,7 @@ viewModelScope.launch {
@Test
fun `search updates item list`() = runTest {
val fakeRepository = FakeItemRepository(items = testItems)
- val viewModel = ItemListViewModel(GetItemsUseCase(fakeRepository))
+ val viewModel = ItemListViewModel(GetItemUseCase(fakeRepository))
viewModel.state.test {
assertEquals(ItemListState(), awaitItem()) // initial