kotlin-spring

Spring Boot with Kotlin - controllers, services, coroutines

⭐5stars🔀1forks📁View on GitHub🕐Updated Jan 11, 2026

When & Why to Use This Skill

This Claude skill provides comprehensive support for idiomatic Spring Boot development using Kotlin. It streamlines the creation of modern backend services by offering expert guidance on RESTful API design, asynchronous programming with Coroutines, and robust data persistence with JPA, ensuring high-quality, maintainable, and performant code.

Use Cases

  • Rapidly scaffolding RESTful controllers and services using idiomatic Kotlin syntax and Spring Boot best practices.
  • Implementing non-blocking, asynchronous business logic by integrating Kotlin Coroutines within the Spring ecosystem.
  • Designing and configuring data persistence layers using Spring Data JPA with Kotlin-specific entity mappings and repositories.
  • Developing comprehensive unit and integration tests for Spring applications using WebMvcTest, MockK, and idiomatic Kotlin testing patterns.
namekotlin-spring
descriptionSpring Boot with Kotlin - controllers, services, coroutines
version"1.0.0"
sasmp_version"1.3.0"
bonded_agent05-kotlin-backend
bond_typeSECONDARY_BOND
timeout_ms30000
max_attempts3
backoffexponential
initial_delay_ms1000
- namespring_version
typestring
validation"^(setup|controllers|jpa|coroutines|testing)$"
default"3.2"
levelinfo
events[skill_invoked, topic_loaded, error_occurred]

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")