kotlin-springboot — GitHub Copilot skill: install and use
This skill guides Spring Boot and Kotlin work, from project structure to tests and coroutines. Use it when an agent is writing or reviewing a backend service.
npx skills add github/awesome-copilot --skill kotlin-springbootWhat kotlin-springboot does
kotlin-springboot gives GitHub Copilot guidance for Spring Boot applications written in Kotlin. It recommends package structure by domain, required dependency injection through primary constructors, and private val dependencies. It also covers data class DTOs, application.yml, and immutable @ConfigurationProperties objects.
The skill addresses REST controllers, shared exception handling, @Transactional, Spring Data JPA, and Kotlin null safety. For JPA entities, it recommends the kotlin-jpa plugin so classes become open automatically. Guidance also includes companion-object logging, JUnit 5, Kotest, MockK, Testcontainers, and suspend functions.
Install it for a Kotlin Spring Boot codebase. It is a poor fit for a Java-only application.
What it helps with
- structure a Kotlin Spring Boot project by domain
- create DTOs with Kotlin
data class - configure JPA entities with
kotlin-jpa - add shared REST API error handling
- write repository tests with Testcontainers
Example prompts for the agent
- "Create a Kotlin REST controller with DTO validation using `@Valid`."
- "Review the JPA entities and add `kotlin-jpa` to `build.gradle`."
- "Write a Testcontainers integration test for this repository."
How to install kotlin-springboot
1Skills CLI (Vercel)
npx skills add github/awesome-copilot --skill kotlin-springboot2GitHub CLI
gh skill install github/awesome-copilot kotlin-springboot3Manually: put the files in place
.github/skills/kotlin-springboot/SKILL.md1Skills CLI (Vercel)
npx skills add github/awesome-copilot --skill kotlin-springboot -a claude-code2Manually: put the files in place
~/.claude/skills/kotlin-springboot/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/kotlin-springboot/
Manually: put the files in place
.agents/skills/kotlin-springboot/SKILL.mdFor all projects use ~/.agents/skills/
Manually: put the files in place
.cursor/skills/kotlin-springboot/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
Platform CLI
gemini skills install https://github.com/github/awesome-copilot --path skills/kotlin-springbootManually: put the files in place
.devin/skills/kotlin-springboot/SKILL.mdThe legacy .windsurf/skills/ path still works
Claude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
From the same set554
The whole set →Similar
Questions about kotlin-springboot
How do I install kotlin-springboot in GitHub Copilot?
Run npx skills add github/awesome-copilot --skill kotlin-springboot. You can also use gh skill install github/awesome-copilot kotlin-springboot.
What does the kotlin-springboot skill do?
It gives GitHub Copilot conventions for Spring Boot development in Kotlin. The guidance covers dependency injection, configuration, REST APIs, JPA, testing, logging, and coroutines.
What does Kotlin need for JPA entities?
The skill recommends kotlin-jpa so JPA entity classes are made open automatically. It suggests JpaRepository or CrudRepository for Spring Data JPA repositories.
Source text
SKILL.md · MIT
---
name: kotlin-springboot
description: 'Get best practices for developing applications with Spring Boot and Kotlin.'
---
# Spring Boot with Kotlin Best Practices
Your goal is to help me write high-quality, idiomatic Spring Boot applications using Kotlin.
## Project Setup & Structure
- **Build Tool:** Use Maven (`pom.xml`) or Gradle (`build.gradle`) with the Kotlin plugins (`kotlin-maven-plugin` or `org.jetbrains.kotlin.jvm`).
- **Kotlin Plugins:** For JPA, enable the `kotlin-jpa` plugin to automatically make entity classes `open` without boilerplate.
- **Starters:** Use Spring Boot starters (e.g., `spring-boot-starter-web`, `spring-boot-starter-data-jpa`) as usual.
- **Package Structure:** Organize code by feature/domain (e.g., `com.example.app.order`, `com.example.app.user`) rather than by layer.
## Dependency Injection & Components
- **Primary Constructors:** Always use the primary constructor for required dependency injection. It's the most idiomatic and concise approach in Kotlin.
- **Immutability:** Declare dependencies as `private val` in the primary constructor. Prefer `val` over `var` everywhere to promote immutability.
- **Component Stereotypes:** Use `@Service`, `@Repository`, and `@RestController` annotations just as you would in Java.
## Configuration
- **Externalized Configuration:** Use `application.yml` for its readability and hierarchical structure.
- **Type-Safe Properties:** Use `@ConfigurationProperties` with `data class` to create immutable, type-safe configuration objects.
- **Profiles:** Use Spring Profiles (`application-dev.yml`, `application-prod.yml`) to manage environment-specific configurations.
- **Secrets Management:** Never hardcode secrets. Use environment variables or a dedicated secret management tool like HashiCorp Vault or AWS Secrets Manager.
## Web Layer (Controllers)
- **RESTful APIs:** Design clear and consistent RESTful endpoints.
- **Data Classes for DTOs:** Use Kotlin `data class` for all DTOs. This provides `equals()`, `hashCode()`, `toString()`, and `copy()` for free and promotes immutability.
- **Validation:** Use Java Bean Validation (JSR 380) with annotations (`@Valid`, `@NotNull`, `@Size`) on your DTO data classes.
- **Error Handling:** Implement a global exception handler using `@ControllerAdvice` and `@ExceptionHandler` for consistent error responses.
## Service Layer
- **Business Logic:** Encapsulate business logic within `@Service` classes.
- **Statelessness:** Services should be stateless.
- **Transaction Management:** Use `@Transactional` on service methods. In Kotlin, this can be applied to class or function level.
## Data Layer (Repositories)
- **JPA Entities:** Define entities as classes. Remember they must be `open`. It's highly recommended to use the `kotlin-jpa` compiler plugin to handle this automatically.
- **Null Safety:** Leverage Kotlin's null-safety (`?`) to clearly define which entity fields are optional or required at the type level.
- **Spring Data JPA:** Use Spring Data JPA repositories by extending `JpaRepository` or `CrudRepository`.
- **Coroutines:** For reactive applications, leverage Spring Boot's support for Kotlin Coroutines in the data layer.
## Logging
- **Companion Object Logger:** The idiomatic way to declare a logger is in a companion object.
```kotlin
companion object {
private val logger = LoggerFactory.getLogger(MyClass::class.java)
}
```
- **Parameterized Logging:** Use parameterized messages (`logger.info("Processing user {}...", userId)`) for performance and clarity.
## Testing
- **JUnit 5:** JUnit 5 is the default and works seamlessly with Kotlin.
- **Idiomatic Testing Libraries:** For more fluent and idiomatic tests, consider using **Kotest** for assertions and **MockK** for mocking. They are designed for Kotlin and offer a more expressive syntax.
- **Test Slices:** Use test slice annotations like `@WebMvcTest` or `@DataJpaTest` to test specific parts of the application.
- **Testcontainers:** Use Testcontainers for reliable integration tests with real databases, message brokers, etc.
## Coroutines & Asynchronous Programming
- **`suspend` functions:** For non-blocking asynchronous code, use `suspend` functions in your controllers and services. Spring Boot has excellent support for coroutines.
- **Structured Concurrency:** Use `coroutineScope` or `supervisorScope` to manage the lifecycle of coroutines.
© github · MIT · github/awesome-copilot