workflows/workflows/agent-environment-setup/platforms/copilot/skills/spring-boot/SKILL.md
Use when building Spring Boot 3.4+ applications with Java records, virtual threads, Spring Security 6, Spring Data JPA, reactive WebFlux patterns, and production-grade testing strategies.
npx skillsauth add cubetiq/cubis-foundry spring-bootInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Guide the design and implementation of production-grade Spring Boot 3.4+ applications using Java 21+ features (records, sealed classes, virtual threads), Spring Security 6 with the lambda DSL, Spring Data JPA with query derivation and projections, reactive WebFlux endpoints, and comprehensive testing with @SpringBootTest, MockMvc, and WebTestClient. Every instruction prioritizes type safety, minimal configuration, and secure-by-default behavior.
Mono/Flux return types.Confirm the Spring Boot version and Java baseline before generating code because Spring Boot 3.4 requires Java 17+ and defaults to Jakarta EE 10 namespaces, and patterns from Spring Boot 2.x using javax.* imports and the deprecated WebSecurityConfigurerAdapter will not compile.
Use Java records for DTOs, request bodies, and response payloads because records are immutable by construction, generate equals/hashCode/toString automatically, and signal to reviewers that the type carries data without behavior.
Define @RestController classes with constructor injection and avoid field injection with @Autowired because constructor injection makes dependencies explicit, enables final fields, and allows instantiation in tests without a Spring context.
Organize the application into feature packages with @Service, @Repository, and @Controller stereotypes because component scanning respects package boundaries, and cross-package access should go through explicit @Bean configuration rather than implicit scanning.
Use Spring Data JPA repository interfaces with derived query methods and @Query for complex cases because derived queries are compile-time verified against the entity model, and JPQL @Query methods surface syntax errors at startup rather than at call time.
Apply @Transactional on service methods that perform multiple writes and configure readOnly = true for read-only transactions because missing transaction boundaries cause partial writes on failure, and readOnly enables Hibernate flush-mode optimizations that reduce query overhead.
Configure Spring Security 6 with the SecurityFilterChain bean and lambda DSL instead of extending WebSecurityConfigurerAdapter because the adapter was removed in Spring Security 6, and the lambda DSL produces a more readable, composable filter chain configuration.
Use @PreAuthorize and @PostAuthorize with SpEL expressions for method-level authorization because URL-pattern matching in the filter chain cannot express domain-level rules like "only the resource owner can update this entity," and method security evaluates after the arguments are resolved.
Enable virtual threads with spring.threads.virtual.enabled=true for blocking I/O workloads because virtual threads eliminate the thread-per-request bottleneck by multiplexing millions of lightweight threads onto a small carrier pool, dramatically improving throughput for database and HTTP client calls.
Use WebClient for non-blocking HTTP calls and RestClient for synchronous calls in virtual-thread contexts because RestTemplate is in maintenance mode, WebClient integrates with the reactive pipeline, and RestClient provides a modern fluent API for imperative code.
Build reactive endpoints with @RestController returning Mono<T> and Flux<T> when the entire call chain is non-blocking because mixing blocking calls inside a reactive pipeline exhausts the limited Netty event-loop threads and produces worse throughput than a servlet-based approach.
Write entity classes with @Entity, @Id, and explicit @Column mappings, and mark lazy associations with @ManyToOne(fetch = LAZY) because Hibernate defaults @ManyToOne to EAGER, which silently triggers N+1 queries that dominate response time in list endpoints.
Use @DataJpaTest for repository tests and @WebMvcTest for controller tests to avoid loading the full application context because slice tests start in under two seconds, isolate the layer under test, and auto-configure only the relevant beans.
Write integration tests with @SpringBootTest and @Testcontainers for database-dependent tests because in-memory H2 diverges from PostgreSQL/MySQL behavior in areas like JSON columns, window functions, and locking, and Testcontainers provides a real database with zero manual setup.
Externalize configuration with @ConfigurationProperties bound to a record and validated with @Validated because @Value injection scatters configuration across the codebase, lacks validation, and cannot be tested without a running Spring context.
Configure structured logging with spring.application.name, correlation IDs, and JSON output for production because unstructured text logs are unparseable by observability platforms, and correlation IDs are required to trace requests across microservice boundaries.
../web-testing/SKILL.md only when the task needs live browser evidence against a Spring-backed UI surface.Provide implementation code, configuration properties, bean definitions, and architectural guidance as appropriate. Include file paths relative to src/main/java/ and src/test/java/. When generating controllers, always show the record DTOs, service interface, and security configuration alongside the endpoint.
| File | Load when |
| --- | --- |
| references/dependency-injection.md | You need bean scoping, @ConfigurationProperties, profiles, conditional beans, or constructor injection patterns. |
| references/security.md | You need Spring Security 6 filter chain configuration, JWT authentication, method security, or CORS setup. |
| references/data-access.md | You need Spring Data JPA repositories, query derivation, projections, specifications, or Hibernate tuning. |
| references/testing.md | You need @SpringBootTest, @WebMvcTest, @DataJpaTest, Testcontainers, or MockMvc/WebTestClient patterns. |
| references/reactive.md | You need WebFlux endpoints, Mono/Flux patterns, WebClient, R2DBC, or reactive security configuration. |
tools
Use when investigating latest vendor behavior, comparing tools or platforms, verifying claims beyond the repo, or gathering external evidence before implementation.
documentation
Use when designing database schemas, normalization strategies, indexing plans, query optimization, and migration workflows for relational, document, or hybrid data stores.
development
Use when writing, reviewing, or refactoring modern C#/.NET code, including minimal APIs, records, async streams, pattern matching, DI lifetimes, and memory-efficient performance tuning.
development
Use when conducting code reviews, building review checklists, calibrating review depth, providing structured feedback, or establishing team review practices. Covers review methodology, feedback patterns, automated checks, and batch review strategies.