# Modern Java Guidance (Java 21+ & Spring Boot 3.x+)

> Stop AI coding agents from generating legacy Java 8 and Spring Boot 2.x patterns. Version-aware guidance for Java 17/21/25+ and Spring Boot 3.x+, with a companion CLI scanner and PostToolUse hook available on GitHub.

Modern Java Guidance (Java 21+ & Spring Boot 3.x+) is a free AI agent skill on Agensi by 장준민, in APIs & Backend. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [장준민](https://www.agensi.io/creators/creator-1296)
- Category: [APIs & Backend](https://www.agensi.io/skills/apis-backend)
- Version: 1.0
- Last updated: 2026-11-17
- Security: scan passed (2026-11-17); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/modern-java-guidance-java-21-spring-boot-3-x
- Tags: api, code-review, java, spring-boot, backend, refactoring

## About this skill

**Modern Java Guidance (`mjg`)** steers AI coding agents toward modern Java 17/21/25+ and Spring Boot 3.x+ idioms while respecting the project's configured versions.

### What it solves
Coding agents can fall back to Java 8 and Spring Boot 2.x patterns. This skill guides them toward suitable modern alternatives for Jakarta EE imports, Spring Security configuration, HTTP clients, dependency injection, immutable DTOs, and blocking I/O concurrency.

### Key features
- **Lightweight SKILL.md:** Guidance for `record`, `sealed interface`, pattern matching for `switch`, `SequencedCollection`, virtual threads, `SecurityFilterChain` Lambda DSL, `RestClient`, `@HttpExchange`, and RFC 9457 `ProblemDetail`.
- **Version-aware workflow:** Inspect build files or use `mjg detect` to identify Java and Spring Boot versions before suggesting changes. Java 21 features are gated accordingly; `RestClient` guidance targets Boot 3.2+. Legacy projects retain their configured baseline unless migration is requested.
- **Companion CLI and PostToolUse hook:** `mjg check` scans Java files for supported legacy patterns; `mjg hook` integrates post-edit checks. The CLI uses the Python 3.11+ standard library and runs locally. The repository reports an approximately 31 ms median hook subprocess time on Apple Silicon; results depend on the environment.
- **On-demand lookup:** `mjg search` and `mjg retrieve` provide Before/After snippets and caveats by keyword or rule ID.

### Included in this free download
- `modern-java-guidance/SKILL.md`
- `modern-java-guidance/references/java-21-25-core.md`
- `modern-java-guidance/references/spring-boot-3x.md`

**The CLI and hook are not bundled in this ZIP.** Install them separately from the GitHub repository to use `mjg detect`, `check`, `hook`, `search`, and `retrieve`. The repository also contains setup instructions and an evaluation suite.

### Compatibility and caveats
Use with agents that support SKILL.md, including Claude Code, Cursor, Codex CLI, and compatible Copilot workflows. Hook support depends on the host agent. Use records for suitable immutable DTOs, not JPA entities; prefer virtual threads for blocking I/O while retaining bounded pools where CPU or concurrency limits require them. Guidance and pattern scans complement project builds, tests, and review.

### GitHub repository and CLI installer
https://github.com/wkd09/modern-java-guidance

## Requires

- Python 3.11+
- mjg CLI (install separately from GitHub)

The ZIP contains SKILL.md and two references. Install the companion mjg CLI from the linked GitHub repository for automated checks and hook setup. Manual guidance can be read without the CLI.

## Known limitations

The ZIP contains instructions and references; the mjg CLI and PostToolUse hook require separate installation. Hook support depends on the host agent. Pattern checks cover supported rules and do not replace builds, tests, or review. Legacy baselines are preserved unless migration is requested.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Modern Java Guidance (Java 21+ & Spring Boot 3.x+) skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### How does this skill guide modern Java and Spring Boot code?

It instructs the agent to check project versions first, choose compatible modern APIs, consult focused references, and run supported pattern checks with the separately installed mjg CLI. Agent guidance and scans are not a guarantee of correct code.

### Does the skill detect my project's Java and Spring Boot versions?

With mjg installed separately, the agent can run mjg detect to inspect supported Maven, Gradle, version-catalog, and .java-version files. The instructions also allow inspecting build files directly.

### Which coding agents can use this skill?

Use an agent that can load SKILL.md and read project files, such as Claude Code, Cursor, Codex CLI, or compatible Copilot workflows. CLI checks require terminal access; automatic hooks require host-agent support.

### Can I use it with a Java 8/11 or Spring Boot 2.x project?

Yes. The instructions preserve the configured legacy baseline and avoid incompatible modern syntax unless migration is requested. Always review detection results and validate changes with the project's build and tests.

### What is included in the free ZIP?

This free download contains modern-java-guidance/SKILL.md and two reference documents: java-21-25-core.md and spring-boot-3x.md. The CLI and hook are available separately at https://github.com/wkd09/modern-java-guidance.

### Where can I find updates and report issues?

Follow https://github.com/wkd09/modern-java-guidance for source changes, installation instructions, and issue reporting. No fixed update schedule or automatic update delivery is promised.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
