Effective Modern Java: a version-calibrated agent skill
An agent skill that makes AI coding agents (Claude Code, Cursor, Copilot, Junie, and others) write, refactor and review plain Java the way a senior engineer would today. It applies Effective Java's principles, mapped item by item onto Java 17, 21 and 25 LTS, and calibrates to the Java release your project actually builds with.
It is not a Java tutorial, because the model already knows the language. It targets the three mistakes agents actually make:
- Code that doesn't compile on your JDK. Agents write record patterns in a Java 17 build,
_ on Java 21, or StructuredTaskScope without --enable-preview. The skill reads pom.xml/build.gradle(.kts) first, gates every feature by release, and proves the result with javac --release N.
- Pre-2017 idioms where a modern one is clearly better: getter/setter POJOs,
instanceof-cast ladders, Collectors.toList(), Date, e.printStackTrace(), platform thread pools for blocking I/O.
- Effective Java advice that modern Java has refined or superseded. For example, tagged classes become sealed types, hand-written
equals/hashCode becomes records, readObject hardening becomes record deserialization, and newFixedThreadPool for I/O becomes virtual threads.
What's inside
SKILL.md # baseline detection, release gates, opinionated defaults, workflows, self-check
references/
├── modern-java.md # Java 17 → 25 feature guide: JEPs, final-in release, BAD/GOOD code, pitfalls,
│ # preview-only features, removed/withdrawn APIs, safe upgrade order
└── effective-java.md # all 90 Effective Java (3rd ed.) items: Applies / Refined / Superseded + modern note,
# plus worked before/after examples for the items modern Java changes most
evals/ # 5 benchmark cases (claude plugin eval format) with graders
.claude-plugin/marketplace.json # lets Claude Code install it with /plugin
The agent loads SKILL.md when it writes or reviews Java. It pulls a reference only when it uses a newer feature, upgrades code, or needs the reasoning behind a rule.
How it differs from other Java skills
- Calibrated to your version, not to a single version. It works on 17, 21 and 25 codebases and tells the agent exactly what is off-limits on each.
- Effective Java as a cross-reference. Each of the 90 items has a modern status, so reviews can cite
EJ 11 and readers can look up the reasoning.
- Verification built in. It runs the project build, or
javac --release N -Xlint:all when there is no build.
- Release facts checked at the source (OpenJDK project and JEP pages, local
javap) as of November 2026. JDK 26 and 27 finalized no language features. Structured concurrency, primitive patterns and lazy constants are still preview. String templates were withdrawn.
Install
The skill follows the open Agent Skills format: a folder with SKILL.md at its root. Every major coding agent reads that format natively, but they look in different folders.
One command, any agent (recommended)
npx skills (Node 22.20+) detects the agents you have installed. It puts one copy in .agents/skills/ and links it into each agent's folder:
npx skills add adityamparikh/effective-modern-java -g # for your user, all projects
npx skills add adityamparikh/effective-modern-java # this project only (writes skills-lock.json)
Use -a claude-code -a codex -a cursor … to choose agents, --copy where symlinks don't work, and npx skills update to pull new versions.
Manual install with git
Most agents read the shared ~/.agents/skills/ folder: Codex, GitHub Copilot (CLI and cloud agent), Cursor, Gemini CLI, Junie, OpenCode, Goose, Amp, Cline, Roo Code and Devin Desktop (formerly Windsurf).
git clone https://github.com/adityamparikh/effective-modern-java ~/.agents/skills/effective-modern-java
Claude Code and Kiro don't read ~/.agents/skills/, so link the same copy into their folders:
mkdir -p ~/.claude/skills && ln -s ~/.agents/skills/effective-modern-java ~/.claude/skills/effective-modern-java
mkdir -p ~/.kiro/skills && ln -s ~/.agents/skills/effective-modern-java ~/.kiro/skills/effective-modern-java
For a single project, clone into the project's .agents/skills/ folder, or .claude/skills/ for Claude Code, instead of the home-directory folders. Update with git -C ~/.agents/skills/effective-modern-java pull.