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

    by 장준민

    1

    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.

    Free

    Security scanned

    Works with the AI Agents you already use

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

    Example session with this skill installed

    Example task: This project targets Java 21 and Spring Boot 3.2. Keep the configured versions. Replace the immutable UserDto POJO with a record and modernize this service using constructor injection and RestClient. Assume spring-boot-starter-web is present.

    @Service
    class UserService {
        @Autowired private RestTemplate restTemplate;
        public UserDto getUser(long id) {
            return restTemplate.getForObject("https://api.example.com/users/" + id, UserDto.class);
        }
    }
    

    UserDto has two immutable fields: Long id and String email.

    • Read your context and instructions
    • Compiled the modern java guidance

    Illustrative output

    This is a worked example for the versions supplied in the prompt, not a recorded test run. In a real repository, inspect the build files or run mjg detect . before editing.

    AreaApplied change
    DTORecord for immutable data; do not apply this to a JPA entity
    Dependency injectionConstructor injection with a final client
    HTTP clientRestClient, suitable for Spring Boot 3.2+

    UserDto.java

    package com.example.api;
    
    public record UserDto(Long id, String email) {}
    

    UserService.java

    package com.example.api;
    
    import java.util.Objects;
    import org.springframework.stereotype.Service;
    import org.springframework.web.client.RestClient;
    
    @Service
    public class UserService {
        private final RestClient client;
    
        public UserService(RestClient.Builder builder) {
            this.client = builder.baseUrl("https://api.example.com").build();
        }
    
        public UserDto getUser(long id) {
            return Objects.requireNonNull(
                client.get()
                    .uri("/users/{id}", id)
                    .retrieve()
                    .body(UserDto.class),
                "User response body must not be empty"
            );
        }
    }
    

    Next steps

    1. Configure the real service URL, authentication, timeouts, and error handling for your application.
    2. With the separately installed CLI, run mjg check src/main/java for supported pattern findings.
    3. Compile the project and run relevant tests, including empty-body and HTTP-error cases. No build or test result is claimed for this illustrative output.

    Connects securely to your tools. The creator never sees your data.

    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

    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

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Free to use

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed 18 days ago

    • Free with an Agensi account

    Software
    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.

    Permissions

    Terminal / Shell
    Read Files
    Write Files

    Reads Java source and build configuration to identify project versions; uses the local mjg CLI for supported pattern checks. The coding agent needs file-write access when applying requested refactors. No connected service account is required.

    Listed18 days ago

    What's inside

    Creator

    장준민

    장준민

    Frequently Asked Questions

    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.

    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.

    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.

    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.

    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.

    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.

    New in APIs & Backend

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for APIs & Backend.

    Free