Skip to content

About

A Claude Code plugin with skills for Java projects.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

48 Commits

Folders and files

Repository files navigation

java-toolkit

A Claude Code plugin with skills for Java projects. Its first skill set upgrades Java projects from JDK 8 up to JDK 27. It reads your Maven or Gradle build and your code, writes a plan you approve, then moves the project one LTS release at a time and checks the build and tests after every step. Optional skills adopt newer language features such as records, pattern matching and virtual threads. A companion router upgrades Quarkus from 2.13 to the 3.40 LTS in the same way, adding the JDK hops each Quarkus release needs. A secure-coding skill reviews and writes Java code against the Oracle Secure Coding Guidelines for Java SE. A SOLID skill reviews and writes Java code against the five SOLID design principles. A simplifier agent cleans up recently changed Java code with those skills loaded and checks the result with your build and tests.

Version License Claude Code Java Bash

/java-toolkit:java-upgrade 21

How it works

The java-upgrade skill is the entry point. It routes work to four focused skills:

Skill Role
java-upgrade Detects the build and JDKs, asks for the target, writes .java-upgrade/plan.md, runs the confirmed plan step by step, tracks progress.md, writes summary.md
java-assess Read-only audit: baseline build, signal scan, jdeps --jdk-internals, jdeprscan --for-removal; writes assessment.md
java-build Maven and Gradle changes: release and toolchains, wrapper and plugin versions, annotation processors, Mockito agent, build-blocker libraries (Lombok, JaCoCo, Byte Buddy, Error Prone, Kotlin), CI and Docker JDK
java-migrate Fixes what each hop breaks: 8→11, 11→17, 17→21, 21→25, 25→27
java-modernize Optional feature adoption gated by the project's release, with "do not convert when" rules

Two scripts do the mechanical part. detect.sh reports build tool, wrapper, Java release and where it is set, plugin versions, build-blocker libraries, CI/Docker/pinned JDKs and the JDKs installed on the machine. scan.sh runs a catalog of patterns (signals.tsv) over sources, build files and launch scripts and reports each hit with its category, the JDK where it matters and the fix.

$ scan.sh . --from 8 --to 17 --summary
jaxb      removed  11  2  JEP 320: JAXB removed from JDK. Add jakarta.xml.bind-api + ...
cms-gc    flag     14  1  JEP 363: CMS removed in 14. Use G1 (default) or ZGC
...

scan.sh --security switches to a second catalog slice for java-secure-coding: 20 candidate signals from the Oracle guidelines (deserialization, XML factories, SQL and command construction, mutable statics, native methods, TLS trust overrides, archives, --add-opens). Upgrade scans never report them, and in security mode comment lines are skipped.

Ground rules the skills follow: no edits before you confirm the plan, green baseline first, one hop at a time, no preview features or modernization unless you opt in, tests are never weakened, and JDKs are never installed for you.

All version facts live in one file, jdk-matrix.md, checked against openjdk.org. It also lists common wrong advice that the skills avoid, such as String Templates (removed in 23), -XX:+ZGenerational (obsolete in 24) and StructuredTaskScope.ShutdownOnFailure (gone in 25).

Quarkus upgrades have their own router (see below). Other framework majors (Spring Boot, standalone Hibernate, JUnit) stay out of scope, and the plan lists them as prerequisites when they block the target JDK.

Framework upgrades

java-framework-upgrade is the companion router for framework versions. It starts with Quarkus, from 2.13 to the 3.40 LTS. It walks the LTS streams one hop at a time (3.2, 3.8, 3.15, 3.20, 3.27, 3.33, 3.40) and puts the JDK hops each hop needs into the same plan. For example, Quarkus 3.7 and later need Java 17, so a Java 11 project runs java-upgrade to 17 before its 3.2 → 3.8 hop. Quarkus 4.0 is still beta (4.0.0.Beta3), so it has a reference but runs only when the user opts in.

Skill Role
java-framework-upgrade Detects the Quarkus version, extensions and JDK, writes .framework-upgrade/plan.md with JDK hops interleaved, runs it step by step, tracks progress.md, writes summary.md
java-quarkus-migrate One hop: quarkus update --stream=<LTS> (OpenRewrite recipes), diff review against the hop's automated items, then the manual items from the migration guides, verified on the hop's JDK

detect.sh reports quarkus_version, quarkus_platform, quarkus_plugin, quarkus_extensions and the installed quarkus_cli. scan.sh --framework quarkus --from 3.20 --to 3.40 runs a separate catalog (quarkus.tsv) of renamed artifacts and config keys, removed APIs and behavior changes, keyed by the Quarkus version where each lands. JDK and security scans never report these rows.

The recipes cover only part of each migration. Each hop reference splits the wiki migration guides into items to verify in the recipe diff and manual items with their fix. All version facts live in quarkus-matrix.md, checked against the Quarkus wiki and the source at each LTS tag.

Secure coding

java-secure-coding applies the Secure Coding Guidelines for Java SE (document 11.0) in three modes: explain a guideline, write code that follows it, or review a code base. A review maps trust boundaries, finds candidate sites with scan.sh --security, and reports findings by guideline id (SERIAL-3, INJECT-5) with fixes that compile on the project's release. Security Manager guidelines are flagged as dead code from JDK 24.

The guide's own snippets contain bugs: missing generic type parameters, GzipOutputStream, prepStmt, fields.get("data"), a readObject that drops every field, an InvocationHandler whose hashCode returns true, System.loadLibrary("/com/foo/MyLib.so"), plus wrong facts and method names. Each one was compiled or run on JDK 21 and 25 and is listed with its evidence in errata.md. The skill ships corrected versions, compiled by compile-snippets.sh.

SOLID design

java-solid explains, writes and reviews Java code against the five SOLID principles. A review starts from churn hotspots in git log, finds candidate sites with Claude Code's Grep tool, and reports each finding with its evidence (who changes the class, which edit repeats, which client breaks) and a fix that compiles on the project's release. Each principle has rules for when not to apply it, so the skill does not add interfaces nobody needs.

The references add current Java: sealed types with exhaustive switch as the closed-set form of open/closed, records and final classes against substitution bugs, InstantSource as interface segregation in the JDK, and constructor injection without a framework. Every example compiles on the JDK its marker claims, checked by compile-snippets.sh.

Simplifier agent

java-simplifier is a subagent that simplifies Java code without changing its behavior. It starts with java-solid, java-modernize and java-secure-coding loaded, so their "when not to" rules apply to every edit. It runs only when you ask for it by name.

Step What it does
Scope Java files changed since HEAD (staged, unstaged, untracked), or the paths you name. With neither, it stops instead of sweeping the repository. Test sources are read-only
Gate Reads the release with detect.sh. Every edit compiles on that release
Baseline Builds and tests first with the project's wrapper. A red baseline stops it before any edit
Simplify Flattens nesting, replaces nested ternaries, removes dead code, delegate-only wrappers and comments that restate the code
Verify Builds and tests again. It restores only its own edits to files that break, from a copy it took before editing, never with git
Report Changed and reverted files, and candidates it did not apply (API changes, unrequested modernization)

Newer Java features (records, pattern switch, text blocks) are adopted only when the request also asks to modernize. Otherwise they are listed as candidates. The agent never removes input validation, defensive copies or cleanup code, never touches build files, CI or tests, and never commits.

Requirements

  • bash (3.2+), awk, sed, find; rg is used when present, grep -E otherwise (tested with stock macOS bash 3.2 and BSD grep)
  • The JDKs for each hop installed locally (SDKMAN, /Library/Java/JavaVirtualMachines and /usr/lib/jvm are detected)
  • Maven or Gradle, or the project's wrapper

Install

/plugin marketplace add filippobuletto/claude-plugins
/plugin install java-toolkit@filippobuletto

Usage

Command Does
/java-toolkit:java-upgrade 21 Assess and plan an upgrade to 21, then wait for your confirmation
/java-toolkit:java-upgrade 25 assess Assessment only
/java-toolkit:java-upgrade apply Run the confirmed plan
/java-toolkit:java-upgrade resume Continue from .java-upgrade/progress.md
/java-toolkit:java-modernize records src/main/java Convert value classes to records
/java-toolkit:java-secure-coding review src/main/java Security review against the Oracle guidelines
/java-toolkit:java-solid review src/main/java Design review against the SOLID principles
/java-toolkit:java-framework-upgrade quarkus 3.40 Assess and plan a Quarkus upgrade to 3.40, with the JDK hops it needs
/java-toolkit:java-quarkus-migrate 3.20-to-3.27 Run one Quarkus hop, or ask what changes in it

Plain requests such as "upgrade this project to Java 21" also trigger the router.

Call the simplifier agent by name, or with @java-toolkit:java-simplifier. A plain "simplify this" is usually done by the main session itself:

Use the java-simplifier agent to simplify my recent changes
Use the java-simplifier agent to simplify and modernize src/main/java/com/example/orders

Development

bash tests/run.sh               # detect.sh / scan.sh against tests/fixtures
bash tests/compile-snippets.sh  # compile every marked snippet in references/ on its claimed JDK
claude plugin validate . --strict
claude --plugin-dir .

Behavior evals (claude plugin eval, costs API usage; each case also runs a no-plugin baseline):

claude plugin eval . --scaffold --allow-tools Bash Write --max-cost-usd 5

The java-simplifier-* cases also need Edit, and run best without the baseline arm, where the agent does not exist. Their scaffold (evals/_shared/simplify-workspace.sh) copies the SDKMAN zulu JDK 11 or 17 and Maven into the workspace and resolves dependencies from your ~/.m2, because the eval sandbox cannot read your home directory. Git does not run inside the macOS eval sandbox, so these cases name their paths:

claude plugin eval . --case 'java-simplifier-*' --ablation none --scaffold --allow-tools Bash Edit Write --max-cost-usd 5

compile-snippets.sh compiles each code block preceded by <!-- compile: jdk=N [fails-below] [preview] [raw] --> with an installed JDK (--release N); fails-below also checks that --release N-1 rejects it, which proves the minimum JDK claimed in the text. Missing JDKs are skipped, never downloaded.

License

MIT

About

A Claude Code plugin with skills for Java projects.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages