templates/.claude/skills/springboot-best-practices/SKILL.md
Spring Boot patterns for enterprise Java applications
npx skillsauth add baekenough/oh-my-customcode springboot-best-practicesInstall 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.
Layered architecture: controller (REST), service (business logic), repository (data access), model/entity, dto, config, exception.
Constructor injection preferred. Use @RequiredArgsConstructor with final fields. Avoid field injection with @Autowired.
// GOOD: Constructor injection
@Service
@RequiredArgsConstructor
public class UserService {
private final UserRepository userRepository;
private final EmailService emailService;
}
@RestController + @RequestMapping. Use @Validated for input, ResponseEntity for responses, proper HTTP status codes.
See examples/controller-example.java for reference implementation.
Business logic in services. @Transactional boundaries at service level. Interface + implementation pattern.
See examples/service-example.java for reference implementation.
Spring Data JPA. @Query or method naming for custom queries. @Entity with proper JPA annotations.
See examples/repository-example.java and examples/entity-example.java for reference implementations.
@RestControllerAdvice for global handling. Domain-specific exceptions with proper HTTP status mapping.
See examples/exception-handler-example.java for reference implementation.
Profile-based: application-{profile}.yml. @ConfigurationProperties for type-safe config. Externalize sensitive values.
# application.yml
spring:
profiles:
active: ${SPRING_PROFILES_ACTIVE:local}
datasource:
url: ${DATABASE_URL}
username: ${DATABASE_USERNAME}
password: ${DATABASE_PASSWORD}
See examples/config-properties-example.java for type-safe configuration properties.
Spring Security with SecurityFilterChain. Externalize secrets. Proper authentication/authorization patterns.
See examples/security-config-example.java for reference implementation.
@WebMvcTest (controller), @DataJpaTest (repository), @SpringBootTest (integration), @MockBean for mocking.
See examples/controller-test-example.java and examples/repository-test-example.java for reference implementations.
Always: constructor injection, layered architecture, DTOs, global exception handling, externalized config, proper security, layer-appropriate tests.
development
Generate and maintain a persistent codebase wiki — LLM-built interlinked markdown knowledge base (Karpathy LLM Wiki pattern)
development
Use the project wiki as RAG knowledge source — search wiki pages to answer codebase questions before exploring raw files
tools
Analyze task trajectories to propose reusable SKILL.md candidates from successful patterns
data-ai
hada.io RSS feed monitoring for AI agent/harness articles with automated /scout analysis