spring-boot

Generates idiomatic Spring Boot 3.x controllers, services, repositories, DTOs, and exception handlers.

Updated Jul 13, 2026
One-click install
npx skills add https://github.com/urban6/my-harness --skill spring-boot-urban6
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: spring-boot
Source: https://github.com/urban6/my-harness/tree/main/skills/spring-boot
Command: npx skills add https://github.com/urban6/my-harness --skill spring-boot-urban6

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing Spring Boot backend code without shared conventions leads to inconsistent layering, ad-hoc error responses, exposed entities, and security oversights like plaintext password storage. This Skill provides a consistent set of idiomatic patterns and checklists so controllers, services, persistence, validation, and error handling follow the same conventions every time. ## Core Features & Use Cases - Layered architecture recipes: Templates for thin REST controllers, transactional services, and JPA repositories with constructor injection, record DTOs, and Bean Validation. - RFC 9457 error handling: Global exception handler patterns mapping domain exceptions to ProblemDetail responses with field-level validation errors. - Security and configuration basics: Password hashing with PasswordEncoder, secret externalization via environment variables, profiles, and Flyway migrations. - Use Case: Ask for a member sign-up API and get a controller with @Valid request DTO, a service that hashes the password and throws a duplicate-email domain exception mapped to 409, and consistent ProblemDetail error responses. ## Quick Start Ask the AI to create a Spring Boot REST API for your entity, for example: "Create a Product REST API with create, get, paginated list, and delete endpoints following the spring-boot skill conventions."

Frequently Asked Questions about spring-boot

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure a Spring Boot REST API with controllers, services, and repositories?▼

Keep controllers thin with only HTTP mapping and validation, put business logic and @Transactional boundaries in services, and use Spring Data JPA repositories for persistence. Requests and responses should be record DTOs so JPA entities are never exposed at the API boundary.

How to handle exceptions in Spring Boot with RFC 9457 ProblemDetail?▼

Define domain exceptions that know nothing about HTTP, then map them in a single @RestControllerAdvice using ProblemDetail.forStatusAndDetail. Validation failures return 400 with a field-level errors extension, and 500 responses never leak stack traces or internal messages.

Does Spring Boot 3 require jakarta namespace imports?▼

Yes, Spring Boot 3.x uses the Jakarta EE 9+ namespace, so imports must be jakarta.persistence.* and jakarta.validation.* instead of javax.*. The skill assumes Spring Boot 3.x with Java 21 as its baseline.

How do I hash passwords in Spring Boot before saving users?▼

Register a BCryptPasswordEncoder bean from spring-security-crypto and call passwordEncoder.encode() in the service before persisting. Verify logins with matches() rather than decrypting, and never include the password or its hash in response DTOs.

When should I use @WebMvcTest vs @SpringBootTest in Spring Boot?▼

Use @WebMvcTest with MockMvc for controller slices covering mapping, validation, and status codes, and @DataJpaTest for repository queries. Reserve @SpringBootTest with Testcontainers for end-to-end flows that need the real database dialect and constraints.

Should I follow this skill's conventions or my existing project's style?▼

Follow your existing project's conventions first. The skill explicitly treats its templates as defaults for projects without established patterns, so it mimics existing layering, error formats, and naming rather than imposing new rules.