Install
$ agentstack add skill-vrallev-agent-skills-kotlin-conventions ✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
About
Kotlin Conventions
Apply these conventions unless another rule explicitly overrides them.
Class Layout
Organize class contents in this order:
- Property declarations and initializer blocks
- Secondary constructors
- Method declarations
- Companion object
Do not sort method declarations alphabetically or by visibility, and do not separate regular methods from extension methods. Group related code so that someone reading the class from top to bottom can follow its logic. Choose either higher-level-first or lower-level-first ordering and apply it consistently.
One Top-Level Class Per File
Prefer one top-level class per file. Create additional files when necessary.
Prefer:
Class1.kt
class Class1 {}
Class2.kt
class Class2 {}
Do not use:
Classes.kt
class Class1 {}
class Class2 {}
Lambdas Over Method References
Prefer lambdas over method references. For example, use abc.doSomething { it.abc() } instead of abc.doSomething(Abc::abc).
Inline Unshared Constants
Do not extract constants merely for the sake of extraction. Inline values that are not shared.
Do:
class Class1 {
fun hello() {
println("Test")
}
}
Don't:
class Class1 {
fun hello() {
println(TEST_MESSAGE)
}
}
private const val TEST_MESSAGE = "Test"
Smallest Possible Scope
Use the smallest possible scope for language constructs. For example, nest an extension function used by only one class inside that class rather than declaring it as a private top-level function next to the class.
For an extension function used by one class, do:
class Class1 {
fun hello() {
"Test".inConsole()
}
private fun String.inConsole() = println(this)
}
Don't:
class Class1 {
fun hello() {
"Test".inConsole()
}
}
private fun String.inConsole() = println(this)
For a constant used by one class, do:
class Class1 {
fun hello1() {
println(PROFILE_PICTURE_KEY)
}
fun hello2() {
println(PROFILE_PICTURE_KEY)
}
private companion object {
const val PROFILE_PICTURE_KEY = "profile-picture"
}
}
Don't:
class Class1 {
fun hello1() {
println(PROFILE_PICTURE_KEY)
}
fun hello2() {
println(PROFILE_PICTURE_KEY)
}
}
private const val PROFILE_PICTURE_KEY = "profile-picture"
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: vRallev
- Source: vRallev/agent-skills
- License: Apache-2.0
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet — be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.