Command Palette

Search for a command to run...

UnylyUnyly
Back to skills

java-language

FreeNo executable scriptsNot checked

Modern Java 21+ language standards including Records, Pattern Matching, and Virtual Threads. Use for Java language constructs or Java-to-Java upgrades; defer…

HoangNguyen0403by HoangNguyen0403★ 598 GitHub stars

About this skill

Java Language Patterns

Priority: P0 (CRITICAL)

Implementation Guidelines

  • Records: Use record for immutable DTOs/Value Objects. Records auto-generate equals, hashCode, toString. Avoid Lombok @Data on Pojos.
  • Local Variables: Use var for inferred types. Explicitly type interface variables.
  • Switch: Use Switch Expressions (->) and Pattern Matching over complex if/else chains.
  • Text Blocks: Use """ (text blocks, Java 15+) for JSON, SQL, or multi-line strings; the opening """ must be followed by a line terminator, and closing-delimiter placement sets incidental indentation.
  • Pattern Matching: Use instanceof with pattern binding: if (obj instanceof String s).
  • Sealed Classes: Use sealed interface/class with permits clause for domain-driven restricted hierarchies. Switch expressions then exhaustive switch (compiler-verified).
  • Collections: Use List.of(), Map.of(), and Set.of() for immutable collections.
  • Streams: Use stream() pipelines for functional transformations. Use .toList() (Java 16+).
  • Optional: Utilize Optional<T> for return types. Use .ifPresentOrElse() or .orElseThrow().
  • Virtual Threads: Favor Executors.newVirtualThreadPerTaskExecutor() for I/O-heavy workloads (stable since 21).
  • Preview APIs: StructuredTaskScope and other preview features need an explicit project opt-in, an exact JDK pin, and --enable-preview at compile and runtime; never present them as a stable default on a JDK where they are still preview. See concurrency reference.

Anti-Patterns

  • No Nulls: Return Optional or empty collections; avoid null parameters.
  • No Raw Types: Always use generics; never use raw List or Map.
  • No Old Switch: Use switch expressions (->); avoid fall-through.
  • No Manual get/set: Use Records or value objects instead.
  • No unbounded blocking in monitors: On JDK 21–23 blocking inside synchronized pins the carrier; JDK 24+ (JEP 491) removes that. Prefer ReentrantLock for timed/try/interruptible locking, not merely to dodge pinning — and do not ban synchronized wholesale.

References

Install java-language in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

Bundled files

evals/evals.jsonreferences/example.md

FAQ

What does the java-language skill do?

Modern Java 21+ language standards including Records, Pattern Matching, and Virtual Threads. Use for Java language constructs or Java-to-Java upgrades; defer Kotlin, tests, formatting/build tools, CompletableFuture, builder patterns, and isolated null-handling questions.

How do I install the java-language skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the java-language skill run scripts?

No, this skill is instructions only (SKILL.md) with no executable scripts.

Related skills

Compare java-language with