bulk-json-import-progress
Installation
SKILL.md
Importing a large file into a local database
The whole operation is one cold flow that emits a small sealed progress type. The caller collects it; nothing else needs to know how the work is split.
sealed interface ImportProgress {
data object Preparing : ImportProgress
data class Importing(val processed: Int, val total: Int) : ImportProgress
data class Success(val result: ImportResult) : ImportProgress
data class Error(val message: String) : ImportProgress
}
override fun import(json: String, invalidFileMessage: String): Flow<ImportProgress> = flow {
emit(ImportProgress.Preparing)
…
}.flowOn(Dispatchers.IO)