- Home
- Skills
- Affaan M
- Everything Claude Code
- Java Coding Standards
java-coding-standards_skill
- JavaScript
46.5k
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 affaan-m/everything-claude-code --skill java-coding-standards- SKILL.md3.8 KB
Overview
This skill codifies Java coding standards tailored for Spring Boot services (Java 17+). It focuses on naming, immutability, Optional and stream usage, exception strategy, generics, and project layout to improve readability and maintainability. The guidance is pragmatic and aimed at reviewers and authors working in team services.
How this skill works
The skill inspects code patterns and recommends idiomatic replacements: PascalCase for types, camelCase for members, and UPPER_SNAKE_CASE for constants. It enforces immutability by preferring records and final fields, checks Optional and stream usage for clarity, and flags anti-patterns such as raw generics, deep nesting, and silent catches. It also suggests project layout, logging, null handling, and test conventions to ensure consistent service architecture.
When to use it
- When writing or reviewing Spring Boot service code in Java 17+
- When enforcing naming, immutability, or exception handling conventions
- When evaluating Optional, stream pipelines, or generics for clarity and safety
- When defining package layout, resource placement, or CI test expectations
- When preparing code for maintainability and team handoff
Best practices
- Prefer clarity over cleverness; keep methods short and focused
- Default to immutable state: records and final fields; avoid shared mutable statics
- Use Optional for absent values; map/flatMap and orElseThrow instead of get()
- Keep stream pipelines short; prefer simple loops when pipelines become complex
- Use unchecked domain exceptions with contextual wrapping for technical errors
- Declare generics explicitly and use bounded types for reusable utilities
Example use cases
- Code review checklist for Spring Boot endpoints, services, and repositories
- Refactoring legacy classes into records or final-field domain models
- Replacing nested stream logic with clearer loops and helper methods
- Enforcing project layout and package boundaries in new microservices
- Standardizing exception types and logging patterns across services
FAQ
Prefer records for simple data carriers with fixed fields and no behavior. Use classes when mutable state, inheritance, or complex behavior is required.
How do I handle Optional in APIs?
Return Optional only for find-style lookups. Avoid Optional as method parameters or fields. Use map/flatMap and orElseThrow for clear handling.
When are checked exceptions appropriate?
Use checked exceptions for recoverable API-level errors when callers are expected to handle them; otherwise prefer unchecked domain exceptions and wrap technical exceptions with context.