alpha

Lays down Kotlin best practices for Spring Boot: package layout, naming, immutability, null safety, JPA setup and unit testing.
description: "Cursor rules for Kotlin Springboot Best Practices."
globs: */
alwaysApply: false
val by default, and only use var when mutation is necessary to promote safer, more predictable code.val maxConnections = 10 // immutable reference
var currentUsers = 0 // mutable, try to avoid if possible
equals() and copy() without writing boilerplate code.// Kotlin – use default parameters
fun createConnection(host: String, secure: Boolean = true) { … }
createConnection("example.com") // uses default secure=true
createConnection(host = "test.com", secure = false) // named arg for clarity
when expressions instead of long if-else chains to write cleaner, more readable conditional logic that clearly handles each case.fun String.capitalizeFirst(): String = replaceFirstChar { it.uppercaseChar() }
println("kotlin".capitalizeFirst()) // prints "Kotlin"
apply, let, also, run, and with to reduce repetition and clearly express object configuration or null-safe operations.?.) and the Elvis operator (?:) to avoid runtime crashes.!!) and instead provide fallback values or explicit null checks to write safer and more predictable code.String or String? to avoid spreading nullability uncertainty in your Kotlin code.filter, map, and forEach instead of manual loops to write concise and expressive data transformation logic.// Imperative approach
val activeUsers = mutableListOf<User>()
for (user in users) {
if (user.isActive) activeUsers.add(user)
}
// Idiomatic functional approach
val activeUsers = users.filter { it.isActive }
fun toDto(entity: User) = UserDto(name = entity.name, email = entity.email)
$var or ${expression}) instead of concatenation, and use triple-quoted strings for clean multi-line text.val to keep them immutable and to align with Spring and Kotlin idioms.@Service
class OrderService(
private val orderRepo: OrderRepository,
private val notifier: Notifier
) {
// ...
}
final by default, and let Spring’s 'all-open' plugin handle proxy generation so you don’t need to manually add the open modifier.object declaration for true singletons or stateless utility holders instead of static methods or Java-style singletons.when expressions.sealed class Result<out T>
data class Success<T>(val data: T): Result<T>()
data class Error(val exception: Throwable): Result<Nothing>()
use the use function to safely manage and close resources like streams and file handles, ensuring they are closed even if an exception occurs.FileInputStream("data.txt").use { stream ->
// read from stream
} // stream is automatically closed here
private or internal where possible, and only expose what’s truly necessary as public.launch or async to write clean, asynchronous backend code without callback hell.lazy, observable, infix, and operator overloading to write concise, expressive, and idiomatic code.val fields and Kotlin’s JPA plugin to satisfy JPA requirements while keeping your models safe and thread-friendly.Public domain (CC0 1.0) · by awesome-cursorrules contributors · source · posted by @OpenSourceBuffGuy on promptparty.com


Sea turtle carrying floating film studio island
Draws a giant sea turtle carrying a floating island film studio through a starry sky, where fairies polish rough film strips into golden film.
image-prompt, nano-banana, 3d-render, cartoon, fantasy-world, creatures, animals, whimsical, dreamy, cinematic, dramatic-lighting, vibrant-colors, bokeh, miniature, widescreen, night-scene, illustration, concept-art, surreal, storytelling, clay-3d

Desert buggy escapes drones past industrial outpost
Builds a 15-second desert chase video where a racer in an armored buggy escapes drones past an industrial outpost, using five reference images with set jobs.
video-prompt, hailuo, action, multi-shot, timed-beats, camera-movement, reference-image, character-consistency, negative-prompt, cinematic, sci-fi, cars, landscape, aerial-view, tracking-shot, photorealistic, sound-effects, structured-output, long-form, widescreen

Cozy Pixel Art Farm Island Village
Draws a cozy 16-bit pixel-art farming village across six small islands joined by bridges, with exact counts for buildings, animals and crops.
image-prompt, gpt-image, pixel-art, isometric, game-assets, concept-art, maps, worldbuilding, cozy, vibrant-colors, ocean, landscape, wide-shot, widescreen, game-development, video-games, structured-output, whimsical, summer, high-angle, aerial-view, animals, negative-prompt, cityscape
Loading reviews…
Loading comments…