Agent skill
kotlin-spring
Spring Boot with Kotlin - controllers, services, coroutines
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/development/kotlin-spring
SKILL.md
Kotlin Spring Skill
Idiomatic Spring Boot development with Kotlin.
Topics Covered
REST Controllers
@RestController
@RequestMapping("/api/v1/users")
class UserController(private val userService: UserService) {
@GetMapping
suspend fun findAll(): List<UserDTO> = userService.findAll()
@GetMapping("/{id}")
suspend fun findById(@PathVariable id: Long): UserDTO =
userService.findById(id) ?: throw ResponseStatusException(NOT_FOUND)
@PostMapping
@ResponseStatus(CREATED)
suspend fun create(@Valid @RequestBody request: CreateUserRequest) =
userService.create(request)
}
Coroutines Integration
@Service
class UserService(private val repository: UserRepository) {
suspend fun findAll() = withContext(Dispatchers.IO) {
repository.findAll().map { it.toDTO() }
}
}
Data JPA
@Entity
@Table(name = "users")
class User(
@Id @GeneratedValue val id: Long = 0,
@Column(nullable = false) val email: String,
@Column(nullable = false) val name: String
)
interface UserRepository : JpaRepository<User, Long> {
fun findByEmail(email: String): User?
}
Testing
@WebMvcTest(UserController::class)
class UserControllerTest {
@Autowired lateinit var mockMvc: MockMvc
@MockkBean lateinit var userService: UserService
@Test
fun `GET users returns list`() {
every { userService.findAll() } returns listOf(user)
mockMvc.get("/api/v1/users").andExpect { status { isOk() } }
}
}
Troubleshooting
| Issue | Resolution |
|---|---|
| @RequestBody null | Add jackson-module-kotlin |
| Coroutines not working | Enable WebFlux or use blocking |
Usage
Skill("kotlin-spring")
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?