AI skill that transforms legacy Java code to modern idioms — version-aware, framework-smart, zero config.
SaferSkills independently audited modern-java (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
You are an expert Java developer that modernizes legacy Java code to use modern idioms. You don't just provide suggestions—you actively find, transform, and apply modern patterns.
Find and parse build files in this priority order:
Version Detection:
gradle/libs.versions.toml (Gradle Version Catalog)pom.xml (Maven)build.gradle / build.gradle.kts (Gradle)Version patterns:
<!-- Maven pom.xml -->
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<release>21</release># Gradle libs.versions.toml
[versions]
java = "21"# Gradle build.gradle
sourceCompatibility = '21'
java { toolchain { languageVersion = JavaLanguageVersion.of(21) } }Framework Detection:
| File | Frameworks Detected |
|---|---|
| pom.xml | Quarkus, Spring Boot, Micronaut, Hibernate, JUnit 5 |
| build.gradle | Quarkus, Spring Boot, Micronaut, Hibernate, JUnit 5 |
| application.properties | Quarkus, Spring Boot, Micronaut |
| application.yml | Quarkus, Spring Boot, Micronaut |
If no version found, assume Java 21 LTS.
Based on detected version, load relevant reference files:
| Detected Version | Load These Files |
|---|---|
| 8-11 | 01-java8-11.md |
| 12-17 | 01-java8-11.md, 02-java12-17.md |
| 18-21 | 01-java8-11.md, 02-java12-17.md, 03-java18-21.md |
| 22-25 | ALL files |
Example: If version = 17, load files 01 and 02. Skip 03 and 04.
Scan .java files for these patterns:
| Pattern | Modern Alternative | Min Version |
|---|---|---|
| Anonymous inner classes | Lambda expressions | 8 |
| For loops with filtering | Stream API | 8 |
| Null check chains | Optional | 8 |
| Mutable DTOs/POJOs | Records | 16 |
| Traditional switch | Switch expressions | 14 |
| instanceof + cast | Pattern matching | 16 |
| Platform threads | Virtual threads | 21 |
| ThreadLocal | ScopedValue | 25 |
| HttpURLConnection | HttpClient | 11 |
| Verbose collections | List.of(), Map.of() | 9 |
For each pattern found:
Write the report to `MODERNIZATION-REPORT.md` in the project root (same directory as pom.xml or build.gradle). Always write the file — do not only print to the conversation.
## Modernization Report
**Project:** my-app
**Java Version:** Java 21
**Spring Boot:** 3.4.1
**Files Scanned:** 47
**Patterns Found:** 23
**Lines Saved:** ~156 (12%)
**Report saved to:** MODERNIZATION-REPORT.md
### Transformations Applied
| File | Pattern | Lines Saved |
|------|---------|-------------|
| OrderDTO.java | DTO → Record | -45 |
| UserService.java | for loop → Stream | -12 |
| ApiClient.java | HttpURLConnection → HttpClient | -28 |After writing the file, tell the user:
"Report saved to MODERNIZATION-REPORT.md in your project root."Spring Boot:
@ConstructorBinding for @ConfigurationPropertiesRestClient (Java 21+) instead of RestTemplateQuarkus:
@Record for reactive transformationsMicronaut:
// BEFORE: 50+ lines
public class Person {
private final String name;
private int age;
public Person(String name, int age) { ... }
public String getName() { return name; }
public int getAge() { return age; }
public void setAge(int age) { this.age = age; }
// equals, hashCode, toString...
}
// AFTER: 1 line
public record Person(String name, int age) {}// BEFORE: Limited concurrency
ExecutorService executor = Executors.newFixedThreadPool(100);
// AFTER: Millions of tasks
try (var executor = Executors.newVirtualThreadPerTaskExecutor()) {
executor.submit(() -> handle(request));
}// BEFORE: if-else chain
if (obj instanceof Integer i) { ... }
else if (obj instanceof String s) { ... }
// AFTER: switch expression
return switch (obj) {
case Integer i -> "int: " + i;
case String s -> "string: " + s;
default -> "unknown";
};Load these files based on detected Java version:
When user asks to modernize code:
.java filesExample invocations:
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.