Spring Boot Microservices
A practitioner's skill for building and reviewing production-grade Spring Boot
microservices the way strong teams do it in 2026. Three jobs — pick the one the
request needs:
- Design — boundaries, API contracts, data ownership, communication style.
- Scaffold / build — generate a correct modern project; implement features well.
- Review / audit — judge an existing service against modern standards.
Most requests blend these. This file is the router; it stays loaded, so it's kept
lean on purpose. Depth lives in references/ — load a reference only when the task
actually reaches that topic, and see the reference map at the bottom.
Orient, and match effort to the task
Before acting, settle three things — getting them wrong is the top cause of correct-
but-useless advice: (1) which mode (ask if genuinely ambiguous); (2) the version
generation — check pom.xml/build.gradle and the JDK, never assume (see
Version policy); (3) architecture context — greenfield, one
service in an existing estate, or a modular monolith. For existing code, actually read
the build file, main class, a representative controller/service/repository, and
application.yml before forming an opinion.
Then calibrate how hard to lean on this skill — this matters because a capable model
already writes correct idiomatic Spring Boot (adding @Valid, returning a 404, wiring
a SecurityFilterChain) and loading references for those just spends context:
- Narrow, well-specified change (one endpoint, one clear bug, an obvious idiom):
apply the fix directly; do not deep-read references. If the request or a failing
test already fully specifies the answer, just do it.
- Open-ended / multi-concern / ambiguous work (designing, choosing sync vs async,
reviewing unfamiliar code, "why is this slow/flaky", "is this production-ready"):
this is where the skill pays off — load the relevant references and the decision
tables/playbooks in
references/decisions-and-playbooks.md.
Version policy
Quoting a stale or mismatched version is worse than quoting none.
- Default: Spring Boot 4.x / Spring Framework 7 / Java 25 (LTS). Java 21 is
the floor; below 21 is legacy to plan off.
- Conservative baseline: Spring Boot 3.5.x is fully supported — work with it,
don't reflexively push an upgrade unless asked.
- Namespace: current generation is Jakarta (
jakarta.*), never javax.*.
javax.* in a "modern" service is itself a finding.
- Spring Cloud: never pick its version independently — each Boot generation pins a
release train; mismatches are a classic painful bug. Resolve the train from the
official compatibility matrix and let the BOM manage it (
references/spring-cloud-infra.md).
- When unsure of an exact version, say so and point to the build file / matrix
rather than inventing a number.
Mode 1 — Design
Deciding what to build / how to structure it. Work these as deep as the request
needs; details in references/architecture-and-design.md.
- Boundaries first — around business capabilities and data ownership, not
technical layers. If the domain isn't clearly decomposed, prefer a modular
monolith (Spring Modulith) and split later; premature splitting is the most
expensive mistake here.
- API contract — resource model, error model (Problem Details/RFC 9457),
pagination, versioning — decided before implementation (
references/rest-api-design.md).
- Communication style — sync vs async per interaction; default async for
cross-service state propagation (
references/decisions-and-playbooks.md).
- Data ownership & consistency — one owner per datum; sagas/outbox, never
distributed transactions (
references/persistence-and-data.md).
- Cross-cutting concerns as platform — auth, config, observability, resilience
consistent across the estate (gateway / shared starter / mesh).
Deliverable: a concise writeup or ADR. For formal diagrams/C4, hand off to the
enterprise-architecture skill rather than reinventing it here.
Mode 2 — Scaffold / build
Keep this mode lean — a capable model already writes good implementation code, so
don't front-load reference reading; reach for a reference only when a concrete build
decision is genuinely open. The leverage here is getting the baseline right and
steering the few real forks.
New project: (1) confirm Maven or Gradle and Java version (default Java 25);
(2) generate the base from Spring Initializr, then adjust — it guarantees a coherent
dependency set incl. the right Spring Cloud train; (3) wire the non-negotiable baseline:
Actuator + K8s health probes, structured logging, externalized config, a global error
handler, virtual threads. See references/project-setup.md and assets/templates/.
Feature in an existing project: (1) match the surrounding code — its layout,
naming, idioms beat personal preference; (2) implement the vertical slice with
validation, error handling, tests, and observability included, not bolted on; (3) write
tests as you go, Testcontainers for anything touching a real dependency.
Load the reference matching what you're implementing:
| Working on... |
Read |
| An ambiguous choice, or an underspecified symptom |
references/decisions-and-playbooks.md |
| Project layout, build files, dependencies, profiles |
references/project-setup.md, references/configuration-and-profiles.md |
| Controllers, DTOs, validation, errors, versioning |
references/rest-api-design.md |
| JPA/Hibernate, R2DBC, migrations, transactions |
references/persistence-and-data.md |
| AuthN/AuthZ, OAuth2, JWT, method security |
references/security.md |
| Gateway, config server, service discovery |
references/spring-cloud-infra.md |
| Circuit breakers, retries, timeouts, HTTP clients |
references/resilience-and-communication.md |
| Kafka, events, outbox, idempotency |
references/messaging-and-events.md |
| Metrics, tracing, logging, Actuator, SLOs |
references/observability.md |
| Caching (Spring Cache, Redis, invalidation) |
references/caching.md |
| Async work, scheduled jobs, batch |
references/async-scheduling-and-batch.md |
| gRPC, GraphQL, WebSocket/SSE |
references/api-styles-beyond-rest.md |
| Tests, Testcontainers |
references/testing.md |
| Dockerfile, images, Kubernetes, native |
references/containerization-and-k8s.md |
| CI/CD pipeline, scanning, SBOM, image signing |
references/ci-cd-and-supply-chain.md |
| Zero-downtime deploys, DB migrations, rollout |
references/deployment-and-migrations.md |
| Upgrading / modernizing a legacy service |
references/modernization-and-upgrades.md |
| PII, audit logging, data retention, tenancy |
references/compliance-and-data-privacy.md |
Mode 3 — Review / audit
For "review this", "is this production-ready", "what's wrong", "modernize this".
- Read before judging — build file, main class, config, a representative slice of
controllers/services/repositories/tests. Blind checklists are the mark of a bad review.
- Check correctness and intent FIRST — before any standards checklist. Trace what
each critical method does vs. what it intends (names, comments, flow). Hunt for
results fetched then ignored, logic that contradicts its comment, wrong
identifier/field, dead branches, boundary/null mistakes. Run first because once
you're auditing conventions you glide past a method that compiles, follows every
idiom, and still does the wrong thing — the most damaging bug. Functional wrongness
outranks every style finding.
- Then work the dimensions and use the report format in
references/review-checklist.md.
- Verify, don't assume — confirm each finding against the code; separate confirmed
from suspected.
- Prioritize by real impact — severity order (correctness/security → reliability →
maintainability → style). Five things that matter beat forty nitpicks.
Interaction with your perf-review-be skill: that one owns the DB/query-performance
lens (N+1, indexing, pooling); defer to it for the DB layer rather than duplicating.
Principles & anti-patterns
Apply in every mode; reasoning in references/principles-and-anti-patterns.md.
- Principles: observability from day one; design for failure (timeouts + breakers);
externalized config/secrets; virtual threads by default; tests are part of "done";
stateless/12-factor; least surprise (follow the project's idioms).
- Push back on: distributed monolith; shared DB across services; leaky layering
(entities as DTOs, logic in controllers, field injection); legacy stack shown as
current (
javax.*, Zuul/Hystrix/Ribbon, Java 8/11, WebSecurityConfigurerAdapter);
swallowed exceptions / generic 500s; security theater; "we'll add it later".
Reference map
Load on demand:
architecture-and-design.md — boundaries, modular monolith vs microservices, DDD-lite.
decisions-and-playbooks.md — decision tables for the ambiguous forks + diagnostic playbooks; the highest-leverage file on open-ended work.
project-setup.md — Initializr, Maven & Gradle, structure, dependencies, virtual threads.
configuration-and-profiles.md — externalized config, profiles, config server, secrets.
rest-api-design.md — resources, DTOs, validation, Problem Details, pagination, versioning, OpenAPI.
persistence-and-data.md — JPA/Hibernate, R2DBC, transactions, migrations, data ownership.
security.md — Spring Security 6/7, OAuth2 resource server, JWT, method security.
spring-cloud-infra.md — Gateway, Config Server, discovery, release-train alignment.
resilience-and-communication.md — Resilience4j, timeouts/retries/bulkheads, HTTP clients.
messaging-and-events.md — Kafka, event-driven patterns, transactional outbox, idempotency.
observability.md — Micrometer metrics, tracing→OpenTelemetry, structured logging, Actuator, SLOs/error budgets.
caching.md — Spring Cache, local vs distributed (Caffeine/Redis), invalidation, stampede protection.
async-scheduling-and-batch.md — @Async, @Scheduled + ShedLock (multi-replica trap), long-running jobs, Spring Batch.
api-styles-beyond-rest.md — when/how to use gRPC, GraphQL, WebSocket/SSE instead of REST.
testing.md — test pyramid, slice tests, Testcontainers, contract testing.
containerization-and-k8s.md — layered/buildpack images, Dockerfile, GraalVM native, K8s probes.
ci-cd-and-supply-chain.md — pipeline gates, dependency/image scanning, SBOM, image signing/provenance, promotion.
deployment-and-migrations.md — zero-downtime rollout, expand/contract DB migrations, feature flags, rollback.
modernization-and-upgrades.md — the upgrade ladder, javax→jakarta, Netflix-OSS→modern, OpenRewrite, strangler fig.
compliance-and-data-privacy.md — PII, encryption, audit logging, retention/erasure, tenant isolation.
principles-and-anti-patterns.md — the through-lines and anti-patterns, with reasoning.
review-checklist.md — canonical audit checklist + report format for Mode 3.
assets/templates/ holds ready-to-adapt pom.xml, build.gradle.kts, Dockerfile,
compose.yaml, and application.yml starters.
1---2name: spring-boot-microservices3description: Design, scaffold, and review modern Java Spring Boot microservices. Use this skill for ANY Spring Boot, Spring Cloud, or Java backend work — building or reviewing REST APIs in Java, Spring Data JPA / Hibernate (including N+1 and @Transactional issues), Spring Security (OAuth2, JWT), Spring Cloud Gateway, Resilience4j circuit breakers and timeouts, Kafka consumers and the transactional outbox, Micrometer / Actuator / OpenTelemetry observability, Testcontainers tests, caching with Redis, containerizing a Java service, Kubernetes probes, or zero-downtime deploys and database migrations. Trigger it whenever the user says things like "design a service", "scaffold a Spring Boot project", "add a gateway / config server / tracing / circuit breaker", "review my Spring Boot code", "is this service production-ready", "fix this N+1 or slow endpoint", "secure this API with JWT", "split this monolith", or "upgrade Spring Boot 2 to 3" — even when they never say the word "microservice". Targets the current GA generation (Spr4---56# Spring Boot Microservices78A practitioner's skill for building and reviewing **production-grade** Spring Boot9microservices the way strong teams do it in 2026. Three jobs — pick the one the10request needs:1112- **Design** — boundaries, API contracts, data ownership, communication style.13- **Scaffold / build** — generate a correct modern project; implement features well.14- **Review / audit** — judge an existing service against modern standards.1516Most requests blend these. This file is the router; **it stays loaded, so it's kept17lean on purpose.** Depth lives in `references/` — load a reference only when the task18actually reaches that topic, and see the [reference map](#reference-map) at the bottom.1920## Orient, and match effort to the task2122Before acting, settle three things — getting them wrong is the top cause of correct-23but-useless advice: **(1) which mode** (ask if genuinely ambiguous); **(2) the version24generation** — check `pom.xml`/`build.gradle` and the JDK, never assume (see25[Version policy](#version-policy)); **(3) architecture context** — greenfield, one26service in an existing estate, or a modular monolith. For existing code, actually read27the build file, main class, a representative controller/service/repository, and28`application.yml` before forming an opinion.2930Then calibrate how hard to lean on this skill — this matters because a capable model31already writes correct idiomatic Spring Boot (adding `@Valid`, returning a 404, wiring32a `SecurityFilterChain`) and loading references for those just spends context:3334- **Narrow, well-specified change** (one endpoint, one clear bug, an obvious idiom):35 apply the fix directly; do **not** deep-read references. If the request or a failing36 test already fully specifies the answer, just do it.37- **Open-ended / multi-concern / ambiguous work** (designing, choosing sync vs async,38 reviewing unfamiliar code, "why is this slow/flaky", "is this production-ready"):39 *this* is where the skill pays off — load the relevant references and the decision40 tables/playbooks in `references/decisions-and-playbooks.md`.4142## Version policy4344Quoting a stale or mismatched version is worse than quoting none.4546- **Default:** Spring Boot **4.x** / Spring Framework 7 / **Java 25 (LTS)**. Java 21 is47 the floor; below 21 is legacy to plan off.48- **Conservative baseline:** Spring Boot **3.5.x** is fully supported — work *with* it,49 don't reflexively push an upgrade unless asked.50- **Namespace:** current generation is **Jakarta** (`jakarta.*`), never `javax.*`.51 `javax.*` in a "modern" service is itself a finding.52- **Spring Cloud:** never pick its version independently — each Boot generation pins a53 release **train**; mismatches are a classic painful bug. Resolve the train from the54 official compatibility matrix and let the BOM manage it (`references/spring-cloud-infra.md`).55- **When unsure of an exact version, say so** and point to the build file / matrix56 rather than inventing a number.5758## Mode 1 — Design5960Deciding *what to build* / *how to structure it*. Work these as deep as the request61needs; details in `references/architecture-and-design.md`.62631. **Boundaries first** — around business capabilities and data ownership, not64 technical layers. If the domain isn't clearly decomposed, prefer a **modular65 monolith** (Spring Modulith) and split later; premature splitting is the most66 expensive mistake here.672. **API contract** — resource model, error model (Problem Details/RFC 9457),68 pagination, versioning — decided before implementation (`references/rest-api-design.md`).693. **Communication style** — sync vs async **per interaction**; default async for70 cross-service state propagation (`references/decisions-and-playbooks.md`).714. **Data ownership & consistency** — one owner per datum; sagas/outbox, never72 distributed transactions (`references/persistence-and-data.md`).735. **Cross-cutting concerns as platform** — auth, config, observability, resilience74 consistent across the estate (gateway / shared starter / mesh).7576Deliverable: a concise writeup or ADR. For formal diagrams/C4, hand off to the77`enterprise-architecture` skill rather than reinventing it here.7879## Mode 2 — Scaffold / build8081Keep this mode **lean** — a capable model already writes good implementation code, so82don't front-load reference reading; reach for a reference only when a concrete build83decision is genuinely open. The leverage here is getting the baseline right and84steering the few real forks.8586**New project:** (1) confirm Maven or Gradle and Java version (default Java 25);87(2) generate the base from **Spring Initializr**, then adjust — it guarantees a coherent88dependency set incl. the right Spring Cloud train; (3) wire the non-negotiable baseline:89Actuator + K8s health probes, structured logging, externalized config, a global error90handler, virtual threads. See `references/project-setup.md` and `assets/templates/`.9192**Feature in an existing project:** (1) **match the surrounding code** — its layout,93naming, idioms beat personal preference; (2) implement the vertical slice with94validation, error handling, tests, and observability included, not bolted on; (3) write95tests as you go, Testcontainers for anything touching a real dependency.9697Load the reference matching what you're implementing:9899| Working on... | Read |100|---|---|101| An ambiguous choice, or an underspecified symptom | `references/decisions-and-playbooks.md` |102| Project layout, build files, dependencies, profiles | `references/project-setup.md`, `references/configuration-and-profiles.md` |103| Controllers, DTOs, validation, errors, versioning | `references/rest-api-design.md` |104| JPA/Hibernate, R2DBC, migrations, transactions | `references/persistence-and-data.md` |105| AuthN/AuthZ, OAuth2, JWT, method security | `references/security.md` |106| Gateway, config server, service discovery | `references/spring-cloud-infra.md` |107| Circuit breakers, retries, timeouts, HTTP clients | `references/resilience-and-communication.md` |108| Kafka, events, outbox, idempotency | `references/messaging-and-events.md` |109| Metrics, tracing, logging, Actuator, SLOs | `references/observability.md` |110| Caching (Spring Cache, Redis, invalidation) | `references/caching.md` |111| Async work, scheduled jobs, batch | `references/async-scheduling-and-batch.md` |112| gRPC, GraphQL, WebSocket/SSE | `references/api-styles-beyond-rest.md` |113| Tests, Testcontainers | `references/testing.md` |114| Dockerfile, images, Kubernetes, native | `references/containerization-and-k8s.md` |115| CI/CD pipeline, scanning, SBOM, image signing | `references/ci-cd-and-supply-chain.md` |116| Zero-downtime deploys, DB migrations, rollout | `references/deployment-and-migrations.md` |117| Upgrading / modernizing a legacy service | `references/modernization-and-upgrades.md` |118| PII, audit logging, data retention, tenancy | `references/compliance-and-data-privacy.md` |119120## Mode 3 — Review / audit121122For "review this", "is this production-ready", "what's wrong", "modernize this".1231241. **Read before judging** — build file, main class, config, a representative slice of125 controllers/services/repositories/tests. Blind checklists are the mark of a bad review.1262. **Check correctness and intent FIRST — before any standards checklist.** Trace what127 each critical method *does* vs. what it *intends* (names, comments, flow). Hunt for128 results fetched then ignored, logic that contradicts its comment, wrong129 identifier/field, dead branches, boundary/null mistakes. Run first because once130 you're auditing conventions you glide past a method that compiles, follows every131 idiom, and still does the wrong thing — the most damaging bug. Functional wrongness132 outranks every style finding.1333. **Then work the dimensions and use the report format** in `references/review-checklist.md`.1344. **Verify, don't assume** — confirm each finding against the code; separate confirmed135 from suspected.1365. **Prioritize by real impact** — severity order (correctness/security → reliability →137 maintainability → style). Five things that matter beat forty nitpicks.138139Interaction with your `perf-review-be` skill: that one owns the **DB/query-performance**140lens (N+1, indexing, pooling); defer to it for the DB layer rather than duplicating.141142## Principles & anti-patterns143144Apply in every mode; reasoning in `references/principles-and-anti-patterns.md`.145146- **Principles:** observability from day one; design for failure (timeouts + breakers);147 externalized config/secrets; virtual threads by default; tests are part of "done";148 stateless/12-factor; least surprise (follow the project's idioms).149- **Push back on:** distributed monolith; shared DB across services; leaky layering150 (entities as DTOs, logic in controllers, field injection); legacy stack shown as151 current (`javax.*`, Zuul/Hystrix/Ribbon, Java 8/11, `WebSecurityConfigurerAdapter`);152 swallowed exceptions / generic 500s; security theater; "we'll add it later".153154## Reference map155156Load on demand:157158- `architecture-and-design.md` — boundaries, modular monolith vs microservices, DDD-lite.159- `decisions-and-playbooks.md` — **decision tables for the ambiguous forks + diagnostic playbooks; the highest-leverage file on open-ended work.**160- `project-setup.md` — Initializr, Maven & Gradle, structure, dependencies, virtual threads.161- `configuration-and-profiles.md` — externalized config, profiles, config server, secrets.162- `rest-api-design.md` — resources, DTOs, validation, Problem Details, pagination, versioning, OpenAPI.163- `persistence-and-data.md` — JPA/Hibernate, R2DBC, transactions, migrations, data ownership.164- `security.md` — Spring Security 6/7, OAuth2 resource server, JWT, method security.165- `spring-cloud-infra.md` — Gateway, Config Server, discovery, release-train alignment.166- `resilience-and-communication.md` — Resilience4j, timeouts/retries/bulkheads, HTTP clients.167- `messaging-and-events.md` — Kafka, event-driven patterns, transactional outbox, idempotency.168- `observability.md` — Micrometer metrics, tracing→OpenTelemetry, structured logging, Actuator, SLOs/error budgets.169- `caching.md` — Spring Cache, local vs distributed (Caffeine/Redis), invalidation, stampede protection.170- `async-scheduling-and-batch.md` — `@Async`, `@Scheduled` + ShedLock (multi-replica trap), long-running jobs, Spring Batch.171- `api-styles-beyond-rest.md` — when/how to use gRPC, GraphQL, WebSocket/SSE instead of REST.172- `testing.md` — test pyramid, slice tests, Testcontainers, contract testing.173- `containerization-and-k8s.md` — layered/buildpack images, Dockerfile, GraalVM native, K8s probes.174- `ci-cd-and-supply-chain.md` — pipeline gates, dependency/image scanning, SBOM, image signing/provenance, promotion.175- `deployment-and-migrations.md` — zero-downtime rollout, expand/contract DB migrations, feature flags, rollback.176- `modernization-and-upgrades.md` — the upgrade ladder, `javax`→`jakarta`, Netflix-OSS→modern, OpenRewrite, strangler fig.177- `compliance-and-data-privacy.md` — PII, encryption, audit logging, retention/erasure, tenant isolation.178- `principles-and-anti-patterns.md` — the through-lines and anti-patterns, with reasoning.179- `review-checklist.md` — canonical audit checklist + report format for Mode 3.180181`assets/templates/` holds ready-to-adapt `pom.xml`, `build.gradle.kts`, `Dockerfile`,182`compose.yaml`, and `application.yml` starters.