Back to list
spjoshis

coroutines-kotlin

by spjoshis

Modular Claude plugins for agent-based expertise and reusable skills across software development and Agile. Easily extend, share, and automate best practices for modern development.

1🍴 0📅 Dec 30, 2025

SKILL.md


name: coroutines-kotlin description: Master Kotlin coroutines with suspend functions, flows, channels, and structured concurrency for building async applications.

Kotlin Coroutines

Master asynchronous programming in Kotlin with coroutines, flows, and structured concurrency.

Core Concepts

Basic Coroutine

fun main() = runBlocking {
    launch {
        delay(1000L)
        println("World!")
    }
    println("Hello")
}

Suspend Functions

suspend fun fetchUser(id: String): User {
    delay(1000) // Simulating network call
    return User(id, "John Doe")
}

fun main() = runBlocking {
    val user = fetchUser("123")
    println(user)
}

Async/Await

suspend fun loadData(): Data = coroutineScope {
    val user = async { fetchUser() }
    val posts = async { fetchPosts() }

    Data(user.await(), posts.await())
}

Flow

fun simpleFlow(): Flow<Int> = flow {
    for (i in 1..3) {
        delay(100)
        emit(i)
    }
}

fun main() = runBlocking {
    simpleFlow().collect { value ->
        println(value)
    }
}

Channels

fun main() = runBlocking {
    val channel = Channel<Int>()

    launch {
        for (x in 1..5) channel.send(x * x)
        channel.close()
    }

    for (y in channel) println(y)
}

Best Practices

  1. Use structured concurrency
  2. Handle exceptions properly
  3. Use flows for streams
  4. Leverage coroutine scope
  5. Use dispatchers appropriately
  6. Avoid GlobalScope
  7. Test coroutines properly

Resources

Score

Total Score

60/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

+10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新

+5
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

0/5
タグ

1つ以上のタグが設定されている

+5

Reviews

💬

Reviews coming soon