·
Last changedVersion:
This version passed the hardening gate. Hardening applied 8 targeted changes and preserved all other text. Classified findings before hardening: 0. Classified findings closed: 0. Classified findings remaining: 0. Unclassified scanner findings remaining: 0. Review findings closed: 7. Review findings remaining: 1.
None
None
Expand | File | Group | Subtype | Severity | Status |
|---|
No findings available
0 findings
Your goal is to help me write high-quality, idiomatic Spring Boot applications using Kotlin.
pom.xml) or Gradle (build.gradle) with the Kotlin plugins (kotlin-maven-plugin or org.jetbrains.kotlin.jvm).kotlin-jpa plugin, which generates the no argument constructors that entities need. It does not make classes open. For that, use the Kotlin all open compiler plugin configured for the entity, mapped superclass and embeddable annotations. Also apply the Kotlin Spring compiler plugin, a preset of the all open plugin, so Spring annotated classes and methods are open for proxying.spring-boot-starter-web, spring-boot-starter-data-jpa) as usual.com.example.app.order, com.example.app.user) rather than by layer.private val in the primary constructor. Prefer val over var everywhere to promote immutability.@Service, @Repository, and @RestController annotations just as you would in Java.application.yml for its readability and hierarchical structure.@ConfigurationProperties with data class to create immutable, type-safe configuration objects.application-dev.yml, application-prod.yml) to manage environment-specific configurations.data class for all DTOs. This provides equals(), hashCode(), toString(), and copy() for free and promotes immutability.@Valid, @NotNull, @Size) on your DTO data classes. On data class constructor properties, apply constraint annotations with the field use site target so they are actually validated, and place the Valid annotation on the controller request body parameter or on nested properties. Add the Spring Boot validation starter.@ControllerAdvice and @ExceptionHandler for consistent error responses.@Service classes.@Transactional on service methods. In Kotlin, this can be applied to class or function level. Kotlin classes and functions are final by default, so this relies on the Kotlin Spring compiler plugin to make them open for proxying.data class types. Remember they must be open and need no argument constructors. Use the all open compiler plugin to make them open and the kotlin-jpa compiler plugin to generate the constructors.?) to clearly define which entity fields are optional or required at the type level.JpaRepository or CrudRepository.logger.info("Processing user {}...", userId)) for performance and clarity.@WebMvcTest or @DataJpaTest to test specific parts of the application.suspend functions: For non-blocking asynchronous code, use suspend functions in your controllers and services. Spring Boot has excellent support for coroutines.coroutineScope or supervisorScope to manage the lifecycle of coroutines.Get started with chainctlchainctl skill install public/github/kotlin-springboot:latest
Bring Chainguard's hardening pipeline to your first-party skills — custom rulesets, automated remediation, full audit trail.
skills.cgr.dev/public/github.com/github/skills/kotlin-springboot:latest
MIT
HARDENING.md
LICENSE
SKILL.md