create-slidev-presenta…
Build or edit Slidev (sli.dev) presentations for tech talks, workshops, conference sessions, and live-coding demos. Use when the user asks to create slides, a…
Kotlin coding standards for modern applications. Includes naming conventions, coroutines, flows, modern Kotlin 2.3.0 features, and recommended tooling.
$ npx -y skills add b33eep/claude-code-setup --skill standards-kotlin --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/standards-kotlinContext preview
The summary Claude sees to decide when to auto-load this skill.
Kotlin coding standards for modern applications. Includes naming conventions, coroutines, flows, modern Kotlin 2.3.0 features, and recommended tooling.
name: standards-kotlin description: Kotlin coding standards for modern applications. Includes naming conventions, coroutines, flows, modern Kotlin 2.3.0 features, and recommended tooling. type: context applies_to: [kotlin, gradle, maven, junit, kotest, kotlinx-coroutines, ktor, spring, mockk, testcontainers] file_extensions: [".kt", ".kts"]
1. **Explicitness**: Explicit code over implicit magic 2. **Readability**: Readable code over clever tricks 3. **Null Safety**: Embrace Kotlin's null safety system 4. **Immutability**: Prefer `val` over `var`, immutable collections 5. **Expressiveness**: Use Kotlin's expressive features (data classes, sealed classes) 6. **DRY**: Don't Repeat Yourself - but keep it simple
| Element | Convention | Example | |---------|------------|---------| | Classes | PascalCase | `UserService`, `OrderRepository` | | Interfaces | PascalCase | `UserRepository`, `PaymentProcessor` | | Functions | camelCase | `getUserById`, `calculateTotal` | | Properties | camelCase | `firstName`, `totalAmount` | | Constants | UPPER_SNAKE_CASE | `MAX_RETRY_COUNT`, `DEFAULT_TIMEOUT` | | Packages | lowercase.dot.separated | `com.example.service`, `com.example.repository` | | Files | PascalCase.kt | `UserService.kt`, `OrderRepository.kt` | | Test Classes | ClassNameTest | `UserServiceTest`, `OrderRepositoryTest` | | Test Functions | backtick names | `` `should return user when id exists` `` |
myproject/ ├── build.gradle.kts ├── settings.gradle.kts ├── gradle.properties ├── src/ │ ├── main/ │ │ ├── kotlin/ │ │ │ └── com/example/myapp/ │ │ │ ├── Application.kt # Main entry point │ │ │ ├── config/ │ │ │ │ └── AppConfig.kt # Configuration │ │ │ ├── domain/ │ │ │ │ └── User.kt # Domain models │ │ │ ├── repository/ │ │ │ │ └── UserRepository.kt # Data access │ │ │ ├── service/ │ │ │ │ └── UserService.kt # Business logic │ │ │ └── api/ │ │ │ └── UserController.kt # REST endpoints │ │ └── resources/ │ │ ├── application.conf │ │ └── logback.xml │ └── test/ │ ├── kotlin/ │ │ └── com/example/myapp/ │ │ ├── service/ │ │ │ └── UserServiceTest.kt │ │ └── repository/ │ │ └── UserRepositoryTest.kt │ └── resources/ │ └── application-test.conf └── README.md
myproject/ ├── pom.xml ├── src/ │ ├── main/ │ │ └── kotlin/... # Same structure as Gradle │ └── test/ │ └── kotlin/... # Same structure as Gradle └── README.md
> **Recommended:** Use Kotlin 2.3.0 (latest LTS) for new projects with K2 compiler enabled by default.
The K2 compiler brings significant performance improvements and faster compilation times.
**Features:**
**Enabled by default in Kotlin 2.3.0** - no configuration needed.
Use data classes for immutable data holders.
// Data class - automatic equals, hashCode, toString, copy, componentN
data class User(
val id: String,
val name: String,
val email: String,
val age: Int
)
// Usage
val user = User("1", "John Doe", "john@example.com", 30)
// Copy with changes
val updatedUser = user.copy(age = 31)
// Destructuring
val (id, name, email, age) = user
println("User: $name ($email)")Use sealed classes for type-safe state modeling with exhaustive `when` expressions.
// Sealed interface for result types
sealed interface Result<out T> {
data class Success<T>(val data: T) : Result<T>
data class Error(val message: String, val cause: Throwable? = null) : Result<Nothing>
data object Loading : Result<Nothing>
}
// Exhaustive when - compiler ensures all cases are handled
fun <T> handleResult(result: Result<T>) {
when (result) {
is Result.Success -> println("Success: ${result.data}")
is Result.Error -> println("Error: ${result.message}")
Result.Loading -> println("Loading...")
// No else needed - compiler knows all cases
}
}
// Usage
val result: Result<User> = Result.Success(user)
handleResult(result)Use inline value classes for type-safe wrappers without runtime overhead.
// Inline value class - no boxing overhead
@JvmInline
value class UserId(val value: String)
@JvmInline
value class Email(val value: String) {
init {
require(value.contains("@")) { "Invalid email" }
}
}
// Usage - type-safe, no runtime cost
fun getUserById(id: UserId): User = TODO()
fun sendEmail(email: Email): Unit = TODO()
val userId = UserId("123")
val email = Email("user@example.com")Context receivers allow implicit parameters for cleaner DSLs.
**Enable with:**
// build.gradle.kts
kotlin {
compilerOptions {
freeCompilerArgs.add("-Xcontext-receivers")
}
}**Usage:**
interface Logger {
fun log(message: String)
}
// Function with context receiver
context(Logger)
fun processUser(user: User) {
log("PrPersistent memory for Claude Code via Markdown files. 📖 Read the Documentation for detailed guides, tutorials, and reference.
Repo: b33eep/claude-code-setup
Build or edit Slidev (sli.dev) presentations for tech talks, workshops, conference sessions, and live-coding demos. Use when the user asks to create slides, a…
Guide users through creating, reviewing, and fixing custom skills for Claude — both command skills (invoked via /slash) and context skills (auto-loaded by tech…
Gradle build tool standards focusing on Kotlin DSL. Covers project configuration, dependency management, and custom plugin/task development with Gradle 9 LTS.
Java coding standards for enterprise applications. Includes naming conventions, modern Java features, design patterns, and recommended tooling.
This skill provides JavaScript coding standards and is automatically loaded for JavaScript projects. It includes modern ES2025 patterns, async handling, and…
This skill provides Python coding standards and is automatically loaded for Python projects. It includes naming conventions, best practices, and recommended…