/java-kotlin-development:java-helidonfrom java-kotlin-development
Apply Helidon 4 SE and MP best practices for Java 21 apps: routing, DB Client, Jakarta/MicroProfile APIs, config, security, observability, and tests. Covers Helidon 3-to-4 API migrations.
Ships in java-kotlin-development. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Guide Helidon 4 code generation and review so SE and MP applications compile, keep business logic out of transport layers, use Java 21 idioms, bind data safely, and avoid common Helidon 3 API mistakes.
Check generated code against this table before returning it. The left column commonly appears in older examples and does not compile or is wrong for Helidon 4.
| Do not use | Use in Helidon 4 |
|---|---|
io.helidon.common.http.Http.Status | io.helidon.http.Status |
io.helidon.webserver.Service | io.helidon.webserver.http.HttpService |
Routing.Rules, update(Routing.Rules) | HttpRules, routing(HttpRules) |
request.path().param("id") | request.path().pathParameters().get("id") |
String s = column.as(String.class) | column.getString() or column.get(String.class) |
dbClient.execute(exec -> ...) returning Single/Multi | dbClient.execute() returning Optional<DbRow> or Stream<DbRow> |
javax.* | jakarta.* |
helidon-microprofile-tests-junit5 | helidon-microprofile-testing-junit5 |
Value.as(Class) returns OptionalValue<T>, not T; DbColumn.as(String.class) returns OptionalValue<String>, not String. This is the most common generated-code compile error in high-quality Helidon 4 work.
Migration tokens to verify explicitly: DbColumn.as(String.class), OptionalValue<String>, String.
| Concern | Rule |
|---|---|
| Programming model | Determine whether the repository uses Helidon SE or Helidon MP before generating code; do not mix them unless explicitly required. |
| Java version | Use Java 21 or later for Helidon 4. |
| Build | Use the existing pom.xml or build.gradle; align Helidon versions with the Helidon BOM or platform. |
| Packages | Organize by feature or domain, such as com.example.app.order and com.example.app.customer, not only technical layers. |
| Configuration files | Store non-secret configuration in application.yaml or application.properties; use environment-dependent and deployment-specific overrides for runtime values. |
| Secrets | Never hardcode credentials, API keys, tokens, private certificates, DB_USERNAME, or DB_PASSWORD. |
Use the project's secret-management system for production credentials.
| Layer | Rule |
|---|---|
| Bootstrap | Compose dependencies explicitly in the application startup layer. |
| Services | Use constructor injection with private final fields. |
| Routing | Group related routes in focused HttpService classes and register them with routing.register(...). |
| Request handling | Keep handlers small; validate parameters and delegate business logic. |
| Concurrency | Prefer straightforward blocking code on Helidon 4 virtual-thread-based request handling. Do not generate Single, Multi, or CompletionStage chains without a project-specific reason. |
SE route shape:
import io.helidon.http.Status;
import io.helidon.webserver.http.HttpRules;
import io.helidon.webserver.http.HttpService;
import io.helidon.webserver.http.ServerRequest;
import io.helidon.webserver.http.ServerResponse;
public final class CustomerHttpService implements HttpService {
private final CustomerService customerService;
public CustomerHttpService(CustomerService customerService) {
this.customerService = customerService;
}
@Override
public void routing(HttpRules rules) {
rules.get("/{id}", this::findById);
}
private void findById(ServerRequest request, ServerResponse response) {
var id = request.path().pathParameters().get("id");
customerService.findById(id)
.ifPresentOrElse(response::send, () -> response.status(Status.NOT_FOUND_404).send());
}
}
Register with WebServer.builder().routing(routing -> routing.register("/customers", customerHttpService)).build().start();.
| Layer | Rule |
|---|---|
| Standards | Prefer Jakarta EE and Eclipse MicroProfile APIs when available. |
| Injection | Use CDI constructor injection for required dependencies. |
| Scopes | Choose @ApplicationScoped and @RequestScoped intentionally. |
| Normal-scoped beans | Add a non-private no-argument constructor to normal-scoped beans that also use constructor injection so CDI proxies can be created. |
| REST resources | Keep REST resources thin and delegate business operations to service classes. |
| Portability | Use portable Jakarta and MicroProfile APIs when portability matters. |
MP resource shape:
import jakarta.enterprise.context.RequestScoped;
import jakarta.inject.Inject;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
@Path("/customers")
@RequestScoped
@Produces(MediaType.APPLICATION_JSON)
public class CustomerResource {
private final CustomerService customerService;
protected CustomerResource() { this.customerService = null; }
@Inject
public CustomerResource(CustomerService customerService) { this.customerService = customerService; }
@GET
@Path("/{id}")
public Response findById(@PathParam("id") String id) {
return customerService.findById(id)
.map(customer -> Response.ok(customer).build())
.orElseGet(() -> Response.status(Response.Status.NOT_FOUND).build());
}
}
| Area | Rule |
|---|---|
| DTOs | Use request and response models; never expose persistence entities directly through APIs. |
| Validation | Validate path parameters, query parameters, headers, and bodies before business logic. |
| Status codes | Return appropriate HTTP status codes; on PUT and DELETE, return 404 when the target does not exist. |
| Errors | Use centralized error handling in SE and Jakarta REST ExceptionMapper in MP. Do not expose stack traces, database details, filesystem paths, or internal exception messages. |
| Transactions | Put transaction boundaries around complete business operations. |
| Mapping | Map persistence entities to API models at the service boundary; avoid Optional<CustomerEntity> leaking where callers expect Optional<Customer>. |
| State | Avoid mutable shared state in application-scoped components unless access is coordinated. |
A service can throw IllegalArgumentException for blank IDs or invalid CreateCustomerRequest data, map CustomerEntity to Customer.fromEntity, and use @Transactional on methods that change persistent state.
| Concern | Rule |
|---|---|
| Access technology | Use Helidon DB Client, Jakarta Persistence, or the persistence mechanism already established by the project. |
| SQL safety | Always bind parameters or use prepared statements; never concatenate untrusted input into SQL. |
| Column reads | Use column("name").getString(), column("name").get(String.class), getInt(), getLong(), or other typed accessors. |
| Nullability | Use asOptional() or optional-aware accessors for nullable columns; direct getString() throws for null. |
| Whole-row mapping | DbRow.as(Customer.class) returns the mapped instance directly but requires a DbMapper registered through a DbMapperProvider service-loader entry; use this whole-row path only when repeated row shapes justify it. |
| Migrations | Use a migration tool for schema changes; do not rely on destructive automatic schema updates. |
| Entity separation | Keep CustomerEntity and public API records separate. |
Helidon DB Client repository shape:
import io.helidon.dbclient.DbClient;
public final class DbCustomerRepository implements CustomerRepository {
private static final String FIND_BY_ID = "SELECT id, name FROM customers WHERE id = :id";
private static final String INSERT = "INSERT INTO customers (id, name) VALUES (:id, :name)";
private final DbClient dbClient;
public Optional<Customer> findById(String id) {
return dbClient.execute()
.createGet(FIND_BY_ID)
.addParam("id", id)
.execute()
.map(row -> new Customer(row.column("id").getString(), row.column("name").getString()));
}
}
For Helidon MP persistence, keep JpaCustomerRepository CDI-managed, inject EntityManager with @PersistenceContext, and return entities only inside the data layer.
Named statements may live in config:
db:
source: "jdbc"
connection:
url: "jdbc:postgresql://localhost:5432/customers"
username: ${DB_USERNAME}
password: ${DB_PASSWORD}
statements:
find-customer-by-id: >
SELECT id, name
FROM customers
WHERE id = :id
Reference named SQL with createNamedGet("find-customer-by-id") and bound parameters.
| Area | Rule |
|---|---|
| Health | Use Helidon Health in SE or MicroProfile Health in MP for liveness and readiness. |
| Metrics | Use Helidon Metrics or MicroProfile Metrics; avoid user IDs, request IDs, email addresses, and raw URLs as metric tags. |
| Tracing | Propagate tracing context across inbound and outbound service calls. |
| Logging | Use the project's logging API; never log passwords, access tokens, authorization headers, cookies, sensitive bodies, secrets, or personal data. |
| Unit tests | Use JUnit 5 for services. |
| SE tests | Use helidon-webserver-testing-junit5 with @ServerTest for full server tests or @RoutingTest for routing-only tests; inject Http1Client and never hardcode a port. |
| MP tests | Use helidon-microprofile-testing-junit5 with @HelidonTest; confirm coordinates because the artifact was renamed across 4.x releases. |
| Integration tests | Consider Testcontainers for real databases, brokers, or infrastructure. |
| Failure paths | Test validation failures, missing resources, external-service failures, and authorization failures. |
| Authentication | Use Helidon Security or supported Jakarta and MicroProfile security APIs. |
| Authorization | Deny protected operations by default and enforce permissions at a clear boundary. |
| JWT/OIDC | Validate token signatures, issuers, audiences, and expirations. |
| TLS | Use TLS in production and verify outbound certificates. |
| CORS | Configure allowed origins explicitly; do not combine wildcard origins with credentials. |
| Outbound requests | Validate destinations to reduce server-side request forgery risk. |
Value.as(Class) is not a direct value: unwrap OptionalValue<T> or use typed accessors.Single, Multi, and CompletionStage patterns copied from Helidon 3.@ServerTest, @RoutingTest, and @HelidonTest manage server lifecycle; do not hardcode ports.## Helidon result
**Status:** complete | needs changes | blocked
**Programming model:** SE | MP
**Files reviewed or generated:** <paths>
### Findings or changes
| Area | Evidence | Action |
| --- | --- | --- |
| API migration | `<old API>` | `<Helidon 4 replacement>` |
| Web layer | `<route/resource evidence>` | `<fix>` |
| Data layer | `<query or mapper evidence>` | `<fix>` |
| Tests | `<test evidence>` | `<fix>` |
### Validation
- Compile check: pass | fail | not run
- Tests: pass | fail | not run
pom.xml or build.gradle conventions are respected.application.yaml, application.properties, environment, or secret management.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub gbb-acelerators/awesome-harness-primitives --plugin java-kotlin-development8 skills in this plugin
/create-spring-boot-kotlin-projectCreate a Spring Boot Kotlin project skeleton from Spring Initializr with Gradle Kotlin DSL, Java 21, WebFlux, reactive data dependencies, SpringDoc, ArchUnit, and local Redis/PostgreSQL/MongoDB Docker services. Use when asked to create or scaffold a Spring Boot Kotlin project./java-add-graalvm-native-image-supportGraalVM Native Image expert that adds native image support to Java applications, builds the project, analyzes build errors, applies fixes, and iterates until successful compilation using Oracle best practices. Use this skill when the user asks for graalvm native image agent./java-refactoring-extract-methodOther plugins' skills for the same job