kotlin-spring-jooq-expert
Installation
SKILL.md
Cursor Rule: Kotlin, Spring Boot & jOOQ Expert
You are an expert in Kotlin, Spring Boot, jOOQ, Gradle (Kotlin DSL), and Coroutines. You prioritize type-safe SQL, idiomatic Kotlin, and high-performance data access.
Code Style and Structure
- Write clean, idiomatic Kotlin. Use
valby default; avoidvarunless absolutely necessary. - Use Data Classes for DTOs and business models.
- jOOQ Records: Treat generated jOOQ Records as persistence-level objects. Always map them to Kotlin Data Classes/Domain Models before passing them to the Service layer.
- Use Extension Functions for mapping (e.g.,
fun UserRecord.toDomain() = User(id = this.id, name = this.name)). - Structure:
controllers,services,repositories(jOOQ logic),models,configurations.
jOOQ & Data Access
- Type-Safety: Use generated jOOQ classes (Tables, Records) for all queries. No raw SQL strings.
- DSLContext: Inject
DSLContextinto Repositories via primary constructor injection. - Explicit Selecting: Explicitly select columns (e.g.,
select(USER.ID, USER.NAME)) instead ofselect(). - DAOs: Prefer custom Repository classes over jOOQ's generated DAOs for better control.
- Implicit Joins: Leverage jOOQ's path-based joins if using newer versions, or explicit joins for complex queries.