agentleFS
kumaran-iskumaran-is/claude-code-onboarding/.claude/skills/java-coding-standard/SKILL.md

java-coding-standard

Skill35 starsChanged 6 months agoMITView on GitHub

This skill should be activated when reviewing Java code or enforcing coding standards in Spring Boot services. It covers naming conventions, immutability patterns, Optional usage, streams, and exception handling.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Iron Law: Always load the java-spring-api skill and consult Spring MCP before writing Java code.

    line 15
  2. Distinctive:

    Prefer clarity over cleverness

    line 23
  3. Distinctive:

    Remember: Keep code intentional, typed, and observable.

    line 55
  4. Very specific:

    Checked vs unchecked exceptions: Use unchecked (RuntimeException subclasses) for programming errors.

    line 59
  5. Very specific:

    Optional misuse: Never call .get() without .isPresent() or use .orElseThrow().

    line 61

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Iron Law: Always load the java-spring-api skill and consult Spring MCP before writing Java code; never generate Spring WebFlux patterns from memory.

Java Coding Standards

Standards for readable, maintainable Java (21+) code in Spring Boot Reactive Web Flux services.

Core Principles

  • Prefer clarity over cleverness
  • Immutable by default; minimize shared mutable state
  • Fail fast with meaningful exceptions
  • Consistent naming and package structure

Key Rules

RuleStandard
NamingClasses: PascalCase, methods/fields: camelCase, constants: UPPER_SNAKE_CASE
ImmutabilityFavor records and final fields; getters only, no setters. Exception: R2DBC entities require setters for framework binding
OptionalReturn Optional from find* methods; use map/flatMap, never .get(). In reactive code, Mono<T> replaces Optional<T> — use switchIfEmpty() instead
StreamsShort pipelines for transforms; prefer loops for complex logic
ExceptionsUnchecked domain exceptions; avoid broad catch (Exception)
GenericsNo raw types; prefer bounded generics for reusable utilities
Null handling@NonNull by default; Bean Validation on inputs
LoggingSLF4J with structured key=value pairs
TestingJUnit 5 + AssertJ + Mockito + WebTestClient for reactive; deterministic, no sleeps

Project Structure

src/main/java/com/company/<service>/
  config/ → controller/ → service/ → repository/ → model/entity/ → model/dto/ → exception/
src/main/resources/application.yml
src/test/java/... (mirrors main)

Code Examples & Detailed Patterns

For naming examples, immutability patterns, Optional usage, streams, exception handling, generics, logging, formatting, code smells, and testing expectations, Read reference/java-standards-examples.md.

Remember: Keep code intentional, typed, and observable. Optimize for maintainability over micro-optimizations unless proven necessary.

Error Handling

Checked vs unchecked exceptions: Use unchecked (RuntimeException subclasses) for programming errors. Use checked exceptions only for recoverable conditions the caller must handle.

Optional misuse: Never call .get() without .isPresent() or use .orElseThrow(). Prefer map/flatMap chains.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.