spring-boot-idioms
Skill157 starsChanged 3 months agoMITView on GitHub
Spring Boot 3.x framework patterns: constructor-based DI, Spring Data JPA, REST controllers with RFC 7807 error handling, Actuator observability, and slice testing. Use when building or maintaining Spring Boot microservices. Pair with java-idioms.
In this repository59 other files it gives its agents.
- github-pages/agents.mdAGENTS.md
- adrSkill
- agent-protocolsSkill
- angular-idiomsSkill
- api-documentationSkill
- axum-idiomsSkill
- browser-automationSkill
- chaos-testingSkill
- ci-cdSkill
- cli-developmentSkill
- code-auditSkill
- code-reviewSkill
- cpp-idiomsSkill
- csharp-idiomsSkill
- data-engineeringSkill
- debugging-protocolSkill
- django-idiomsSkill
- dotnet-idiomsSkill
- elixir-idiomsSkill
- embedded-systemsSkill
- feature-flagsSkill
- flutter-idiomsSkill
- frontend-designSkill
- git-commit-integritySkill
- go-idiomsSkill
- guardrailsSkill
- hono-idiomsSkill
- incident-responseSkill
- java-idiomsSkill
- javascript-idiomsSkill
- kotlin-idiomsSkill
- laravel-idiomsSkill
- logging-implementationSkill
- ml-engineeringSkill
- mobile-designSkill
- mobile-testingSkill
- nextjs-idiomsSkill
- parallel-dispatchSkill
- payment-integrationSkill
- perf-optimizationSkill
- php-idiomsSkill
- postgres-idiomsSkill
- python-idiomsSkill
- rails-idiomsSkill
- react-idiomsSkill
- refactoring-patternsSkill
- research-methodologySkill
- ruby-idiomsSkill
- rust-idiomsSkill
- security-auditSkill
- sequential-thinkingSkill
- sql-idiomsSkill
- structured-specSkill
- supply-chain-securitySkill
- swift-idiomsSkill
- testability-patternsSkill
- testing-strategySkill
- typescript-idiomsSkill
- vue-idiomsSkill
The file
Files
Spring Boot Idioms and Patterns
Spring Boot (3.x) rewards auto-configuration, constructor injection, and actuator-driven observability. Idiomatic Spring = annotation-driven, testable, production-ready.
Scope: Spring Boot-specific patterns. For Java:
@.agents/skills/java-idioms/SKILL.md.
Dependency Injection
- Constructor injection only — never field injection:
@Service public class TaskService { private final TaskRepository repository; private final TaskMapper mapper; public TaskService(TaskRepository repository, TaskMapper mapper) { this.repository = repository; this.mapper = mapper; } } @ConfigurationPropertiesover@Valuefor typed config.
Spring Data JPA
- Query methods for simple queries:
interface TaskRepository extends JpaRepository<Task, UUID> { List<Task> findByStatusOrderByCreatedAtDesc(TaskStatus status); @Query("SELECT t FROM Task t WHERE t.priority = :priority AND t.status = 'ACTIVE'") List<Task> findActivByPriority(@Param("priority") Priority priority); } - Projections for read-only views — avoid loading full entities.
@Transactionalon service methods, never on repositories.
REST Controllers
@RestController+ DTOs — never expose entities directly:@RestController @RequestMapping("/api/v1/tasks") public class TaskController { @PostMapping @ResponseStatus(HttpStatus.CREATED) public TaskResponse create(@Valid @RequestBody CreateTaskRequest request) { return taskService.create(request); } }@ControllerAdvicefor global exception handling.
Actuator and Observability
- Actuator endpoints enabled for health, metrics, info.
- Micrometer for custom metrics.
- Structured logging with MDC for correlation IDs.
Testing
For universal testing principles, see
.agents/rules/testing-strategy.md. Below: language-specific patterns only.
@SpringBootTestfor integration,@WebMvcTestfor controller slices:@WebMvcTest(TaskController.class) class TaskControllerTest { @Autowired MockMvc mockMvc; @MockBean TaskService taskService; @Test void createTask_returns201() throws Exception { mockMvc.perform(post("/api/v1/tasks") .contentType(MediaType.APPLICATION_JSON) .content("{\"title\":\"Test\",\"priority\":\"HIGH\"}")) .andExpect(status().isCreated()); } }- TestContainers for database integration tests.
Related
- Java Idioms @.agents/skills/java-idioms/SKILL.md
- Database Design Principles @.agents/rules/database-design-principles.md
- API Design Principles @.agents/rules/api-design-principles.md
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

