irahardianto/agy-perf-optimization-demo/kotlin-idioms
Claude Code and agent skill by irahardianto/agy-perf-optimization-demo
- community
Checking that the SKILL.md file is still in the repository.
Kotlin coding idioms: compile-time null safety, data classes, sealed hierarchies, coroutines and Flow concurrency, and Kotest/MockK testing. Use when developing, refactoring, or reviewing Kotlin backend, Android, or multiplatform code.
Install
npx vskill@latest install irahardianto/agy-perf-optimization-demo/kotlin-idiomsSKILL.md
Kotlin Idioms and Patterns
Kotlin rewards conciseness, null safety, and coroutine-based concurrency. Idiomatic Kotlin = safe, expressive, interop-aware.
Scope: Kotlin coding idioms. Test naming: .agents/rules/testing-strategy.md.
Null Safety
- `?` for nullable types — never platform types without annotation:
``kotlin fun findById(id: String): Task? // explicitly nullable fun getById(id: String): Task // guaranteed non-null — throws if not found ``
- Prefer `?.let {}` and `?:` (Elvis) over null checks.
- Never `!!` in production — use
requireNotNullwith a message.
Data Classes and Sealed Types
- `data class` for DTOs and domain objects:
``kotlin data class CreateTaskRequest(val title: String, val priority: Priority) ``
- `sealed class`/`sealed interface` for restricted hierarchies:
``kotlin sealed interface TaskResult { data class Success(val task: Task) : TaskResult data class NotFound(val id: String) : TaskResult data class ValidationError(val errors: List<String>) : TaskResult } ``
- Exhaustive `when` with sealed types:
``kotlin when (result) { is TaskResult.Success -> ok(result.task) is TaskResult.NotFound -> notFound(result.id) is TaskResult.ValidationError -> badRequest(result.errors) } ``
Coroutines
- Structured concurrency —
coroutineScope,supervisorScope. - Never `GlobalScope.launch` — always scoped.
- `Flow` for reactive streams:
``kotlin fun observeTasks(): Flow<List<Task>> = flow { while (currentCoroutineContext().isActive) { emit(storage.getAll()) delay(5.seconds) } } ``
Naming
- PascalCase for classes. camelCase for functions, properties.
- No `get`/`set` prefixes — use properties.
- Backtick function names only in tests: `
should create task when valid()`
Testing
- kotest or JUnit 5 + MockK:
``kotlin @Test fun create task returns task when valid() { val result = service.create("Test", Priority.HIGH) assertThat(result.title).isEqualTo("Test") } ``
Formatting and Static Analysis
| Tool | Purpose | Command | |
|---|---|---|---|
ktlint | Formatting | ktlint --format | |
detekt | Static analysis | detekt --config detekt.yml | |
| Kotlin compiler | Null safety | Built-in |
Related
- Code Idioms and Conventions .agents/rules/code-idioms-and-conventions.md
- Testing Strategy .agents/rules/testing-strategy.md
- Error Handling Principles .agents/rules/error-handling-principles.md
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingflashmart-api/.agents/skills/kotlin-idioms/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/irahardianto/agy-perf-optimization-demo/kotlin-idioms)