/micronaut-standards:service-layerfrom Micronaut Standards
OneLiteFeather's mandatory service-layer convention for Micronaut REST APIs — a service interface plus a service/impl implementation package, constructor injection only, business logic kept out of controllers. Use this whenever adding a new resource/feature to a Micronaut backend and deciding where its business logic should live, or when reviewing a controller that talks to a repository directly. This is a deliberate departure from a simpler controller-to-repository pattern sometimes seen in smaller Micronaut projects — for entity/persistence conventions specifically, see entity-design; for dependency-injection details beyond the constructor-injection rule itself, this skill is the single source of truth.
Ships in Micronaut Standards. 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.
Every Micronaut REST API backend at OneLiteFeather has an explicit service layer between its controllers and its repositories. Business logic — validation beyond what a DTO's annotations express, multi-step operations, orchestration across more than one repository — belongs in a service, never directly in a controller method body. A controller that calls a repository directly is a sign the service layer was skipped, not a sign the feature was simple enough to skip it.
Each feature gets a service interface in service/, and its implementation in service/impl/:
// service/FontService.java
public interface FontService {
FontModelResponseDTO.FontModelDTO createFont(FontModelDTO fontModelDTO);
FontModelResponseDTO updateFont(FontModelDTO fontModelDTO);
FontModelResponseDTO deleteFont(UUID id);
Page<FontModelResponseDTO.FontModelDTO> getAllFonts(Pageable pageable);
Optional<FontEntity> findFontById(UUID id);
}
// service/impl/FontServiceImpl.java
@Singleton
public class FontServiceImpl implements FontService {
private final FontRepository fontRepository;
@Inject
public FontServiceImpl(FontRepository fontRepository) {
this.fontRepository = fontRepository;
}
@Override
public FontModelResponseDTO.FontModelDTO createFont(FontModelDTO fontModelDTO) {
FontEntity saved = fontRepository.save(fontModelDTO.toFontModel());
return FontModelResponseDTO.FontModelDTO.createDTO(saved);
}
// ...
}
The interface is what the controller depends on (FontController is constructed with a FontService,
never a FontServiceImpl directly) — this keeps the controller decoupled from the implementation and
makes the service trivially mockable in controller-level unit tests.
@Inject goes on the constructor, on every injectable bean — services, controllers, anything else
Micronaut manages. No field injection (@Inject on a field directly) anywhere in the codebase:
// Correct
@Inject
public FontServiceImpl(FontRepository fontRepository) {
this.fontRepository = fontRepository;
}
// Wrong — do not do this
@Inject
private FontRepository fontRepository;
Constructor injection makes dependencies explicit in the type's public API, lets the dependency be
final, and makes the class constructible in a plain unit test without a DI container.
toXxxEntity() on the request DTO,
createDTO(entity) on the response DTO — see dto and response-modeling) — the service is the
caller of these methods, not the owner of the conversion logic.EntityManager juggling beyond what
the repository already provides) — that belongs entirely behind the repository interface.HttpResponse, status codes) — those are the controller's
concern (see routing), so a service method returns a plain DTO or entity, never an HttpResponse<T>.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub onelitefeathernet/onelitefeather-claude-marketplace --plugin micronaut-standards14 skills in this plugin
/configurationOneLiteFeather's convention for typed application configuration in a Micronaut REST API — one @ConfigurationProperties class per functional area in a dedicated config/ package, instead of ad-hoc properties scattered across the application entry point. Use this whenever a Micronaut backend needs a new piece of externalized configuration (a feature flag, an external service URL, a limit/threshold) and you're deciding where the corresponding Java type should live./dependency-managementOneLiteFeather's Gradle/Micronaut dependency-management conventions for REST API backends — the Micronaut Application and AOT plugins, reading the Micronaut version from gradle.properties instead of hardcoding it, the mn.* platform catalog, the private OneLiteFeather Maven repo, and the optional CycloneDX SBOM plugin. Use this whenever setting up or editing a Micronaut backend's build.gradle.kts/settings.gradle.kts. For the general OneLiteFeather Gradle/BOM mechanics that apply beyond Micronaut (private repo credential split, Java toolchain pattern), see minestom-knowledge:gradle/boms instead. For observability, database-migration, Testcontainers, and security dependencies specifically, see the observability, liquibase, testcontainers, and security skills — this skill only lists that those dependencies exist and where to look, not their coordinates; the one exception is structured-logging dependencies (Logstash encoder, OpenTelemetry MDC appender), whose coordinates live directly in this skill since `logging` covers only their usage./dtoOneLiteFeather's request-DTO conventions for Micronaut REST APIs — records with @Serdeable/@Introspected, one shared Create/Update DTO controlled by JSR-380 validation groups instead of separate DTO types per action, and entity conversion methods living on the DTO itself. Use this whenever adding a new request body type to a Micronaut controller. For the response side (success/error modeling), see the response-modeling skill; for endpoint-level OpenAPI documentation, see openapi — this skill covers only the incoming request DTO and its own field-level @Schema annotations./entity-designOneLiteFeather's JPA/Micronaut Data entity conventions for Micronaut REST APIs — entities as a pure persistence layer with no Bean Validation annotations, the internal-UUID-vs-external-identifier pattern, custom AttributeConverters for complex column types, and why entities are plain Java beans rather than records or Lombok classes. Use this whenever adding or reviewing a database/entity/ class in a Micronaut backend. For where entity validation actually lives, see the dto skill; for the optional pattern of publishing entities from a separate Maven module instead of keeping them in the backend, see references/separate-model-module.md in this skill./exception-handlingOneLiteFeather's global exception-handling convention for Micronaut REST APIs — exactly one org-wide ExceptionHandlerAdvice that maps exception types to the correct HTTP status code and returns the shared ErrorResponse type from response-modeling, plus dedicated domain exception classes instead of generic RuntimeExceptions. Use this whenever adding a new failure case a Micronaut backend needs to report, or reviewing an existing global exception handler that maps everything to one status code. This is an explicit correction of a mapping-everything-to-404 pattern seen in an early reference implementation — status-code mapping by exception type is mandatory./liquibaseOneLiteFeather's mandatory Liquibase database-migration convention for Micronaut REST APIs — always XML changelogs (never YAML/SQL/JSON), the master-changelog-plus-versioned-files structure, and why this replaces Hibernate's hbm2ddl.auto=update. Use this whenever a Micronaut backend needs a schema change, or when reviewing a project still relying on hbm2ddl.auto=update for schema management. For verifying a changelog actually works against both MariaDB and PostgreSQL, see the testcontainers skill.Other plugins' skills for the same job