[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6JD73059ZHB8AEKX7DC470X":3,"skill-same:01M6JD73059ZHB8AEKX7DC470X":57},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":29,"linkOnly":30,"markdownContent":31,"markdownBody":32,"frontMatter":33,"refName":35,"commitSha":36,"skillDirectory":37,"forksCount":38,"repositoryHtmlUrl":39,"repositoryHomepageUrl":40,"ownerHtmlUrl":41,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":42,"install":43,"resources":56},"01M6JD73059ZHB8AEKX7DC470X","kotlin-patterns",null,"Idiomatic Kotlin patterns, best practices, and conventions for building robust, efficient, and maintainable Kotlin applications with coroutines, null safety, and DSL builders.","S3YED\u002Fappie-kit","S3YED","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F62743867?v=4","01M6JBKBRRVP6KMS0VWZ27T3R6","01M6JBKBX0KG30284PW1DBYJT1",14,"MIT","https:\u002F\u002Fgithub.com\u002FS3YED\u002Fappie-kit\u002Fblob\u002Fmaster\u002Fskills\u002Fecc\u002Fkotlin-patterns\u002FSKILL.md",[],[18,19,20,21,22,23,24,25,26,27,28],"kotlin patterns","kotlin","patterns","best practices","Safety","applications","coroutines","conventions","with","for","idiomatic","2026-11-10 10:12:30",false,"---\nname: kotlin-patterns\ndescription: Idiomatic Kotlin patterns, best practices, and conventions for building robust, efficient, and maintainable Kotlin applications with coroutines, null safety, and DSL builders.\norigin: ECC\n---\n\n# Kotlin Development Patterns\n\nIdiomatic Kotlin patterns and best practices for building robust, efficient, and maintainable applications.\n\n## When to Use\n\n- Writing new Kotlin code\n- Reviewing Kotlin code\n- Refactoring existing Kotlin code\n- Designing Kotlin modules or libraries\n- Configuring Gradle Kotlin DSL builds\n\n## How It Works\n\nThis skill enforces idiomatic Kotlin conventions across seven key areas: null safety using the type system and safe-call operators, immutability via `val` and `copy()` on data classes, sealed classes and interfaces for exhaustive type hierarchies, structured concurrency with coroutines and `Flow`, extension functions for adding behaviour without inheritance, type-safe DSL builders using `@DslMarker` and lambda receivers, and Gradle Kotlin DSL for build configuration.\n\n## Examples\n\n**Null safety with Elvis operator:**\n```kotlin\nfun getUserEmail(userId: String): String {\n    val user = userRepository.findById(userId)\n    return user?.email ?: \"unknown@example.com\"\n}\n```\n\n**Sealed class for exhaustive results:**\n```kotlin\nsealed class Result\u003Cout T> {\n    data class Success\u003CT>(val data: T) : Result\u003CT>()\n    data class Failure(val error: AppError) : Result\u003CNothing>()\n    data object Loading : Result\u003CNothing>()\n}\n```\n\n**Structured concurrency with async\u002Fawait:**\n```kotlin\nsuspend fun fetchUserWithPosts(userId: String): UserProfile =\n    coroutineScope {\n        val user = async { userService.getUser(userId) }\n        val posts = async { postService.getUserPosts(userId) }\n        UserProfile(user = user.await(), posts = posts.await())\n    }\n```\n\n## Core Principles\n\n### 1. Null Safety\n\nKotlin's type system distinguishes nullable and non-nullable types. Leverage it fully.\n\n```kotlin\n\u002F\u002F Good: Use non-nullable types by default\nfun getUser(id: String): User {\n    return userRepository.findById(id)\n        ?: throw UserNotFoundException(\"User $id not found\")\n}\n\n\u002F\u002F Good: Safe calls and Elvis operator\nfun getUserEmail(userId: String): String {\n    val user = userRepository.findById(userId)\n    return user?.email ?: \"unknown@example.com\"\n}\n\n\u002F\u002F Bad: Force-unwrapping nullable types\nfun getUserEmail(userId: String): String {\n    val user = userRepository.findById(userId)\n    return user!!.email \u002F\u002F Throws NPE if null\n}\n```\n\n### 2. Immutability by Default\n\nPrefer `val` over `var`, immutable collections over mutable ones.\n\n```kotlin\n\u002F\u002F Good: Immutable data\ndata class User(\n    val id: String,\n    val name: String,\n    val email: String,\n)\n\n\u002F\u002F Good: Transform with copy()\nfun updateEmail(user: User, newEmail: String): User =\n    user.copy(email = newEmail)\n\n\u002F\u002F Good: Immutable collections\nval users: List\u003CUser> = listOf(user1, user2)\nval filtered = users.filter { it.email.isNotBlank() }\n\n\u002F\u002F Bad: Mutable state\nvar currentUser: User? = null \u002F\u002F Avoid mutable global state\nval mutableUsers = mutableListOf\u003CUser>() \u002F\u002F Avoid unless truly needed\n```\n\n### 3. Expression Bodies and Single-Expression Functions\n\nUse expression bodies for concise, readable functions.\n\n```kotlin\n\u002F\u002F Good: Expression body\nfun isAdult(age: Int): Boolean = age >= 18\n\nfun formatFullName(first: String, last: String): String =\n    \"$first $last\".trim()\n\nfun User.displayName(): String =\n    name.ifBlank { email.substringBefore('@') }\n\n\u002F\u002F Good: When as expression\nfun statusMessage(code: Int): String = when (code) {\n    200 -> \"OK\"\n    404 -> \"Not Found\"\n    500 -> \"Internal Server Error\"\n    else -> \"Unknown status: $code\"\n}\n\n\u002F\u002F Bad: Unnecessary block body\nfun isAdult(age: Int): Boolean {\n    return age >= 18\n}\n```\n\n### 4. Data Classes for Value Objects\n\nUse data classes for types that primarily hold data.\n\n```kotlin\n\u002F\u002F Good: Data class with copy, equals, hashCode, toString\ndata class CreateUserRequest(\n    val name: String,\n    val email: String,\n    val role: Role = Role.USER,\n)\n\n\u002F\u002F Good: Value class for type safety (zero overhead at runtime)\n@JvmInline\nvalue class UserId(val value: String) {\n    init {\n        require(value.isNotBlank()) { \"UserId cannot be blank\" }\n    }\n}\n\n@JvmInline\nvalue class Email(val value: String) {\n    init {\n        require('@' in value) { \"Invalid email: $value\" }\n    }\n}\n\nfun getUser(id: UserId): User = userRepository.findById(id)\n```\n\n## Sealed Classes and Interfaces\n\n### Modeling Restricted Hierarchies\n\n```kotlin\n\u002F\u002F Good: Sealed class for exhaustive when\nsealed class Result\u003Cout T> {\n    data class Success\u003CT>(val data: T) : Result\u003CT>()\n    data class Failure(val error: AppError) : Result\u003CNothing>()\n    data object Loading : Result\u003CNothing>()\n}\n\nfun \u003CT> Result\u003CT>.getOrNull(): T? = when (this) {\n    is Result.Success -> data\n    is Result.Failure -> null\n    is Result.Loading -> null\n}\n\nfun \u003CT> Result\u003CT>.getOrThrow(): T = when (this) {\n    is Result.Success -> data\n    is Result.Failure -> throw error.toException()\n    is Result.Loading -> throw IllegalStateException(\"Still loading\")\n}\n```\n\n### Sealed Interfaces for API Responses\n\n```kotlin\nsealed interface ApiError {\n    val message: String\n\n    data class NotFound(override val message: String) : ApiError\n    data class Unauthorized(override val message: String) : ApiError\n    data class Validation(\n        override val message: String,\n        val field: String,\n    ) : ApiError\n    data class Internal(\n        override val message: String,\n        val cause: Throwable? = null,\n    ) : ApiError\n}\n\nfun ApiError.toStatusCode(): Int = when (this) {\n    is ApiError.NotFound -> 404\n    is ApiError.Unauthorized -> 401\n    is ApiError.Validation -> 422\n    is ApiError.Internal -> 500\n}\n```\n\n## Scope Functions\n\n### When to Use Each\n\n```kotlin\n\u002F\u002F let: Transform nullable or scoped result\nval length: Int? = name?.let { it.trim().length }\n\n\u002F\u002F apply: Configure an object (returns the object)\nval user = User().apply {\n    name = \"Alice\"\n    email = \"alice@example.com\"\n}\n\n\u002F\u002F also: Side effects (returns the object)\nval user = createUser(request).also { logger.info(\"Created user: ${it.id}\") }\n\n\u002F\u002F run: Execute a block with receiver (returns result)\nval result = connection.run {\n    prepareStatement(sql)\n    executeQuery()\n}\n\n\u002F\u002F with: Non-extension form of run\nval csv = with(StringBuilder()) {\n    appendLine(\"name,email\")\n    users.forEach { appendLine(\"${it.name},${it.email}\") }\n    toString()\n}\n```\n\n### Anti-Patterns\n\n```kotlin\n\u002F\u002F Bad: Nesting scope functions\nuser?.let { u ->\n    u.address?.let { addr ->\n        addr.city?.let { city ->\n            println(city) \u002F\u002F Hard to read\n        }\n    }\n}\n\n\u002F\u002F Good: Chain safe calls instead\nval city = user?.address?.city\ncity?.let { println(it) }\n```\n\n## Extension Functions\n\n### Adding Functionality Without Inheritance\n\n```kotlin\n\u002F\u002F Good: Domain-specific extensions\nfun String.toSlug(): String =\n    lowercase()\n        .replace(Regex(\"[^a-z0-9\\\\s-]\"), \"\")\n        .replace(Regex(\"\\\\s+\"), \"-\")\n        .trim('-')\n\nfun Instant.toLocalDate(zone: ZoneId = ZoneId.systemDefault()): LocalDate =\n    atZone(zone).toLocalDate()\n\n\u002F\u002F Good: Collection extensions\nfun \u003CT> List\u003CT>.second(): T = this[1]\n\nfun \u003CT> List\u003CT>.secondOrNull(): T? = getOrNull(1)\n\n\u002F\u002F Good: Scoped extensions (not polluting global namespace)\nclass UserService {\n    private fun User.isActive(): Boolean =\n        status == Status.ACTIVE && lastLogin.isAfter(Instant.now().minus(30, ChronoUnit.DAYS))\n\n    fun getActiveUsers(): List\u003CUser> = userRepository.findAll().filter { it.isActive() }\n}\n```\n\n## Coroutines\n\n### Structured Concurrency\n\n```kotlin\n\u002F\u002F Good: Structured concurrency with coroutineScope\nsuspend fun fetchUserWithPosts(userId: String): UserProfile =\n    coroutineScope {\n        val userDeferred = async { userService.getUser(userId) }\n        val postsDeferred = async { postService.getUserPosts(userId) }\n\n        UserProfile(\n            user = userDeferred.await(),\n            posts = postsDeferred.await(),\n        )\n    }\n\n\u002F\u002F Good: supervisorScope when children can fail independently\nsuspend fun fetchDashboard(userId: String): Dashboard =\n    supervisorScope {\n        val user = async { userService.getUser(userId) }\n        val notifications = async { notificationService.getRecent(userId) }\n        val recommendations = async { recommendationService.getFor(userId) }\n\n        Dashboard(\n            user = user.await(),\n            notifications = try {\n                notifications.await()\n            } catch (e: CancellationException) {\n                throw e\n            } catch (e: Exception) {\n                emptyList()\n            },\n            recommendations = try {\n                recommendations.await()\n            } catch (e: CancellationException) {\n                throw e\n            } catch (e: Exception) {\n                emptyList()\n            },\n        )\n    }\n```\n\n### Flow for Reactive Streams\n\n```kotlin\n\u002F\u002F Good: Cold flow with proper error handling\nfun observeUsers(): Flow\u003CList\u003CUser>> = flow {\n    while (currentCoroutineContext().isActive) {\n        val users = userRepository.findAll()\n        emit(users)\n        delay(5.seconds)\n    }\n}.catch { e ->\n    logger.error(\"Error observing users\", e)\n    emit(emptyList())\n}\n\n\u002F\u002F Good: Flow operators\nfun searchUsers(query: Flow\u003CString>): Flow\u003CList\u003CUser>> =\n    query\n        .debounce(300.milliseconds)\n        .distinctUntilChanged()\n        .filter { it.length >= 2 }\n        .mapLatest { q -> userRepository.search(q) }\n        .catch { emit(emptyList()) }\n```\n\n### Cancellation and Cleanup\n\n```kotlin\n\u002F\u002F Good: Respect cancellation\nsuspend fun processItems(items: List\u003CItem>) {\n    items.forEach { item ->\n        ensureActive() \u002F\u002F Check cancellation before expensive work\n        processItem(item)\n    }\n}\n\n\u002F\u002F Good: Cleanup with try\u002Ffinally\nsuspend fun acquireAndProcess() {\n    val resource = acquireResource()\n    try {\n        resource.process()\n    } finally {\n        withContext(NonCancellable) {\n            resource.release() \u002F\u002F Always release, even on cancellation\n        }\n    }\n}\n```\n\n## Delegation\n\n### Property Delegation\n\n```kotlin\n\u002F\u002F Lazy initialization\nval expensiveData: List\u003CUser> by lazy {\n    userRepository.findAll()\n}\n\n\u002F\u002F Observable property\nvar name: String by Delegates.observable(\"initial\") { _, old, new ->\n    logger.info(\"Name changed from '$old' to '$new'\")\n}\n\n\u002F\u002F Map-backed properties\nclass Config(private val map: Map\u003CString, Any?>) {\n    val host: String by map\n    val port: Int by map\n    val debug: Boolean by map\n}\n\nval config = Config(mapOf(\"host\" to \"localhost\", \"port\" to 8080, \"debug\" to true))\n```\n\n### Interface Delegation\n\n```kotlin\n\u002F\u002F Good: Delegate interface implementation\nclass LoggingUserRepository(\n    private val delegate: UserRepository,\n    private val logger: Logger,\n) : UserRepository by delegate {\n    \u002F\u002F Only override what you need to add logging to\n    override suspend fun findById(id: String): User? {\n        logger.info(\"Finding user by id: $id\")\n        return delegate.findById(id).also {\n            logger.info(\"Found user: ${it?.name ?: \"null\"}\")\n        }\n    }\n}\n```\n\n## DSL Builders\n\n### Type-Safe Builders\n\n```kotlin\n\u002F\u002F Good: DSL with @DslMarker\n@DslMarker\nannotation class HtmlDsl\n\n@HtmlDsl\nclass HTML {\n    private val children = mutableListOf\u003CElement>()\n\n    fun head(init: Head.() -> Unit) {\n        children += Head().apply(init)\n    }\n\n    fun body(init: Body.() -> Unit) {\n        children += Body().apply(init)\n    }\n\n    override fun toString(): String = children.joinToString(\"\\n\")\n}\n\nfun html(init: HTML.() -> Unit): HTML = HTML().apply(init)\n\n\u002F\u002F Usage\nval page = html {\n    head { title(\"My Page\") }\n    body {\n        h1(\"Welcome\")\n        p(\"Hello, World!\")\n    }\n}\n```\n\n### Configuration DSL\n\n```kotlin\ndata class ServerConfig(\n    val host: String = \"0.0.0.0\",\n    val port: Int = 8080,\n    val ssl: SslConfig? = null,\n    val database: DatabaseConfig? = null,\n)\n\ndata class SslConfig(val certPath: String, val keyPath: String)\ndata class DatabaseConfig(val url: String, val maxPoolSize: Int = 10)\n\nclass ServerConfigBuilder {\n    var host: String = \"0.0.0.0\"\n    var port: Int = 8080\n    private var ssl: SslConfig? = null\n    private var database: DatabaseConfig? = null\n\n    fun ssl(certPath: String, keyPath: String) {\n        ssl = SslConfig(certPath, keyPath)\n    }\n\n    fun database(url: String, maxPoolSize: Int = 10) {\n        database = DatabaseConfig(url, maxPoolSize)\n    }\n\n    fun build(): ServerConfig = ServerConfig(host, port, ssl, database)\n}\n\nfun serverConfig(init: ServerConfigBuilder.() -> Unit): ServerConfig =\n    ServerConfigBuilder().apply(init).build()\n\n\u002F\u002F Usage\nval config = serverConfig {\n    host = \"0.0.0.0\"\n    port = 443\n    ssl(\"\u002Fcerts\u002Fcert.pem\", \"\u002Fcerts\u002Fkey.pem\")\n    database(\"jdbc:postgresql:\u002F\u002Flocalhost:5432\u002Fmydb\", maxPoolSize = 20)\n}\n```\n\n## Sequences for Lazy Evaluation\n\n```kotlin\n\u002F\u002F Good: Use sequences for large collections with multiple operations\nval result = users.asSequence()\n    .filter { it.isActive }\n    .map { it.email }\n    .filter { it.endsWith(\"@company.com\") }\n    .take(10)\n    .toList()\n\n\u002F\u002F Good: Generate infinite sequences\nval fibonacci: Sequence\u003CLong> = sequence {\n    var a = 0L\n    var b = 1L\n    while (true) {\n        yield(a)\n        val next = a + b\n        a = b\n        b = next\n    }\n}\n\nval first20 = fibonacci.take(20).toList()\n```\n\n## Gradle Kotlin DSL\n\n### build.gradle.kts Configuration\n\n```kotlin\n\u002F\u002F Check for latest versions: https:\u002F\u002Fkotlinlang.org\u002Fdocs\u002Freleases.html\nplugins {\n    kotlin(\"jvm\") version \"2.3.10\"\n    kotlin(\"plugin.serialization\") version \"2.3.10\"\n    id(\"io.ktor.plugin\") version \"3.4.0\"\n    id(\"org.jetbrains.kotlinx.kover\") version \"0.9.7\"\n    id(\"io.gitlab.arturbosch.detekt\") version \"1.23.8\"\n}\n\ngroup = \"com.example\"\nversion = \"1.0.0\"\n\nkotlin {\n    jvmToolchain(21)\n}\n\ndependencies {\n    \u002F\u002F Ktor\n    implementation(\"io.ktor:ktor-server-core:3.4.0\")\n    implementation(\"io.ktor:ktor-server-netty:3.4.0\")\n    implementation(\"io.ktor:ktor-server-content-negotiation:3.4.0\")\n    implementation(\"io.ktor:ktor-serialization-kotlinx-json:3.4.0\")\n\n    \u002F\u002F Exposed\n    implementation(\"org.jetbrains.exposed:exposed-core:1.0.0\")\n    implementation(\"org.jetbrains.exposed:exposed-dao:1.0.0\")\n    implementation(\"org.jetbrains.exposed:exposed-jdbc:1.0.0\")\n    implementation(\"org.jetbrains.exposed:exposed-kotlin-datetime:1.0.0\")\n\n    \u002F\u002F Koin\n    implementation(\"io.insert-koin:koin-ktor:4.2.0\")\n\n    \u002F\u002F Coroutines\n    implementation(\"org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2\")\n\n    \u002F\u002F Testing\n    testImplementation(\"io.kotest:kotest-runner-junit5:6.1.4\")\n    testImplementation(\"io.kotest:kotest-assertions-core:6.1.4\")\n    testImplementation(\"io.kotest:kotest-property:6.1.4\")\n    testImplementation(\"io.mockk:mockk:1.14.9\")\n    testImplementation(\"io.ktor:ktor-server-test-host:3.4.0\")\n    testImplementation(\"org.jetbrains.kotlinx:kotlinx-coroutines-test:1.10.2\")\n}\n\ntasks.withType\u003CTest> {\n    useJUnitPlatform()\n}\n\ndetekt {\n    config.setFrom(files(\"config\u002Fdetekt\u002Fdetekt.yml\"))\n    buildUponDefaultConfig = true\n}\n```\n\n## Error Handling Patterns\n\n### Result Type for Domain Operations\n\n```kotlin\n\u002F\u002F Good: Use Kotlin's Result or a custom sealed class\nsuspend fun createUser(request: CreateUserRequest): Result\u003CUser> = runCatching {\n    require(request.name.isNotBlank()) { \"Name cannot be blank\" }\n    require('@' in request.email) { \"Invalid email format\" }\n\n    val user = User(\n        id = UserId(UUID.randomUUID().toString()),\n        name = request.name,\n        email = Email(request.email),\n    )\n    userRepository.save(user)\n    user\n}\n\n\u002F\u002F Good: Chain results\nval displayName = createUser(request)\n    .map { it.name }\n    .getOrElse { \"Unknown\" }\n```\n\n### require, check, error\n\n```kotlin\n\u002F\u002F Good: Preconditions with clear messages\nfun withdraw(account: Account, amount: Money): Account {\n    require(amount.value > 0) { \"Amount must be positive: $amount\" }\n    check(account.balance >= amount) { \"Insufficient balance: ${account.balance} \u003C $amount\" }\n\n    return account.copy(balance = account.balance - amount)\n}\n```\n\n## Collection Operations\n\n### Idiomatic Collection Processing\n\n```kotlin\n\u002F\u002F Good: Chained operations\nval activeAdminEmails: List\u003CString> = users\n    .filter { it.role == Role.ADMIN && it.isActive }\n    .sortedBy { it.name }\n    .map { it.email }\n\n\u002F\u002F Good: Grouping and aggregation\nval usersByRole: Map\u003CRole, List\u003CUser>> = users.groupBy { it.role }\n\nval oldestByRole: Map\u003CRole, User?> = users.groupBy { it.role }\n    .mapValues { (_, users) -> users.minByOrNull { it.createdAt } }\n\n\u002F\u002F Good: Associate for map creation\nval usersById: Map\u003CUserId, User> = users.associateBy { it.id }\n\n\u002F\u002F Good: Partition for splitting\nval (active, inactive) = users.partition { it.isActive }\n```\n\n## Quick Reference: Kotlin Idioms\n\n| Idiom | Description |\n|-------|-------------|\n| `val` over `var` | Prefer immutable variables |\n| `data class` | For value objects with equals\u002FhashCode\u002Fcopy |\n| `sealed class\u002Finterface` | For restricted type hierarchies |\n| `value class` | For type-safe wrappers with zero overhead |\n| Expression `when` | Exhaustive pattern matching |\n| Safe call `?.` | Null-safe member access |\n| Elvis `?:` | Default value for nullables |\n| `let`\u002F`apply`\u002F`also`\u002F`run`\u002F`with` | Scope functions for clean code |\n| Extension functions | Add behavior without inheritance |\n| `copy()` | Immutable updates on data classes |\n| `require`\u002F`check` | Precondition assertions |\n| Coroutine `async`\u002F`await` | Structured concurrent execution |\n| `Flow` | Cold reactive streams |\n| `sequence` | Lazy evaluation |\n| Delegation `by` | Reuse implementation without inheritance |\n\n## Anti-Patterns to Avoid\n\n```kotlin\n\u002F\u002F Bad: Force-unwrapping nullable types\nval name = user!!.name\n\n\u002F\u002F Bad: Platform type leakage from Java\nfun getLength(s: String) = s.length \u002F\u002F Safe\nfun getLength(s: String?) = s?.length ?: 0 \u002F\u002F Handle nulls from Java\n\n\u002F\u002F Bad: Mutable data classes\ndata class MutableUser(var name: String, var email: String)\n\n\u002F\u002F Bad: Using exceptions for control flow\ntry {\n    val user = findUser(id)\n} catch (e: NotFoundException) {\n    \u002F\u002F Don't use exceptions for expected cases\n}\n\n\u002F\u002F Good: Use nullable return or Result\nval user: User? = findUserOrNull(id)\n\n\u002F\u002F Bad: Ignoring coroutine scope\nGlobalScope.launch { \u002F* Avoid GlobalScope *\u002F }\n\n\u002F\u002F Good: Use structured concurrency\ncoroutineScope {\n    launch { \u002F* Properly scoped *\u002F }\n}\n\n\u002F\u002F Bad: Deeply nested scope functions\nuser?.let { u ->\n    u.address?.let { a ->\n        a.city?.let { c -> process(c) }\n    }\n}\n\n\u002F\u002F Good: Direct null-safe chain\nuser?.address?.city?.let { process(it) }\n```\n\n**Remember**: Kotlin code should be concise but readable. Leverage the type system for safety, prefer immutability, and use coroutines for concurrency. When in doubt, let the compiler help you.\n","# Kotlin Development Patterns\n\nIdiomatic Kotlin patterns and best practices for building robust, efficient, and maintainable applications.\n\n## When to Use\n\n- Writing new Kotlin code\n- Reviewing Kotlin code\n- Refactoring existing Kotlin code\n- Designing Kotlin modules or libraries\n- Configuring Gradle Kotlin DSL builds\n\n## How It Works\n\nThis skill enforces idiomatic Kotlin conventions across seven key areas: null safety using the type system and safe-call operators, immutability via `val` and `copy()` on data classes, sealed classes and interfaces for exhaustive type hierarchies, structured concurrency with coroutines and `Flow`, extension functions for adding behaviour without inheritance, type-safe DSL builders using `@DslMarker` and lambda receivers, and Gradle Kotlin DSL for build configuration.\n\n## Examples\n\n**Null safety with Elvis operator:**\n```kotlin\nfun getUserEmail(userId: String): String {\n    val user = userRepository.findById(userId)\n    return user?.email ?: \"unknown@example.com\"\n}\n```\n\n**Sealed class for exhaustive results:**\n```kotlin\nsealed class Result\u003Cout T> {\n    data class Success\u003CT>(val data: T) : Result\u003CT>()\n    data class Failure(val error: AppError) : Result\u003CNothing>()\n    data object Loading : Result\u003CNothing>()\n}\n```\n\n**Structured concurrency with async\u002Fawait:**\n```kotlin\nsuspend fun fetchUserWithPosts(userId: String): UserProfile =\n    coroutineScope {\n        val user = async { userService.getUser(userId) }\n        val posts = async { postService.getUserPosts(userId) }\n        UserProfile(user = user.await(), posts = posts.await())\n    }\n```\n\n## Core Principles\n\n### 1. Null Safety\n\nKotlin's type system distinguishes nullable and non-nullable types. Leverage it fully.\n\n```kotlin\n\u002F\u002F Good: Use non-nullable types by default\nfun getUser(id: String): User {\n    return userRepository.findById(id)\n        ?: throw UserNotFoundException(\"User $id not found\")\n}\n\n\u002F\u002F Good: Safe calls and Elvis operator\nfun getUserEmail(userId: String): String {\n    val user = userRepository.findById(userId)\n    return user?.email ?: \"unknown@example.com\"\n}\n\n\u002F\u002F Bad: Force-unwrapping nullable types\nfun getUserEmail(userId: String): String {\n    val user = userRepository.findById(userId)\n    return user!!.email \u002F\u002F Throws NPE if null\n}\n```\n\n### 2. Immutability by Default\n\nPrefer `val` over `var`, immutable collections over mutable ones.\n\n```kotlin\n\u002F\u002F Good: Immutable data\ndata class User(\n    val id: String,\n    val name: String,\n    val email: String,\n)\n\n\u002F\u002F Good: Transform with copy()\nfun updateEmail(user: User, newEmail: String): User =\n    user.copy(email = newEmail)\n\n\u002F\u002F Good: Immutable collections\nval users: List\u003CUser> = listOf(user1, user2)\nval filtered = users.filter { it.email.isNotBlank() }\n\n\u002F\u002F Bad: Mutable state\nvar currentUser: User? = null \u002F\u002F Avoid mutable global state\nval mutableUsers = mutableListOf\u003CUser>() \u002F\u002F Avoid unless truly needed\n```\n\n### 3. Expression Bodies and Single-Expression Functions\n\nUse expression bodies for concise, readable functions.\n\n```kotlin\n\u002F\u002F Good: Expression body\nfun isAdult(age: Int): Boolean = age >= 18\n\nfun formatFullName(first: String, last: String): String =\n    \"$first $last\".trim()\n\nfun User.displayName(): String =\n    name.ifBlank { email.substringBefore('@') }\n\n\u002F\u002F Good: When as expression\nfun statusMessage(code: Int): String = when (code) {\n    200 -> \"OK\"\n    404 -> \"Not Found\"\n    500 -> \"Internal Server Error\"\n    else -> \"Unknown status: $code\"\n}\n\n\u002F\u002F Bad: Unnecessary block body\nfun isAdult(age: Int): Boolean {\n    return age >= 18\n}\n```\n\n### 4. Data Classes for Value Objects\n\nUse data classes for types that primarily hold data.\n\n```kotlin\n\u002F\u002F Good: Data class with copy, equals, hashCode, toString\ndata class CreateUserRequest(\n    val name: String,\n    val email: String,\n    val role: Role = Role.USER,\n)\n\n\u002F\u002F Good: Value class for type safety (zero overhead at runtime)\n@JvmInline\nvalue class UserId(val value: String) {\n    init {\n        require(value.isNotBlank()) { \"UserId cannot be blank\" }\n    }\n}\n\n@JvmInline\nvalue class Email(val value: String) {\n    init {\n        require('@' in value) { \"Invalid email: $value\" }\n    }\n}\n\nfun getUser(id: UserId): User = userRepository.findById(id)\n```\n\n## Sealed Classes and Interfaces\n\n### Modeling Restricted Hierarchies\n\n```kotlin\n\u002F\u002F Good: Sealed class for exhaustive when\nsealed class Result\u003Cout T> {\n    data class Success\u003CT>(val data: T) : Result\u003CT>()\n    data class Failure(val error: AppError) : Result\u003CNothing>()\n    data object Loading : Result\u003CNothing>()\n}\n\nfun \u003CT> Result\u003CT>.getOrNull(): T? = when (this) {\n    is Result.Success -> data\n    is Result.Failure -> null\n    is Result.Loading -> null\n}\n\nfun \u003CT> Result\u003CT>.getOrThrow(): T = when (this) {\n    is Result.Success -> data\n    is Result.Failure -> throw error.toException()\n    is Result.Loading -> throw IllegalStateException(\"Still loading\")\n}\n```\n\n### Sealed Interfaces for API Responses\n\n```kotlin\nsealed interface ApiError {\n    val message: String\n\n    data class NotFound(override val message: String) : ApiError\n    data class Unauthorized(override val message: String) : ApiError\n    data class Validation(\n        override val message: String,\n        val field: String,\n    ) : ApiError\n    data class Internal(\n        override val message: String,\n        val cause: Throwable? = null,\n    ) : ApiError\n}\n\nfun ApiError.toStatusCode(): Int = when (this) {\n    is ApiError.NotFound -> 404\n    is ApiError.Unauthorized -> 401\n    is ApiError.Validation -> 422\n    is ApiError.Internal -> 500\n}\n```\n\n## Scope Functions\n\n### When to Use Each\n\n```kotlin\n\u002F\u002F let: Transform nullable or scoped result\nval length: Int? = name?.let { it.trim().length }\n\n\u002F\u002F apply: Configure an object (returns the object)\nval user = User().apply {\n    name = \"Alice\"\n    email = \"alice@example.com\"\n}\n\n\u002F\u002F also: Side effects (returns the object)\nval user = createUser(request).also { logger.info(\"Created user: ${it.id}\") }\n\n\u002F\u002F run: Execute a block with receiver (returns result)\nval result = connection.run {\n    prepareStatement(sql)\n    executeQuery()\n}\n\n\u002F\u002F with: Non-extension form of run\nval csv = with(StringBuilder()) {\n    appendLine(\"name,email\")\n    users.forEach { appendLine(\"${it.name},${it.email}\") }\n    toString()\n}\n```\n\n### Anti-Patterns\n\n```kotlin\n\u002F\u002F Bad: Nesting scope functions\nuser?.let { u ->\n    u.address?.let { addr ->\n        addr.city?.let { city ->\n            println(city) \u002F\u002F Hard to read\n        }\n    }\n}\n\n\u002F\u002F Good: Chain safe calls instead\nval city = user?.address?.city\ncity?.let { println(it) }\n```\n\n## Extension Functions\n\n### Adding Functionality Without Inheritance\n\n```kotlin\n\u002F\u002F Good: Domain-specific extensions\nfun String.toSlug(): String =\n    lowercase()\n        .replace(Regex(\"[^a-z0-9\\\\s-]\"), \"\")\n        .replace(Regex(\"\\\\s+\"), \"-\")\n        .trim('-')\n\nfun Instant.toLocalDate(zone: ZoneId = ZoneId.systemDefault()): LocalDate =\n    atZone(zone).toLocalDate()\n\n\u002F\u002F Good: Collection extensions\nfun \u003CT> List\u003CT>.second(): T = this[1]\n\nfun \u003CT> List\u003CT>.secondOrNull(): T? = getOrNull(1)\n\n\u002F\u002F Good: Scoped extensions (not polluting global namespace)\nclass UserService {\n    private fun User.isActive(): Boolean =\n        status == Status.ACTIVE && lastLogin.isAfter(Instant.now().minus(30, ChronoUnit.DAYS))\n\n    fun getActiveUsers(): List\u003CUser> = userRepository.findAll().filter { it.isActive() }\n}\n```\n\n## Coroutines\n\n### Structured Concurrency\n\n```kotlin\n\u002F\u002F Good: Structured concurrency with coroutineScope\nsuspend fun fetchUserWithPosts(userId: String): UserProfile =\n    coroutineScope {\n        val userDeferred = async { userService.getUser(userId) }\n        val postsDeferred = async { postService.getUserPosts(userId) }\n\n        UserProfile(\n            user = userDeferred.await(),\n            posts = postsDeferred.await(),\n        )\n    }\n\n\u002F\u002F Good: supervisorScope when children can fail independently\nsuspend fun fetchDashboard(userId: String): Dashboard =\n    supervisorScope {\n        val user = async { userService.getUser(userId) }\n        val notifications = async { notificationService.getRecent(userId) }\n        val recommendations = async { recommendationService.getFor(userId) }\n\n        Dashboard(\n            user = user.await(),\n            notifications = try {\n                notifications.await()\n            } catch (e: CancellationException) {\n                throw e\n            } catch (e: Exception) {\n                emptyList()\n            },\n            recommendations = try {\n                recommendations.await()\n            } catch (e: CancellationException) {\n                throw e\n            } catch (e: Exception) {\n                emptyList()\n            },\n        )\n    }\n```\n\n### Flow for Reactive Streams\n\n```kotlin\n\u002F\u002F Good: Cold flow with proper error handling\nfun observeUsers(): Flow\u003CList\u003CUser>> = flow {\n    while (currentCoroutineContext().isActive) {\n        val users = userRepository.findAll()\n        emit(users)\n        delay(5.seconds)\n    }\n}.catch { e ->\n    logger.error(\"Error observing users\", e)\n    emit(emptyList())\n}\n\n\u002F\u002F Good: Flow operators\nfun searchUsers(query: Flow\u003CString>): Flow\u003CList\u003CUser>> =\n    query\n        .debounce(300.milliseconds)\n        .distinctUntilChanged()\n        .filter { it.length >= 2 }\n        .mapLatest { q -> userRepository.search(q) }\n        .catch { emit(emptyList()) }\n```\n\n### Cancellation and Cleanup\n\n```kotlin\n\u002F\u002F Good: Respect cancellation\nsuspend fun processItems(items: List\u003CItem>) {\n    items.forEach { item ->\n        ensureActive() \u002F\u002F Check cancellation before expensive work\n        processItem(item)\n    }\n}\n\n\u002F\u002F Good: Cleanup with try\u002Ffinally\nsuspend fun acquireAndProcess() {\n    val resource = acquireResource()\n    try {\n        resource.process()\n    } finally {\n        withContext(NonCancellable) {\n            resource.release() \u002F\u002F Always release, even on cancellation\n        }\n    }\n}\n```\n\n## Delegation\n\n### Property Delegation\n\n```kotlin\n\u002F\u002F Lazy initialization\nval expensiveData: List\u003CUser> by lazy {\n    userRepository.findAll()\n}\n\n\u002F\u002F Observable property\nvar name: String by Delegates.observable(\"initial\") { _, old, new ->\n    logger.info(\"Name changed from '$old' to '$new'\")\n}\n\n\u002F\u002F Map-backed properties\nclass Config(private val map: Map\u003CString, Any?>) {\n    val host: String by map\n    val port: Int by map\n    val debug: Boolean by map\n}\n\nval config = Config(mapOf(\"host\" to \"localhost\", \"port\" to 8080, \"debug\" to true))\n```\n\n### Interface Delegation\n\n```kotlin\n\u002F\u002F Good: Delegate interface implementation\nclass LoggingUserRepository(\n    private val delegate: UserRepository,\n    private val logger: Logger,\n) : UserRepository by delegate {\n    \u002F\u002F Only override what you need to add logging to\n    override suspend fun findById(id: String): User? {\n        logger.info(\"Finding user by id: $id\")\n        return delegate.findById(id).also {\n            logger.info(\"Found user: ${it?.name ?: \"null\"}\")\n        }\n    }\n}\n```\n\n## DSL Builders\n\n### Type-Safe Builders\n\n```kotlin\n\u002F\u002F Good: DSL with @DslMarker\n@DslMarker\nannotation class HtmlDsl\n\n@HtmlDsl\nclass HTML {\n    private val children = mutableListOf\u003CElement>()\n\n    fun head(init: Head.() -> Unit) {\n        children += Head().apply(init)\n    }\n\n    fun body(init: Body.() -> Unit) {\n        children += Body().apply(init)\n    }\n\n    override fun toString(): String = children.joinToString(\"\\n\")\n}\n\nfun html(init: HTML.() -> Unit): HTML = HTML().apply(init)\n\n\u002F\u002F Usage\nval page = html {\n    head { title(\"My Page\") }\n    body {\n        h1(\"Welcome\")\n        p(\"Hello, World!\")\n    }\n}\n```\n\n### Configuration DSL\n\n```kotlin\ndata class ServerConfig(\n    val host: String = \"0.0.0.0\",\n    val port: Int = 8080,\n    val ssl: SslConfig? = null,\n    val database: DatabaseConfig? = null,\n)\n\ndata class SslConfig(val certPath: String, val keyPath: String)\ndata class DatabaseConfig(val url: String, val maxPoolSize: Int = 10)\n\nclass ServerConfigBuilder {\n    var host: String = \"0.0.0.0\"\n    var port: Int = 8080\n    private var ssl: SslConfig? = null\n    private var database: DatabaseConfig? = null\n\n    fun ssl(certPath: String, keyPath: String) {\n        ssl = SslConfig(certPath, keyPath)\n    }\n\n    fun database(url: String, maxPoolSize: Int = 10) {\n        database = DatabaseConfig(url, maxPoolSize)\n    }\n\n    fun build(): ServerConfig = ServerConfig(host, port, ssl, database)\n}\n\nfun serverConfig(init: ServerConfigBuilder.() -> Unit): ServerConfig =\n    ServerConfigBuilder().apply(init).build()\n\n\u002F\u002F Usage\nval config = serverConfig {\n    host = \"0.0.0.0\"\n    port = 443\n    ssl(\"\u002Fcerts\u002Fcert.pem\", \"\u002Fcerts\u002Fkey.pem\")\n    database(\"jdbc:postgresql:\u002F\u002Flocalhost:5432\u002Fmydb\", maxPoolSize = 20)\n}\n```\n\n## Sequences for Lazy Evaluation\n\n```kotlin\n\u002F\u002F Good: Use sequences for large collections with multiple operations\nval result = users.asSequence()\n    .filter { it.isActive }\n    .map { it.email }\n    .filter { it.endsWith(\"@company.com\") }\n    .take(10)\n    .toList()\n\n\u002F\u002F Good: Generate infinite sequences\nval fibonacci: Sequence\u003CLong> = sequence {\n    var a = 0L\n    var b = 1L\n    while (true) {\n        yield(a)\n        val next = a + b\n        a = b\n        b = next\n    }\n}\n\nval first20 = fibonacci.take(20).toList()\n```\n\n## Gradle Kotlin DSL\n\n### build.gradle.kts Configuration\n\n```kotlin\n\u002F\u002F Check for latest versions: https:\u002F\u002Fkotlinlang.org\u002Fdocs\u002Freleases.html\nplugins {\n    kotlin(\"jvm\") version \"2.3.10\"\n    kotlin(\"plugin.serialization\") version \"2.3.10\"\n    id(\"io.ktor.plugin\") version \"3.4.0\"\n    id(\"org.jetbrains.kotlinx.kover\") version \"0.9.7\"\n    id(\"io.gitlab.arturbosch.detekt\") version \"1.23.8\"\n}\n\ngroup = \"com.example\"\nversion = \"1.0.0\"\n\nkotlin {\n    jvmToolchain(21)\n}\n\ndependencies {\n    \u002F\u002F Ktor\n    implementation(\"io.ktor:ktor-server-core:3.4.0\")\n    implementation(\"io.ktor:ktor-server-netty:3.4.0\")\n    implementation(\"io.ktor:ktor-server-content-negotiation:3.4.0\")\n    implementation(\"io.ktor:ktor-serialization-kotlinx-json:3.4.0\")\n\n    \u002F\u002F Exposed\n    implementation(\"org.jetbrains.exposed:exposed-core:1.0.0\")\n    implementation(\"org.jetbrains.exposed:exposed-dao:1.0.0\")\n    implementation(\"org.jetbrains.exposed:exposed-jdbc:1.0.0\")\n    implementation(\"org.jetbrains.exposed:exposed-kotlin-datetime:1.0.0\")\n\n    \u002F\u002F Koin\n    implementation(\"io.insert-koin:koin-ktor:4.2.0\")\n\n    \u002F\u002F Coroutines\n    implementation(\"org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2\")\n\n    \u002F\u002F Testing\n    testImplementation(\"io.kotest:kotest-runner-junit5:6.1.4\")\n    testImplementation(\"io.kotest:kotest-assertions-core:6.1.4\")\n    testImplementation(\"io.kotest:kotest-property:6.1.4\")\n    testImplementation(\"io.mockk:mockk:1.14.9\")\n    testImplementation(\"io.ktor:ktor-server-test-host:3.4.0\")\n    testImplementation(\"org.jetbrains.kotlinx:kotlinx-coroutines-test:1.10.2\")\n}\n\ntasks.withType\u003CTest> {\n    useJUnitPlatform()\n}\n\ndetekt {\n    config.setFrom(files(\"config\u002Fdetekt\u002Fdetekt.yml\"))\n    buildUponDefaultConfig = true\n}\n```\n\n## Error Handling Patterns\n\n### Result Type for Domain Operations\n\n```kotlin\n\u002F\u002F Good: Use Kotlin's Result or a custom sealed class\nsuspend fun createUser(request: CreateUserRequest): Result\u003CUser> = runCatching {\n    require(request.name.isNotBlank()) { \"Name cannot be blank\" }\n    require('@' in request.email) { \"Invalid email format\" }\n\n    val user = User(\n        id = UserId(UUID.randomUUID().toString()),\n        name = request.name,\n        email = Email(request.email),\n    )\n    userRepository.save(user)\n    user\n}\n\n\u002F\u002F Good: Chain results\nval displayName = createUser(request)\n    .map { it.name }\n    .getOrElse { \"Unknown\" }\n```\n\n### require, check, error\n\n```kotlin\n\u002F\u002F Good: Preconditions with clear messages\nfun withdraw(account: Account, amount: Money): Account {\n    require(amount.value > 0) { \"Amount must be positive: $amount\" }\n    check(account.balance >= amount) { \"Insufficient balance: ${account.balance} \u003C $amount\" }\n\n    return account.copy(balance = account.balance - amount)\n}\n```\n\n## Collection Operations\n\n### Idiomatic Collection Processing\n\n```kotlin\n\u002F\u002F Good: Chained operations\nval activeAdminEmails: List\u003CString> = users\n    .filter { it.role == Role.ADMIN && it.isActive }\n    .sortedBy { it.name }\n    .map { it.email }\n\n\u002F\u002F Good: Grouping and aggregation\nval usersByRole: Map\u003CRole, List\u003CUser>> = users.groupBy { it.role }\n\nval oldestByRole: Map\u003CRole, User?> = users.groupBy { it.role }\n    .mapValues { (_, users) -> users.minByOrNull { it.createdAt } }\n\n\u002F\u002F Good: Associate for map creation\nval usersById: Map\u003CUserId, User> = users.associateBy { it.id }\n\n\u002F\u002F Good: Partition for splitting\nval (active, inactive) = users.partition { it.isActive }\n```\n\n## Quick Reference: Kotlin Idioms\n\n| Idiom | Description |\n|-------|-------------|\n| `val` over `var` | Prefer immutable variables |\n| `data class` | For value objects with equals\u002FhashCode\u002Fcopy |\n| `sealed class\u002Finterface` | For restricted type hierarchies |\n| `value class` | For type-safe wrappers with zero overhead |\n| Expression `when` | Exhaustive pattern matching |\n| Safe call `?.` | Null-safe member access |\n| Elvis `?:` | Default value for nullables |\n| `let`\u002F`apply`\u002F`also`\u002F`run`\u002F`with` | Scope functions for clean code |\n| Extension functions | Add behavior without inheritance |\n| `copy()` | Immutable updates on data classes |\n| `require`\u002F`check` | Precondition assertions |\n| Coroutine `async`\u002F`await` | Structured concurrent execution |\n| `Flow` | Cold reactive streams |\n| `sequence` | Lazy evaluation |\n| Delegation `by` | Reuse implementation without inheritance |\n\n## Anti-Patterns to Avoid\n\n```kotlin\n\u002F\u002F Bad: Force-unwrapping nullable types\nval name = user!!.name\n\n\u002F\u002F Bad: Platform type leakage from Java\nfun getLength(s: String) = s.length \u002F\u002F Safe\nfun getLength(s: String?) = s?.length ?: 0 \u002F\u002F Handle nulls from Java\n\n\u002F\u002F Bad: Mutable data classes\ndata class MutableUser(var name: String, var email: String)\n\n\u002F\u002F Bad: Using exceptions for control flow\ntry {\n    val user = findUser(id)\n} catch (e: NotFoundException) {\n    \u002F\u002F Don't use exceptions for expected cases\n}\n\n\u002F\u002F Good: Use nullable return or Result\nval user: User? = findUserOrNull(id)\n\n\u002F\u002F Bad: Ignoring coroutine scope\nGlobalScope.launch { \u002F* Avoid GlobalScope *\u002F }\n\n\u002F\u002F Good: Use structured concurrency\ncoroutineScope {\n    launch { \u002F* Properly scoped *\u002F }\n}\n\n\u002F\u002F Bad: Deeply nested scope functions\nuser?.let { u ->\n    u.address?.let { a ->\n        a.city?.let { c -> process(c) }\n    }\n}\n\n\u002F\u002F Good: Direct null-safe chain\nuser?.address?.city?.let { process(it) }\n```\n\n**Remember**: Kotlin code should be concise but readable. Leverage the type system for safety, prefer immutability, and use coroutines for concurrency. When in doubt, let the compiler help you.\n",{"name":5,"origin":34,"description":7},"ECC","master","8ec37df6d71fb664ea19d32c079e7d3ff931a8e0","skills\u002Fecc\u002Fkotlin-patterns",3,"https:\u002F\u002Fgithub.com\u002FS3YED\u002Fappie-kit","https:\u002F\u002Fweblyfe.ai","https:\u002F\u002Fgithub.com\u002FS3YED","2026-08-27 01:54:02",{"source":8,"skillName":5,"commands":44,"prompt":54,"zipAvailable":55},[45,48,51],{"tool":46,"command":47},"npx","npx skills add S3YED\u002Fappie-kit --skill kotlin-patterns",{"tool":49,"command":50},"bunx","bunx skills add S3YED\u002Fappie-kit --skill kotlin-patterns",{"tool":52,"command":53},"pnpm","pnpm dlx skills add S3YED\u002Fappie-kit --skill kotlin-patterns","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FS3YED\u002Fappie-kit\u002Fblob\u002Fmaster\u002Fskills\u002Fecc\u002Fkotlin-patterns\u002FSKILL.md",true,[],[58,94,129,155,186,210],{"skillNo":59,"name":60,"nameZh":6,"description":61,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":62,"categories":63,"keywords":75,"publishedAt":29},"01M6JFD4M6N4DSGC7TXEJ5R3J2","ai-music","AI music generation and audio tools: HeartMuLa lyrics-to-music generation, songwriting craft (+ Suno prompts), and audio spectrogram\u002Ffeature visualization.","https:\u002F\u002Fgithub.com\u002FS3YED\u002Fappie-kit\u002Fblob\u002Fmaster\u002Fskills\u002Fwethlete\u002Fai-music\u002FSKILL.md",[64,69,72],{"categoryNo":65,"categoryName":66,"taxonomyType":67,"taxonomyTypeDesc":68},"01JBSEEDCAT000000000000013","分析与可视化","SCENARIO","使用场景",{"categoryNo":70,"categoryName":71,"taxonomyType":67,"taxonomyTypeDesc":68},"01JBSEEDCAT000000000000016","图像与多媒体",{"categoryNo":73,"categoryName":74,"taxonomyType":67,"taxonomyTypeDesc":68},"01JBSEEDCAT000000000000023","Skill与智能体开发",[76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93],"music","ai music","humanizer","visualization","Tools","Audio","hermes","hermes agent","songwriting","suno","lyrics","prompts","heartmula","craft","generation","feature","ai music generation","music generation",{"skillNo":95,"name":96,"nameZh":6,"description":97,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":98,"categories":99,"keywords":108,"publishedAt":29},"01M6JFCZE4XNFQFMNZDHKHT5V5","agentic-webdesign-design-system-ingestion","Use v0 Design Systems 2.0, Bolt Design System Agents, or Lovable to generate production UI from a client's real design system components — not generic Tailwind. Use when building a client website where brand consistency matters.","https:\u002F\u002Fgithub.com\u002FS3YED\u002Fappie-kit\u002Fblob\u002Fmaster\u002Fskills\u002Fweb-design\u002Fagentic-webdesign-design-system-ingestion\u002FSKILL.md",[100,103],{"categoryNo":101,"categoryName":102,"taxonomyType":67,"taxonomyTypeDesc":68},"01JBSEEDCAT000000000000015","视觉设计",{"categoryNo":104,"categoryName":105,"taxonomyType":106,"taxonomyTypeDesc":107},"01JBSEEDCAT000000000000032","设计师","PROFESSION","适用职业",[109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128],"design","agentic","design system","system","ingestion","webdesign","agentic webdesign design system ingestion","components","generate","design systems","website","ui","Tailwind","bolt","lovable","v0","design-system","wed","design system components","appie",{"skillNo":130,"name":131,"nameZh":6,"description":132,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":133,"categories":134,"keywords":137,"publishedAt":29},"01M6JFCVPX3913CFAS6QQJ33ZB","agentic-webdesign-agent-elements","Use 21st.dev Agent Elements — 25 shadcn\u002Fui components purpose-built for AI agent UIs. Tool cards (Bash, Edit, Search, Plan, Subagent, MCP), chat, input, streaming. Open source, shadcn-registry install, no runtime lock-in.","https:\u002F\u002Fgithub.com\u002FS3YED\u002Fappie-kit\u002Fblob\u002Fmaster\u002Fskills\u002Fweb-design\u002Fagentic-webdesign-agent-elements\u002FSKILL.md",[135,136],{"categoryNo":73,"categoryName":74,"taxonomyType":67,"taxonomyTypeDesc":68},{"categoryNo":104,"categoryName":105,"taxonomyType":106,"taxonomyTypeDesc":107},[110,138,114,139,140,141,116,142,143,144,145,146,147,148,149,150,151,152,153,154],"elements","agentic webdesign agent elements","MCP","ai agent","registry","search","streaming","open source","open","Bash","plan","subagent","edit","install","input","lock","source",{"skillNo":156,"name":157,"nameZh":6,"description":158,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":159,"categories":160,"keywords":165,"publishedAt":29},"01M6JFCQC7H65M9QJ6TRE71BS1","vercel-deployment","Deploy static sites and frontends to Vercel — handles both CLI and REST API paths, including the CLI token sanitization workaround.","https:\u002F\u002Fgithub.com\u002FS3YED\u002Fappie-kit\u002Fblob\u002Fmaster\u002Fskills\u002Fsoftware-development\u002Fvercel-deployment\u002FSKILL.md",[161,164],{"categoryNo":162,"categoryName":163,"taxonomyType":67,"taxonomyTypeDesc":68},"01JBSEEDCAT000000000000011","运维与部署",{"categoryNo":73,"categoryName":74,"taxonomyType":67,"taxonomyTypeDesc":68},[166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185],"deployment","vercel deployment","vercel","macos","cli","linux","windows","deploy","vercel deploy","REST","api","site","deploy to vercel","token","rest api","host","sites","paths","sanitization","static site",{"skillNo":187,"name":188,"nameZh":6,"description":189,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":190,"categories":191,"keywords":193,"publishedAt":29},"01M6JFCM4SMTXBM5A01BK2YQG1","software-quality-workflows","Umbrella workflow for TDD, debugging, code simplification, spikes, pre-commit review, and debugger-assisted investigation.","https:\u002F\u002Fgithub.com\u002FS3YED\u002Fappie-kit\u002Fblob\u002Fmaster\u002Fskills\u002Fsoftware-development\u002Fsoftware-quality-workflows\u002FSKILL.md",[192],{"categoryNo":73,"categoryName":74,"taxonomyType":67,"taxonomyTypeDesc":68},[194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,27],"workflows","quality","software","software quality workflows","review","tdd","workflow","commit","debugging","code","debugger","pre-commit","investigation","code simplification","user","simplification",{"skillNo":211,"name":212,"nameZh":6,"description":213,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":214,"categories":215,"keywords":223,"publishedAt":29},"01M6JFCGD0M6CEATY01W7YN6DB","react-component-refactoring","Safely refactor large React components into smaller, maintainable pieces using proven patterns","https:\u002F\u002Fgithub.com\u002FS3YED\u002Fappie-kit\u002Fblob\u002Fmaster\u002Fskills\u002Fsoftware-development\u002Freact-component-refactoring\u002FSKILL.md",[216,219,222],{"categoryNo":217,"categoryName":218,"taxonomyType":67,"taxonomyTypeDesc":68},"01JBSEEDCAT000000000000007","代码审查",{"categoryNo":220,"categoryName":221,"taxonomyType":67,"taxonomyTypeDesc":68},"01JBSEEDCAT000000000000009","前端开发",{"categoryNo":73,"categoryName":74,"taxonomyType":67,"taxonomyTypeDesc":68},[224,225,226,227,228,229,230,231,169,232,233,116,234,172,235,203,236,237,20,238],"react","component","refactoring","component refactoring","react component","react component refactoring","frontend","writing","safe","typescript","react components","modular","refactor","simplify","test-driven-development"]