piomin/claude-ai-spring-boot
Sobre
Template do Claude Code para Spring Boot e o ecossistema nativo da nuvem
Ferramentas de desenvolvimentoCrescimento medido de estrelas
- em 24 h
- +2
- em 7 dias
- +6
- em 15 dias
- +11
- em 1 mês
- +33
Variações líquidas em períodos sobrepostos, não totais diários. Medições ausentes ficam em branco. Estrelas indicam interesse, não qualidade.
README.md
OriginalSpring Boot Plugin for Claude Code (v1.3.2)
A Claude Code plugin with production-ready skills and agents for building Spring Boot 4.x / Java 21+ applications. Install the plugin and start generating your app — the skills and agents guide Claude to follow best practices for REST APIs with Problem Details errors, a selectable architecture style (layered CRUD, CQRS, or CQRS with Event Sourcing), JPA, Flyway database migrations, security, testing, cloud-native deployment, and Kubernetes.
Installation
Install from Anthropic marketplace
claude plugin install spring-boot-template@piomin
Or install directly from repository
claude plugin marketplace add piomin/claude-ai-spring-boot
claude plugin install spring-boot-template@piomin
Then run Claude Code and type:
/plugin
To test locally during development:
claude --plugin-dir /path/to/claude-ai-spring-boot
Using the skills with Codex
The skills in skills/ use the open SKILL.md format (frontmatter with name and description, optional references/ folder), so OpenAI Codex can load them without changes. The repo is also a Codex plugin (.codex-plugin/plugin.json) with a marketplace file (.agents/plugins/marketplace.json).
As a plugin (skills only, no agents):
codex plugin marketplace add piomin/claude-ai-spring-boot
Then restart Codex, open the Plugins Directory, choose the piomin marketplace and install spring-boot-template. Update later with codex plugin marketplace upgrade piomin.
Or as plain skills. Codex discovers skills in .agents/skills (per repository) and $HOME/.agents/skills (per user):
git clone https://github.com/piomin/claude-ai-spring-boot.git
# for all your projects
mkdir -p ~/.agents/skills
cp -r claude-ai-spring-boot/skills/* ~/.agents/skills/
# or for a single project
mkdir -p my-project/.agents/skills
cp -r claude-ai-spring-boot/skills/* my-project/.agents/skills/
Codex follows symlinks, so you can ln -s each skill folder instead of copying to get updates with git pull. Restart Codex if the skills do not show up, then run /skills or type $ to pick one, or just describe the task and Codex selects a matching skill.
The agents/ folder uses the Claude Code subagent format and is not loaded by the Codex plugin. Skills mention the code-reviewer and security-engineer agents as hand-offs; in Codex, ignore those references and apply the skill directly.
Using the skills and agents with OpenCode
OpenCode reads the same SKILL.md skills, and the agent definitions in agents/ work in both tools: the frontmatter holds only name, description and mode: subagent (plus read-only settings for code-reviewer), and each agent inherits the model and tools you configure.
git clone https://github.com/piomin/claude-ai-spring-boot.git
# for all your projects
mkdir -p ~/.config/opencode/skills ~/.config/opencode/agents
cp -r claude-ai-spring-boot/skills/* ~/.config/opencode/skills/
cp claude-ai-spring-boot/agents/*.md ~/.config/opencode/agents/
# or for a single project
mkdir -p my-project/.opencode/skills my-project/.opencode/agents
cp -r claude-ai-spring-boot/skills/* my-project/.opencode/skills/
cp claude-ai-spring-boot/agents/*.md my-project/.opencode/agents/
OpenCode also discovers skills in .agents/skills and .claude/skills. Project rules go in AGENTS.md (OpenCode) or CLAUDE.md (Claude Code); the skills treat both the same.
What's Included
Agents (agents/)
Specialized agents that Claude Code can invoke for specific tasks:
| Agent | Purpose |
|---|---|
spring-boot-engineer |
Build Spring Boot 4.x apps with Problem Details errors, in the architecture style recorded for the project (layered CRUD by default, CQRS or Event Sourcing with the event-driven skill); adds the OpenAPI contract rules when the API is built for a UI |
architect |
Turns a GitHub issue labeled architect into up to 8 small, ordered issues with implementation plans (uses gh, runs unattended, read-only on code), in the project's recorded architecture style |
code-reviewer |
Read-only review of a diff or branch: fixes the scope, loads the conventions and code-quality skills (and event-driven for a CQRS or event-sourced project), reports cited findings by severity |
kubernetes-specialist |
K8s deployments, probes, ConfigMap/Secret, Prometheus, Skaffold |
devops-engineer |
CI/CD pipelines, Paketo Buildpacks, Skaffold |
docker-expert |
Multi-stage Dockerfiles, Paketo Buildpacks, image optimization |
security-engineer |
Spring Security, OWASP, input validation, SSL Bundles |
Skills (skills/)
Reusable knowledge that Claude loads contextually:
| Skill | What it teaches |
|---|---|
conventions |
The architecture decision for a new project (dialog, ## Architecture block) and the mandatory project rules: No Lombok, constructor injection, RestClient, testing standards, conditional Flyway for relational databases, Problem Details, conditional OpenAPI contract rules for APIs built for a UI |
spring-boot |
Core Spring Boot development with 7 reference guides (web incl. Problem Details and paging, OpenAPI with springdoc 3, data incl. Flyway migrations, security, cloud, Spring AI 2.x, testing) |
code-quality |
Review checklist loaded on demand from 6 references (correctness, security, performance, Spring signals, REST semantics, code smells); points to conventions and other skills for project rules instead of repeating them |
event-driven |
CQRS and Event Sourcing with 6 reference guides: topology (separate command and query services, or a single service), CQRS (commands, queries, events, projections), Event Sourcing (PostgreSQL event store, aggregates rebuilt from events, upcasting, projections with checkpoints), Axon Framework, Kafka (transactional outbox, relay, consumers) or in-process events with Spring Modulith, testing |
design-patterns |
Classic patterns (Factory, Builder, Strategy) + enterprise (Saga, and short summaries of Outbox and CQRS that link to event-driven) |
review-triage |
How to answer review feedback (PR comments, reviews, bot findings) without implementing everything: verify each remark against the code, accept, partly accept, reject or defer it with a one-line reason, and report point by point |
testing-patterns |
JUnit 5, Mockito, MockMvc, RestTestClient, Testcontainers with @ServiceConnection, relation and status-endpoint integration tests, Podman |
java-modern |
Java 21+ features: records, sealed classes, pattern matching, virtual threads |
jpa-patterns |
JPA/Hibernate pitfalls (N+1, lazy loading), Hibernate 6/7, optimistic locking across HTTP requests, relation writes with OSIV off, schema drift |
logging-patterns |
Structured JSON logging, SLF4J, MDC, AI-friendly formats |
Key Conventions
The plugin enforces these rules via the conventions skill:
- Architecture decision — asked once for a new project and recorded in its
CLAUDE.md/AGENTS.md(see below) - No Lombok — explicit constructors, getters/setters,
LoggerFactory.getLogger() - Constructor injection — no
@Autowiredon fields - RestClient over RestTemplate/WebClient for blocking HTTP calls
- RestTestClient with
@AutoConfigureRestTestClientfor integration tests - Testcontainers with
@ServiceConnection(not@DynamicPropertySource) - Jakarta Persistence (not
javax.persistence) - Problem Details (RFC 9457) for every error; paged lists as
PagedModel; optimistic locking with@Versionand 409 - OpenAPI contract rules, only when the API is built for a UI (see below)
- Flyway owns the schema (
ddl-auto: validate) when the API persists to a Flyway-supported relational database; skipped for APIs without persistence, NoSQL-only APIs, or projects already using Liquibase - Maven with
pl.piomin.servicesgroup ID - CI pipeline — auto-detected from existing project config
- Docker Compose for local dependencies
Cloud-Native Coverage
The cloud.md reference covers:
- Spring Cloud (Config Server, Eureka, Gateway, LoadBalancer) and built-in
@Retryable/@ConcurrencyLimit - Distributed tracing with OpenTelemetry (OTLP) and Micrometer Observation API
- Virtual Threads, HTTP Interface Clients (
@HttpExchange), GraalVM Native Image - Kubernetes: ConfigMap/Secret with
envFrom, Prometheus annotations, startup/liveness/readiness probes,preStophook, graceful shutdown - TLS: cert-manager (Ingress TLS + pod-level mTLS), SSL Bundles with hot reload
- Config Tree for reading mounted secrets from files
- Paketo Buildpacks via
spring-boot:build-image - Skaffold with kustomize overlays (local, Kubernetes, OpenShift): no cluster, host, registry, namespace or secret in git
- Probes and a PVC for PostgreSQL and Keycloak deployed next to the API; Docker Compose healthchecks that work with Podman
- Demo data seeded by a Flyway callback into an empty database (
data.md)
Usage
After installing, describe what you want to build — Claude will use the skills and agents automatically:
cd my-project
claude
> "Build a REST API for managing orders with PostgreSQL"
In a new project, Claude first asks which architecture style to use (see "Architecture styles"); answer "Layered CRUD" for the classic controller, service and repository layout.
For a relational database like PostgreSQL, the generated app includes Flyway migrations in src/main/resources/db/migration, ddl-auto: validate, and Testcontainers tests that verify all migrations were applied. APIs without persistence or with NoSQL stores get no Flyway configuration.
Architecture styles
For a new project (no build file yet), Claude asks which architecture style to use before it writes code, even when the prompt does not mention architecture. The questions come one at a time, with the default first:
| # | Question | Options | 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) | CQRS as a single service only |
| 5 | Read model store | PostgreSQL / another store | style is not CRUD |
| 6 | Event store | PostgreSQL append-only table / Axon Framework | style is Event Sourcing |
The answer is written to the project's CLAUDE.md (or AGENTS.md) and followed in every later session without asking again:
## Architecture
style: cqrs
scope: Order
topology: separate-services
transport: kafka
read-store: postgresql
- Layered CRUD (default) generates what the plugin generated before; the block is the single line
style: layered-crud. - CQRS loads the
event-drivenskill: command and query records with one handler each, a write side that keeps JPA,@Versionand 409, read models updated from domain events, and a transactional outbox when events go through Kafka. Reads become eventually consistent: a query right after a command may return the old state.- Separate services: a Maven multi-module build with
<name>-events,<name>-command-serviceand<name>-query-service, each service with its own database and Flyway migrations. - Single service: one module with
command,query,domainandprojectionpackages, and a test that keeps them extractable.
- Separate services: a Maven multi-module build with
- CQRS + Event Sourcing stores events instead of the current state (
style: cqrs-event-sourcing,event-store: postgresql):- an append-only
event_storetable owned by Flyway; a version conflict on append returns 409 - aggregates without JPA: state is rebuilt from the events, and a command returns new events
- events are never changed; an old event is read through an upcaster
- projections track their position and can be rebuilt; no snapshots unless a load problem is measured
- no personal data in events without an erasure strategy in the project's README
- command endpoints return 201 or 202 with the aggregate id and its version
- an append-only
- Axon Framework (
event-store: axon) replaces the hand-written event store, command dispatch and projection tracking. Claude first selects the Axon release that supports the project's Spring Boot version, tells you which one, and asks whether events go to Axon Server or to PostgreSQL. The code follows the Axon reference of that version. - A prompt that already states the choices ("CQRS, single service, in-process events, PostgreSQL read model, for Order") gets a one-line confirmation instead of questions.
- An existing project without the block is layered CRUD and is not asked, unless you request CQRS.
Not yet supported, and answered as such in the dialog: CQRS or Event Sourcing for an API built for a UI.
APIs built for a UI
Some rules are required only when the API is built for a UI (or another client generated from its OpenAPI contract), for example a UI made from crud-ui-blueprint. Say so in your prompt ("the API backs a web UI generated from its OpenAPI contract") or in the project's CLAUDE.md / AGENTS.md. The conventions skill then loads skills/spring-boot/references/ui-contract.md, the single source of these rules:
/apibase path, same origin (no CORS), operationIds the UI's generated client relies on- an OpenAPI contract generated by springdoc 3, exported to
contract/openapi.jsonby a test and checked in CI, withinfo.versionfrom the build - Problem Details field errors with a fixed set of codes the UI translates,
PUTwith a requiredversion - typed list filters, relations as
{id, label}summaries, 409in-useinstead of cascading deletes - the Keycloak realm layout the UI logs in with (no host or secret in the realm file, sign-in through the UI's host on any cluster), public
/actuator/healthand/actuator/info, and a README "Connect a UI" section - a
deploy/layout shared with the UI repo (kustomize base and overlays for a local cluster, Kubernetes and OpenShift, Secrets created by a Skaffold hook), following the project'sdocs/DEPLOY-CONVENTION.mdwhen it has one
Without a UI, none of this is required: the generated API keeps Problem Details, paging and optimistic locking, and skips the contract export.
You can also invoke skills and agents directly:
# Invoke a skill
> /spring-boot-template:jpa-patterns
# Use an agent
> @agent-spring-boot-template:code-reviewer
Directory Structure
.
├── .agents/plugins/
│ └── marketplace.json
├── .claude-plugin/
│ └── plugin.json
├── .codex-plugin/
│ └── plugin.json
├── .github/
│ ├── scripts/validate.sh
│ └── workflows/publish-skills.yml
├── agents/
│ ├── architect.md
│ ├── code-reviewer.md
│ ├── devops-engineer.md
│ ├── docker-expert.md
│ ├── kubernetes-specialist.md
│ ├── security-engineer.md
│ └── spring-boot-engineer.md
├── skills/
│ ├── conventions/SKILL.md
│ ├── code-quality/
│ │ ├── SKILL.md
│ │ └── references/
│ │ ├── api-contract.md
│ │ ├── correctness.md
│ │ ├── performance.md
│ │ ├── security.md
│ │ ├── smells.md
│ │ └── spring-conventions.md
│ ├── design-patterns/SKILL.md
│ ├── event-driven/
│ │ ├── SKILL.md
│ │ └── references/
│ │ ├── axon.md
│ │ ├── cqrs.md
│ │ ├── event-sourcing.md
│ │ ├── kafka.md
│ │ ├── testing.md
│ │ └── topology.md
│ ├── java-modern/SKILL.md
│ ├── jpa-patterns/SKILL.md
│ ├── logging-patterns/SKILL.md
│ ├── review-triage/SKILL.md
│ ├── spring-boot/
│ │ ├── SKILL.md
│ │ └── references/
│ │ ├── ai.md
│ │ ├── cloud.md
│ │ ├── data.md
│ │ ├── ui-contract.md
│ │ ├── security.md
│ │ ├── testing.md
│ │ └── web.md
│ └── testing-patterns/SKILL.md
├── README.md
└── LICENSE
Releases
Pushing a tag without a prefix, for example 1.3.2, runs .github/workflows/publish-skills.yml. It checks the frontmatter of skills and agents and that the tag equals the version in both plugin.json files and in the README title, packs skills/ and agents/ into skills.tar.gz, pushes it as an OCI artifact to quay.io/pminkows/claude-ai-spring-boot:<tag> and creates a GitHub release. The workflow needs the repository secrets QUAY_USERNAME and QUAY_PASSWORD (a Quay robot account with write access to the repository). Run .github/scripts/validate.sh locally to do the checks before tagging.
# bump the version in both plugin.json files and in the README title, then
git tag 1.3.2 && git push origin 1.3.2
The artifact is what the ai-software-factory pipelines pull with oras pull.
Blog Post
You can find a detailed explanation of this plugin in the post: Claude Code Template for Spring Boot.
License
Apache License 2.0
Explore projetos relacionados
Carregando…