원클릭으로
kotlin-patterns
Conventions for using Kotlin
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Conventions for using Kotlin
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
| name | kotlin patterns |
| description | Conventions for using Kotlin |
!! operatorThe !! operator should be avoided in Kotlin as it can lead to NullPointerException at runtime. Instead, use safe calls (?.) or the let scope function to handle nullable values more gracefully.
?.) when possibleUsing the safe call operator (?.) is a good practice, but it should be used judiciously.
It makes no sense to use this operator when the value is guaranteed to be non-null, as it can lead to unnecessary null checks and reduce code readability.
var when possibleIn Kotlin, it is recommended to use val instead of var whenever possible. This helps to make the code more readable and maintainable, as it makes it clear that the value of a variable is not expected to change.
When using the delay function, it is recommended to use the overload that accepts a Duration parameter instead of a Long parameter. This makes the code more readable and easier to understand, as it clearly indicates the intended duration of the delay.
replace this:
delay(100)
with this:
delay(100.milliseconds)
Add import: import kotlin.time.Duration.Companion.milliseconds
Code does not need to be signed. The code signature used to have some value, but in current times, the commit already has a signature. Old code may contain signatures that look like this:
/**
* Created by joao on 28-4-16.
*/
They should all be removed, as they are not needed and add no value to the code.
[ ] The code does not use the !! operator.
[ ] The code does not use the safe call operator (?.) when the value is guaranteed to be non-null.
[ ] The code uses val instead of var whenever possible.
[ ] The code uses the Duration overload when using the delay function.
[ ] The code does not contain any code signatures.