spring-boot-4-conventions
Installation
SKILL.md
Spring Framework 7 / Spring Boot 4 conventions
Java 25 + Spring Framework 7 + Spring Boot 4. Prefer the most modern idiom unless an ADR explains otherwise.
Defaults to apply
Package layout — by feature, not by layer
Top-level packages are bounded contexts / features, not technical layers.
Inside a feature, split by visibility (api published, private impl hidden).
For the private impl sub-packages, apply the following rule:
- One class of a given type (single entity, single service, etc.) — keep it directly in the feature package (no sub-package).
- Multiple classes of the same type — use a typed sub-package within the feature:
model/— JPA entitiesrepository/— Spring Data repositoriesservice/— service classes / implementationsservice/— service implementations
- Inside
api/— keep the controller (or service interface) at theapi/level; put all request/response DTO records in anapi/dto/sub-package.