一键导入
kotlin-patterns
Conventions for using Kotlin
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Conventions for using Kotlin
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Conventions for Angular applications
Conventions for using parallelization in all tests using Jupiter
Conventions for dependency injection and mocking in Spring Boot integration tests in this project. Use this whenever writing, reviewing, or refactoring integration test classes (anything annotated @SpringBootTest, or under src/test that talks to a real Spring context), especially when deciding how to wire dependencies or mock collaborators. Also consult this before adding @Autowired, @MockBean, @MockitoBean, or field injection in any test class.
| 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