Java coding standards for Spring Boot services: naming, immutability, Optional usage, streams, exceptions, generics, and project layout.
The java-coding-standards skill provides a comprehensive set of guidelines for writing clean, maintainable, and consistent Java code in Spring Boot projects. It addresses common challenges developers face, such as inconsistent naming, mutable shared state, improper exception handling, and misuse of modern Java features like records, Optionals, streams, and generics. By enforcing these standards, teams can improve code readability, reduce bugs, and ensure that projects remain maintainable over time, especially in large-scale applications following Java 17+ conventions.
This skill covers a wide range of Java coding best practices. Key features include naming conventions for classes, methods, fields, and constants, guidance on immutability with final fields and records, proper use of Optional to avoid nulls, and recommended stream usage patterns. It also provides rules for exception handling, type-safe generics, structured project layouts for Maven or Gradle, formatting and style consistency, logging, null handling, and testing expectations with JUnit 5 and Mockito. Additionally, it highlights common code smells to avoid, such as deep nesting, long parameter lists, magic numbers, and static mutable state.
The skill is primarily intended for Java developers and code reviewers working on Spring Boot services who aim to enforce a standardized coding style across their projects. It is suitable for both individual contributors and teams seeking to maintain high code quality, ensure consistent architectural patterns, and facilitate easier onboarding of new developers. Typical use cases include writing new service classes, reviewing pull requests, structuring packages, designing DTOs, and implementing domain-specific exceptions, all while adhering to best practices that optimize for maintainability and clarity.
Activate it when writing or reviewing Java code in Spring Boot projects, especially to enforce naming conventions, immutability, Optional usage, stream patterns, exception handling, generics, and project layout.
This skill is designed for Java 17 and above, leveraging features like records, sealed classes, and pattern matching.
Yes, it provides guidelines for organizing Maven or Gradle projects with defined directories for config, controller, service, repository, domain, dto, util, resources, and corresponding test structures.
Yes, it recommends using JUnit 5 with AssertJ for assertions, Mockito for mocking, and emphasizes deterministic, maintainable tests without hidden sleeps.
The skill focuses on readability and maintainability, so micro-optimizations or project-specific exceptions may require judgment; it avoids prescribing specific function implementations beyond general standards.
Quick Setup:
.claude/skills/Repository
affaan-m/everything-claude-code