springboot-patterns

Implements Spring Boot REST APIs with layered services, caching, and exception handling.

1|Updated Oct 11, 2025
One-click install
npx skills add https://github.com/ibytechaos/claude --skill springboot-patterns-ibytechaos
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: springboot-patterns
Source: https://github.com/ibytechaos/claude/tree/main/plugins/everything-claude-code/skills/springboot-patterns
Command: npx skills add https://github.com/ibytechaos/claude --skill springboot-patterns-ibytechaos

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Building production-grade Spring Boot backends requires consistent patterns for REST controllers, service layers, data access, validation, and error handling, which developers often implement inconsistently across projects. ## Core Features & Use Cases - Layered Architecture Patterns: Provides controller → service → repository structures with constructor injection, DTOs, and Spring Data JPA repositories. - Cross-Cutting Concerns: Covers global exception handling with @ControllerAdvice, caching with @Cacheable, async processing, SLF4J logging, request filters, and Bucket4j rate limiting with secure proxy configuration guidance. - Use Case: When scaffolding a new Spring Boot microservice, use this Skill to generate a validated REST endpoint with pagination, transactional service logic, and centralized error responses following RFC 7807. ## Quick Start Use the springboot-patterns skill to create a REST controller with service layer, JPA repository, and global exception handling for a market management API.

Frequently Asked Questions about springboot-patterns

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

FAQPage Schema
How do I structure a Spring Boot REST API with layers?

Structure Spring Boot APIs with thin @RestController classes delegating to @Service classes containing business logic, which call Spring Data JPA repositories. Use constructor injection, DTO records for requests and responses, and keep controllers free of business logic.

How to handle validation errors globally in Spring Boot?

Use @ControllerAdvice with @ExceptionHandler for MethodArgumentNotValidException to catch bean validation failures across all controllers. Extract field errors from the BindingResult and return a consistent error response with HTTP 400 status.

Does Spring Boot caching require extra configuration?

Yes, caching requires @EnableCaching on a configuration class before @Cacheable and @CacheEvict annotations work. By default Spring uses a concurrent map cache, but you can plug in Redis or Caffeine as the cache provider.

Why is X-Forwarded-For unsafe for rate limiting in Spring?

The X-Forwarded-For header is client-supplied and trivially spoofable, so attackers can bypass IP-based rate limits. Only trust it behind a configured reverse proxy with server.forward-headers-strategy set and ForwardedHeaderFilter registered; otherwise use request.getRemoteAddr().

When should I use @Transactional readOnly in Spring Data JPA?

Use @Transactional(readOnly = true) on query methods that only fetch data without modifications. This lets Hibernate skip dirty-checking and flush operations, reducing memory usage and improving query performance.