What problem does it solve?
This Skill ensures that Java code in Spring Boot services adheres to established coding standards, enhancing readability, maintainability, and consistency.
Core Features & Use Cases
- Naming Conventions: Enforces PascalCase for classes and records, camelCase for methods and fields, and UPPER_SNAKE_CASE for constants.
- Immutability: Promotes the use of records and final fields to minimize shared mutable state.
- Optional Usage: Encourages the use of Optional for find* methods and map/flatMap for handling nulls.
- Streams Best Practices: Recommends using streams for transformations and avoiding complex nested streams.
- Exception Handling: Provides guidance on using unchecked exceptions for domain errors and creating domain-specific exceptions.
- Generics and Type Safety: Advocates for avoiding raw types and using bounded generics.
- Project Structure: Defines a recommended project layout for Maven/Gradle-based Spring Boot services.
- Formatting and Style: Offers guidelines on coding style, including spacing, file structure, and code organization.
- Code Smells: Identifies and advises on avoiding common code smells like long parameter lists and deep nesting.
- Logging: Suggests best practices for logging with context.
- Null Handling: Recommends using Bean Validation for inputs and accepting
@Nullable only when necessary.
- Testing Expectations: Outlines testing expectations with JUnit 5, AssertJ, and Mockito.
Quick Start
Use the java-coding-standards skill to review your Spring Boot service code and ensure it adheres to Java coding standards.