Modern Java guidance
Guides agents to write Java 17/21+ and Spring Boot 3.x+ code with version detection and the mjg CLI scanner instead of Java 8 and Boot 2.x patterns.
Safety check
- Not rated by Claude yet. We only sell skills Claude has read and rated 7 out of 10 or higher, so this one is a free link to its author.
An automated scan lowers risk but cannot promise zero risk. How we check skills
Preview
The first lines of SKILL.md
---
name: modern-java-guidance
description: "Guides agents to write Java 17/21+ and Spring Boot 3.x+ code with version detection and the mjg CLI scanner instead of Java 8 and Boot 2.x patterns."
category: development
risk: safe
source: self
source_type: self
date_added: "2026-11-18"
author: wkd09
tags: [java, spring-boot, java-21, spring-security, cli]
---
# Modern Java Guidance
## Overview
Prevents AI coding agents from defaulting to Java 8 and Spring Boot 2.x legacy patterns (`javax.*`, `WebSecurityConfigurerAdapter`, `RestTemplate`, `@Autowired` field injection, `Executors.newFixedThreadPool()`, `list.get(list.size() - 1)`). Unlike general persona skills such as `java-pro`, this skill pairs lightweight instructions with version-gated CLI scanning (`mjg detect`, `mjg check`, `mjg search`, `mjg retrieve`) and respects older Java 8/11 and Spring Boot 2.x codebases without forcing upgrades.
## When to Use
- Writing, refactoring, or reviewing Java 17/21/25+ or Spring Boot 3.x+ application code.
- Auditing an existing Java or Spring Boot codebase for deprecated Boot 2.x or Java 8 idioms.
- Prefer `java-pro` for broader JVM/GraalVM tuning topics not covered by this skill's rules.
## Prerequisites
- Local workspace containing a Java or Spring Boot project (`pom.xml`, `build.gradle`, `build.gradle.kts`, or `.java-version`).
- Optional: Python 3.11+ with the `mjg` CLI (`https://github.com/wkd09/modern-java-guidance`) for automated version detection and scanning. Everything runs 100% offline with zero external network calls or credentials.
## How It Works
### 1. Establish the inputs
Inspect `pom.xml`, `build.gradle(.kts)`, `gradle/libs.versions.toml`, or `.java-version` (or run `mjg detect .` if installed).
- **Java <= 11 or Spring Boot 2.x**: Preserve existing language/framework idioms; do not emit Java 17/21 syntax or `jakarta.*` unless explicitly asked to migrate.
- **Java 17+ / Spring Boot 3.0–3.1**: Apply modern replacements (`record`, `sealed interface`, `SecurityFilterChain` Lambda DSL with CSRF enabled by default, `jakarta.*`, constructor injection, `java.time`). Keep `WebClient` or `RestTemplate` (`RestClient` requires Boot 3.2+).
- **Spring Boot 3.2+**: Prefer `RestClient` / `@HttpExchange` over `RestTemplate`.
- **Java 21+**: Prefer Pattern Matching for `switch`, `SequencedCollection.getLast()`, and `Executors.newVirtualThreadPerTaskExecutor()` for blocking I/O.
...From sickn33's repository, MIT licence.
Related skills
-
Checked
Rust code review
Reviews Rust code for idiom, errors, safety and API design, with a ranked report and a fix for every finding.
7/101 credit -
Checked
Java Debugging Guide
Finds the cause of Java bugs and failing tests, and attaches a debugger safely in Maven, Gradle, Spring or Docker.
7/101 credit -
Checked
Python games with pygame
Builds and debugs 2D pygame games with a proper loop and delta time, so they run the same on any PC.
7/101 credit -
Checked
Go Benchmarking and Profiling
Writes Go benchmarks, profiles them with pprof and proves each speedup with benchstat before you claim it.
7/101 credit -
Checked
nvMolKit GPU cheminformatics
Writes nvMolKit code for GPU fingerprints, similarity and clustering, so molecule searches run far faster.
7/101 credit -
Checked
Modern Java Coding
Writes and reviews modern Java 21 and 25 code with records, sealed types, pattern matching and virtual threads.
7/101 credit