/spring-boot-template:conventionsfrom Spring Boot Template
Enforces Spring Boot project conventions: architecture style (layered CRUD, CQRS, Event Sourcing), No-Lombok, constructor injection, RestClient, Flyway, Problem Details, and OpenAPI contract rules.
Ships in Spring Boot Template. 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.
These conventions apply to ALL code generated or reviewed in the project. Follow them strictly.
Decide the architecture style before generating any code. The decision is recorded once in the project's CLAUDE.md (AGENTS.md in Codex and OpenCode) and followed in every later session.
| Situation | Action |
|---|---|
New project: no build file (pom.xml, build.gradle*) and no architecture block | Ask, even when the prompt does not mention architecture |
| The prompt already states a choice | Skip that question, confirm the choice in one line, ask the remaining ones |
| The architecture block exists | Never ask again; follow it |
| Existing project without the block | Layered CRUD; ask only when the user requests CQRS or Event Sourcing |
The architecture block is a ## Architecture section that has a style: line. A ## Architecture heading without style: is a description, not a decision.
Who asks. The dialog runs in the main conversation, one question at a time, with the default listed first. A subagent that is started without a decision does not ask and does not generate code: it stops and returns the question to the main conversation.
| # | Question | Options (default first) | Asked when |
|---|---|---|---|
| 1 | Architecture style | Layered CRUD / CQRS / CQRS + Event Sourcing | always |
| 2 | Scope | Which aggregates or bounded contexts | style is not CRUD |
| 3 | Topology | Separate command and query services / Single service | style is not CRUD |
| 4 | Event transport | Apache Kafka / In-process events (Spring Modulith) | style is CQRS and topology is single service; separate services always use Kafka, and an event-sourced single service reads its event store directly |
| 5 | Read model store | PostgreSQL / another store named by the user | style is not CRUD |
| 6 | Event store | PostgreSQL append-only table / Axon Framework | style is Event Sourcing |
With question 1, state the cost in two lines:
CQRS: a query right after a command may still return the old state (eventual consistency), and there is more code: commands, queries, handlers, events and projections. Event Sourcing adds event versioning: a published event is never changed, so every change to it needs a new version.
If the user picks layered CRUD, ask nothing else.
Not yet supported. Reply "not yet supported in this version of the plugin" and ask again between the supported options. Never fall back silently:
Axon Framework. When the user picks it, the event-driven skill, references/axon.md, continues the dialog before any code: it selects the Axon version that fits the project's Spring Boot version, tells the user which one, and asks whether events are stored in Axon Server or in PostgreSQL.
Record the decision before generating code. Create the file if the project has none, and keep the rest of an existing file:
## Architecture
style: cqrs-event-sourcing
scope: Order, Payment
topology: separate-services
transport: kafka
read-store: postgresql
event-store: postgresql
| Key | Values |
|---|---|
style | layered-crud, cqrs, cqrs-event-sourcing |
scope | aggregate or bounded context names |
topology | separate-services, single-service |
transport | kafka, in-process (always in-process for an event-sourced single service) |
read-store | postgresql, or the store the user named |
event-store | Event Sourcing only: postgresql, axon (then also axon-version, axon-event-store: axon-server or postgresql, and with postgresql the axon-storage-engine and its licence) |
Layered CRUD is recorded as the single line style: layered-crud, so a subagent or a later session does not ask again. Record a decision only after the dialog ran: an existing project without the block is layered CRUD as it is, and gets no block added.
What each style replaces. Every rule in this skill applies to every style, except:
| Rule | Layered CRUD | CQRS | CQRS + Event Sourcing |
|---|---|---|---|
| Layering and packages | Controller → Service → Repository (spring-boot skill, Architecture Patterns) | Controller → handler → repository, in command, query, domain, projection packages | as CQRS; handlers use the event store, not a repository |
@Transactional(readOnly = true) at service class level | applies | @Transactional on command handlers, @Transactional(readOnly = true) on query handlers | as CQRS |
| Request records | <Resource>CreateRequest, <Resource>UpdateRequest | command records (Create<Resource>Command, ...) | command records named after what the user does (PayOrderCommand) |
| What a write returns | the record (<Resource>Response) | CommandResult with the id and the new version; only queries return <Resource>Response | as CQRS; 201 for a new aggregate, 202 for every other command |
JPA entities with @Version, 409 on a lost update | applies | applies on the write side | no JPA on the write side; a version conflict on append to the event store is the 409 |
| Identity columns for ids | every table | write side only; a read-model table takes its id from the events | none; an aggregate id is a UUID created by the application |
When the style is cqrs or cqrs-event-sourcing, load the event-driven skill and follow it. It holds the topology, the CQRS and Event Sourcing rules, Axon, Kafka and testing.
LoggerFactory.getLogger() for loggers@Autowired on fields@AutoConfigureRestTestClient for integration tests@ServiceConnection (not @DynamicPropertySource)javax.persistence)tools.jackson): inject JsonMapper, not ObjectMapper; @JacksonComponent replaces @JsonComponent; only com.fasterxml.jackson.annotation keeps its old packagespring-boot-starter-webmvc (not -web), spring-boot-starter-aspectj (not -aop), test starters spring-boot-starter-<technology>-test<Resource>Response, <Resource>CreateRequest, <Resource>UpdateRequest; controllers never expose entitiespl.piomin.services1.0.0 — PATCH by default, MINOR for a backward-compatible feature, MAJOR for a breaking API change; every OpenAPI contract change bumps the version.github/workflows/, .circleci/, .gitlab-ci.yml) and match it, or default to a sensible choiceREADME.md on each new version@Transactional(readOnly = true) at service class level, @Transactional on mutating methods@Valid @RequestBody on all POST/PUT endpoints@RestControllerAdvice for global exception handlingResponseEntity with proper status codes (201 Created, 204 No Content)@ConfigurationProperties for type-safe config (no raw @Value for groups)@HttpExchange interfaces for declarative HTTP clientsspring.threads.virtual.enabled: true)spring.mvc.problemdetails.enabled: true); every error, including the catch-all 500, is RFC 9457 Problem Details, and the catch-all never returns the exception messagePagedModel; never Page/PageImpl@Version; a lost update returns 409server.shutdown: graceful)/actuator/health/** (not only /actuator/health), so the liveness/readiness probes work behind securityDecide first whether these rules apply. They are required only when the API is built for a UI (or another client) that is generated from its OpenAPI contract; they cost extra code and tests that a plain API does not need.
| Situation | Action |
|---|---|
The user says the API backs a web UI or generated clients; the project's CLAUDE.md / AGENTS.md names a UI (e.g. a crud-ui-blueprint UI); the repo has contract/openapi.json, docs/API-CONTRACT.md or docs/DEPLOY-CONVENTION.md | Load the spring-boot skill, references/ui-contract.md, and follow it |
| Service-to-service API, internal API, or no client is generated from the contract | Optional - the general rules above are enough; use a rule from ui-contract.md only when the user asks for it |
| Unsure | Ask once whether a UI or generated client will consume the API |
references/ui-contract.md is the single source of these rules: /api base path without CORS, operationIds, the springdoc 3 contract exported to contract/openapi.json and checked in CI, the fixed FieldError codes, PUT with a required version, filters, Reference {id, label} relations, Keycloak realm layout, public health/info, the README "Connect a UI" section, and the deployment shared with the UI repo (deploy/ overlays, no host or secret in git). Where it differs from the defaults above (e.g. /api instead of /api/v1), it wins; the project's own copies of docs/API-CONTRACT.md and docs/DEPLOY-CONVENTION.md win over both.
Decide first whether Flyway applies:
| Situation | Action |
|---|---|
| JDBC/JPA with a Flyway-supported relational database (PostgreSQL, MySQL, MariaDB, Oracle, SQL Server, DB2, H2, ...) | Use Flyway |
| Project already uses Liquibase | Keep Liquibase, do not add Flyway |
| No persistence, NoSQL only (MongoDB, Redis, Cassandra, Elasticsearch), or a database Flyway does not support | Skip Flyway - no dependency, no db/migration, no spring.flyway.* |
When Flyway applies:
src/main/resources/db/migration); Hibernate only validates it (spring.jpa.hibernate.ddl-auto: validate). Never use update/create outside testsspring-boot-starter-flyway plus the database module (e.g. flyway-database-postgresql)application.yml: ddl-auto: validate, open-in-view: false, and the database in the readiness probe (management.endpoint.health.group.readiness.include: readinessState,db). Flyway defaults need no spring.flyway.* keys (exception: a CQRS single service with command and query schemas sets spring.flyway.schemas, see the event-driven skill)GenerationType.IDENTITY: GENERATED BY DEFAULT AS IDENTITY (PostgreSQL, Oracle, DB2, H2), AUTO_INCREMENT (MySQL/MariaDB), IDENTITY (SQL Server); not SERIAL/BIGSERIALV<n>__<description>.sqlNOT NULL column gets a DEFAULT or a backfill, so existing rows keep workingpk_, uk_, ck_, fk_, ix_); index every foreign key column; a unique constraint the API reports as a 409 conflict is referenced by name from the exception handlerDEFAULTs match entity defaults; validation rules get a matching DB CHECKDetails and examples: spring-boot skill, references/data.md (Database Migrations).
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Spring Boot, Java, Maven, PostgreSQL, MySQL, Kafka
npx claudepluginhub piomin/claude-ai-spring-boot --plugin spring-boot-template10 skills in this plugin
/code-qualityReview checklist for Java / Spring Boot code - correctness, security, performance, Spring signals, REST semantics, and code smells; project rules are referenced from conventions, not repeated. Use when user says "review code", "check this PR", "refactor", "check API", or before merging changes./design-patternsDesign patterns with Java examples - classic (Factory, Builder, Strategy, Observer, Decorator, Adapter) and enterprise/microservices (Saga, Outbox, CQRS). Use when user asks about patterns, designing extensible components, or distributed transaction strategies./event-drivenCQRS and Event Sourcing for Spring Boot 4.x - command and query handlers, read models updated from domain events, transactional outbox with Apache Kafka or in-process events with Spring Modulith, an append-only PostgreSQL event store with aggregates rebuilt from events, upcasting and rebuildable projections, or Axon Framework, as separate command and query services or a single service. Use when the architecture block in the project's CLAUDE.md or AGENTS.md names the cqrs or cqrs-event-sourcing style, or when the user asks for CQRS, Event Sourcing, an event store, an outbox, projections or read models.Other plugins' skills for the same job