Command Palette

Search for a command to run...

Back to skills
skill № 51305

Java

Writes, debugs, and tunes Java and the JVM: nulls, equality, collections, generics, concurrency, streams, memory, builds, and upgrades. Use when Java throws…

FreeNo executable scripts
clawicby clawic★ 23 GitHub stars

Install Java 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

About this skill

User preferences and memory live in ~/Clawic/data/java/ (see setup.md on first use, memory-template.md for the file format). If you have data at an old location (~/java/ or ~/clawic/java/), move it to ~/Clawic/data/java/, and say in one line that you moved it and from where.

When To Use

  • Writing or reviewing Java: APIs, data modelling, collections, generics, error handling, concurrency
  • Debugging a running JVM: exceptions, crash loops, deadlocks, 100% CPU, growing heap, slow startup
  • Sizing heap and GC for a container, reading a thread dump or heap dump, profiling and benchmarking
  • Fighting the build: dependency version conflicts, fat jars, module errors, --release mismatches
  • Upgrading a JDK (8 → 17 → 21+), migrating javax → jakarta, replacing removed APIs
  • Testing: JUnit 5, Mockito, Testcontainers, tests that silently don't run or fail only in CI
  • Integrating outward: HTTP clients and timeouts, JDBC pools and batching, logging wiring
  • Not for Kotlin syntax, Android SDK/UI, or JavaScript — different skills; JVM-level advice here still applies under Kotlin

Quick Reference

Situation Go to
An exception or error whose name you must decode; hang, deadlock, 100% CPU, works-in-IDE-only debug.md
OutOfMemoryError, heap grows over days, heap dump analysis, container OOM-kill memory.md
Choosing a GC, setting -Xmx in a container, slow startup, JVM flags, -Xlog jvm.md
Slow code and no idea where; JMH benchmark, JFR recording, allocation pressure performance.md
Shared mutable state, locks, volatile, atomics, deadlock design, virtual threads concurrency.md
CompletableFuture chains, executors, timeouts, cancellation, structured concurrency async.md
Which collection, the equals/hashCode contract, iteration traps, comparators, maps collections.md
Stream pipeline wrong or slow, collectors, groupingBy, parallel streams streams.md
Lambdas and method references, designing a @FunctionalInterface, capture rules, a checked exception inside a lambda lambdas.md
Designing against null, Optional, autoboxing, nullability annotations nulls.md
Type erasure, wildcards, List<Dog> vs List<Animal>, unchecked warnings generics.md
Class design: records, sealed types, pattern matching, immutability, inheritance classes.md
Custom annotations, runtime metadata, setAccessible, MethodHandle/VarHandle, dynamic proxies, annotation processors reflection.md
Checked vs unchecked, try-with-resources, retries, interrupts, logging failures exceptions.md
Strings, StringBuilder, regex, String.format, charsets, locale-sensitive output text.md
Dates, time zones, DST, Instant vs LocalDateTime, formatting patterns datetime.md
Files, Path, classpath resources, temp files, streams that leak handles io.md
Jackson/JSON mapping, records in JSON, Java serialization and its CVEs serialization.md
Calling another service: HTTP client choice, timeouts, DNS caching, TLS handshake errors http.md
JDBC connections, pool exhaustion, batching, fetch size, driver and transaction behavior jdbc.md
SLF4J bindings, duplicate or missing log output, MDC, log levels, structured logs logging.md
Maven/Gradle version conflicts, scopes, fat jars, multi-module, reproducible builds build.md
Upgrading a JDK, javax → jakarta, removed APIs, --add-opens, illegal reflective access migration.md
Deserialization gadgets, XXE, path traversal, SQL injection, TLS, secrets, crypto choices security.md
JUnit 5, Mockito, AssertJ, Testcontainers, flaky tests, tests that never ran testing.md
Spring Boot: @Transactional, proxies, JPA lazy loading, N+1, bean wiring, config precedence spring.md
Anything else Exception Triage and Core Rules below; then reproduce it in a single main with no framework

Core Rules

  1. .equals() for content; == only for primitives, enums, and deliberate identity. Integer a = 128, b = 128; a == b is false, while at 127 it is true — the autobox cache is −128..127 (-XX:AutoBoxCacheMax moves only the upper bound). Use Objects.equals(a, b) whenever either side can be null.
  2. equals and hashCode ship together, over fields that never change. Contract: equal objects must return the same hash; unequal objects may collide. Failure mode: set.add(o), then mutate a field used in hashCode() → set.contains(o) is false and the entry is unreachable forever. Hash only final fields (→ collections.md).
  3. Never swallow InterruptedException. catch (InterruptedException e) { Thread.currentThread().interrupt(); return; } — the flag is the only channel that tells the pool to stop; swallowing it makes every shutdownNow() wait out the full timeout and every cancellation silently fail.
  4. Every AutoCloseable in try-with-resources — including Files.lines, `
Full SKILL.md on GitHub

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

Bundled files

  • _meta.json
  • async.md
  • build.md
  • classes.md
  • collections.md
  • concurrency.md
  • datetime.md
  • debug.md
  • exceptions.md
  • generics.md
  • http.md
  • io.md
  • jdbc.md
  • jvm.md
  • lambdas.md
  • logging.md
  • memory-template.md
  • memory.md
  • migration.md
  • nulls.md
  • performance.md
  • reflection.md
  • security.md
  • serialization.md
  • setup.md
  • spring.md
  • streams.md
  • testing.md
  • text.md

FAQ

What does the Java skill do?

Writes, debugs, and tunes Java and the JVM: nulls, equality, collections, generics, concurrency, streams, memory, builds, and upgrades. Use when Java throws NullPointerException, ClassCastException, ConcurrentModificationException, NoClassDefFoundError, NoSuchMethodError, UnsupportedClassVersionError or OutOfMemoryError, when a service deadlocks, hangs, burns CPU, or leaks memory, when equals/hashCode, Optional, generics, streams, or CompletableFuture misbehave, when dates shift or text turns into question marks, when Maven or Gradle resolves the wrong version or a fat jar fails only after packaging, when @Transactional does not roll back or an entity throws LazyInitializationException, when tests silently do not run, or when moving from Java 8 to 17/21+ and javax became jakarta. Also for choosing collections, sizing heap in containers, thread dumps, profiling, JDBC connection pools, HTTP timeouts, and logging setup. Not for Kotlin, Android app development, or JavaScript.

How do I install the Java 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 skill run scripts?

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

Related skills

Compare Java with