spring-boot-skill_skill

This skill generates Spring Boot components following modern Java best practices and team conventions to ensure clean, scalable code.
  • Java

132

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill kousen/claude-code-training --skill spring-boot-skill

  • SKILL.md6.2 KB

Overview

This skill generates Spring Boot components and enforces modern Java and team conventions for readable, testable, and maintainable applications. It produces controllers, services, repositories, entities, DTOs, configuration, and tests following established layering and dependency-injection patterns. Use it to speed development while keeping code consistent with common enterprise practices.

How this skill works

The skill inspects requested component types (controllers, services, repositories, entities, DTOs, configs, and tests) and outputs code that follows constructor injection, clear package structure, REST conventions, JPA mapping patterns, and standardized error handling. It also generates matching tests (unit, slice, repository, and integration) and adds JavaDoc and OpenAPI annotations when appropriate. Configuration and environment concerns are externalized to YAML and Spring profiles.

When to use it

  • Scaffolding new Spring Boot REST endpoints and related service/repository layers
  • Creating JPA entities and DTOs with correct relationships and constraints
  • Adding tests: controller (MockMvc), service (Mockito), repository (DataJpaTest), integration (SpringBootTest)
  • Reviewing or refactoring existing Spring Boot code to match best practices
  • Generating configuration files and profile-aware application.yml

Best practices

  • Always use constructor injection and mark dependencies private final; prefer Lombok @RequiredArgsConstructor where helpful
  • Follow layered package layout: controller, service, repository, model, dto, config, exception
  • Return ResponseEntity<T> from controllers, use @Valid on request bodies, and version APIs (/api/v1/...)
  • Keep services focused on business rules, use Optional<T>, and annotate transactional boundaries
  • Model JPA entities with proper annotations, relationships, and column constraints; avoid bidirectional cycles without care
  • Ship comprehensive tests for each component type and use profiles + externalized config in application.yml

Example use cases

  • Generate a versioned REST controller, service implementation, repository interface, DTOs, and entity for a new resource
  • Refactor a controller from field injection to constructor injection and add proper ResponseEntity usage
  • Create repository and DataJpaTest for new domain objects with sample test data
  • Produce controller and service tests: @WebMvcTest with MockMvc and Mockito-based unit tests
  • Add global exception handling with @ControllerAdvice and consistent error response payloads

FAQ

Use Lombok to reduce boilerplate (constructors, getters/setters) but keep explicit code where clarity or framework constraints require it.

When do I add @Transactional?

Annotate service methods that perform one or more write operations or require atomicity; prefer method-level over class-level when possible.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational