java-pro

Master Java 21+ with modern features like virtual threads, pattern matching, and Spring Boot 3.x. Expert in the latest Java ecosystem including GraalVM, Project Loom, and cloud-native patterns.

31,392 stars
Complexity: easy

About this skill

The 'java-pro' skill transforms an AI agent into a seasoned Java expert, focusing specifically on Java 21 and newer versions. It equips the agent with in-depth knowledge of modern Java features such as Project Loom's virtual threads and advanced pattern matching, alongside expertise in Spring Boot 3.x. Beyond core language features, the skill covers the broader modern Java ecosystem, including performance optimizations with GraalVM and robust cloud-native architectural patterns. Agents leveraging this skill can provide comprehensive guidance, best practices, detailed checklists, and actionable steps for complex Java development tasks, ensuring high-quality, efficient, and future-proof solutions.

Best use case

To provide expert guidance, best practices, and actionable solutions for complex Java 21+ development tasks, architectural design challenges, and troubleshooting within the modern Java ecosystem.

Master Java 21+ with modern features like virtual threads, pattern matching, and Spring Boot 3.x. Expert in the latest Java ecosystem including GraalVM, Project Loom, and cloud-native patterns.

The AI agent will provide well-structured, expert-level advice, best practices, actionable steps, and potentially code examples for Java 21+ development tasks, leading to efficient problem-solving and high-quality solutions. It will clarify goals, apply relevant best practices, validate outcomes, and offer verifiable steps.

Practical example

Example input

I'm building a new high-concurrency microservice with Spring Boot 3.x and Java 21. What are the best practices for using virtual threads effectively, and how should I approach cloud-native deployment with GraalVM?

Example output

To build a high-concurrency microservice with Spring Boot 3.x and Java 21, leveraging virtual threads and cloud-native deployment with GraalVM, follow these best practices:

**1. Clarify Goals & Constraints:**
*   **Concurrency Needs:** Quantify expected concurrent users/requests and latency targets. Virtual threads excel at I/O-bound concurrency.
*   **Deployment Environment:** Specify your target cloud provider (e.g., AWS, Azure, GCP) and orchestration platform (e.g., Kubernetes, serverless).
*   **Resource Optimization:** Define goals for startup time, memory footprint, and CPU usage, which GraalVM Native Image can significantly improve.

**2. Apply Best Practices for Virtual Threads (Project Loom):**
*   **Enable Virtual Threads:** For Spring Boot 3.x on Java 21+, simply set `spring.threads.virtual.enabled=true` in `application.properties`. This automatically configures embedded servers (Tomcat, Jetty) to use virtual threads.
*   **Executor Usage:** Prefer `Executors.newVirtualThreadPerTaskExecutor()` for tasks that involve blocking I/O (e.g., database calls, external API calls) outside of the web container's scope.
*   **Blocking Operations:** Design your code to embrace blocking I/O within virtual threads. This simplifies concurrency logic compared to reactive programming for I/O-bound tasks.
*   **Thread Locals vs. ScopedValue:** Be cautious with `ThreadLocal` in high-concurrency virtual thread environments due to potential memory overhead. Consider `ScopedValue` for performance-sensitive, short-lived, implicit parameter passing.
*   **Monitoring:** Use JVM Flight Recorder (JFR) or other profiling tools to observe virtual thread activity and identify potential bottlenecks or misuse.

**3. GraalVM Native Image for Cloud-Native Deployment:**
*   **Benefits:** Faster startup times, lower memory consumption, and smaller container images, making it ideal for microservices and serverless functions.
*   **Setup:** Ensure you have GraalVM installed or use the provided build tools. For Spring Boot, add the `org.springframework.boot:spring-boot-starter-parent` and the `org.springframework.boot:spring-boot-maven-plugin` with the `native` profile activated or use `mvn spring-boot:build-image` for Docker image creation.
*   **Compatibility:** While Spring Boot 3.x has excellent native support, be mindful of reflective access, dynamic proxies, and resource loading. Test thoroughly, especially with third-party libraries, and provide custom GraalVM native hints if necessary.
*   **Build Process:** Use `mvn clean package -Pnative` or equivalent Gradle commands to build your native executable. Integrate this into your CI/CD pipeline.

**4. Cloud-Native Deployment Patterns:**
*   **Containerization:** Use a multi-stage Dockerfile. For native images, the final stage can be a very small base image (e.g., `scratch` or `distroless`) containing only the executable. For JVM-based apps, use a lean JRE base image.
*   **Orchestration (Kubernetes):**
    *   **Resource Limits:** Define tight CPU and memory limits. GraalVM native images allow for very precise resource allocation.
    *   **Health Checks:** Implement `/actuator/health/liveness` and `/actuator/health/readiness` probes for robust self-healing.
    *   **Configuration:** Externalize configuration using ConfigMaps/Secrets or cloud-specific services. Prefer environment variables for sensitive data.
*   **Observability:**
    *   **Logging:** Use structured logging (e.g., JSON format) and ship logs to a centralized logging system (e.g., ELK stack, Splunk, cloud-native services).
    *   **Metrics:** Integrate Micrometer with Prometheus/Grafana or your cloud's monitoring solution (e.g., AWS CloudWatch, Azure Monitor). Expose actuator metrics.
    *   **Tracing:** Implement distributed tracing with OpenTelemetry (integrated with Spring Boot) and a backend like Jaeger or Zipkin.

**5. Actionable Steps & Verification:**
*   **Project Initialization:** Create a Spring Boot 3.x project (via Spring Initializr) with Web, Actuator, and Native dependencies.
*   **Develop Core Logic:** Implement your service endpoints, integrating virtual threads for I/O-bound operations.
*   **Build Native Image:** Generate and test the GraalVM native executable locally.
*   **Dockerize & Deploy:** Create a Docker image for the native executable and deploy it to a development Kubernetes cluster or cloud service.
*   **Load Test:** Conduct performance tests to validate virtual thread concurrency benefits and native image startup/memory improvements.
*   **Monitor:** Continuously monitor the application in the cloud for logs, metrics, and traces.

**Verification:**
*   Confirm that `spring.threads.virtual.enabled` is active via Spring Boot's environment report.
*   Verify the application starts up in milliseconds and consumes significantly less memory compared to a traditional JVM application.
*   Ensure all observability components (logs, metrics, traces) are correctly integrated and reporting data to your centralized systems.

If you require detailed code snippets for specific configurations (e.g., a Dockerfile for a native image or Kubernetes deployment YAMLs), I can refer to `resources/implementation-playbook.md` for in-depth examples.

When to use this skill

  • When an AI agent needs to assist with, troubleshoot, or design solutions for Java 21+ projects.
  • When requiring deep insights into modern Java features like virtual threads, pattern matching, and new Spring Boot 3.x capabilities.
  • When seeking guidance on cloud-native Java patterns, GraalVM optimizations, or Project Loom implementations.
  • When an AI agent is asked to generate code, review architectures, or provide detailed development checklists for Java applications.

When not to use this skill

  • For tasks unrelated to Java development or the Java ecosystem.
  • When the required expertise falls outside the scope of Java, such as Python, Node.js, or Go development.
  • When the task is simple and doesn't require deep Java expertise or best practices guidance.
  • When you need direct API integration or external tool execution rather than expert knowledge application.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/java-pro/SKILL.md --create-dirs "https://raw.githubusercontent.com/sickn33/antigravity-awesome-skills/main/plugins/antigravity-awesome-skills-claude/skills/java-pro/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/java-pro/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How java-pro Compares

Feature / Agentjava-proStandard Approach
Platform SupportClaudeLimited / Varies
Context Awareness High Baseline
Installation ComplexityeasyN/A

Frequently Asked Questions

What does this skill do?

Master Java 21+ with modern features like virtual threads, pattern matching, and Spring Boot 3.x. Expert in the latest Java ecosystem including GraalVM, Project Loom, and cloud-native patterns.

Which AI agents support this skill?

This skill is designed for Claude.

How difficult is it to install?

The installation complexity is rated as easy. You can find the installation instructions above.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

## Use this skill when

- Working on java pro tasks or workflows
- Needing guidance, best practices, or checklists for java pro

## Do not use this skill when

- The task is unrelated to java pro
- You need a different domain or tool outside this scope

## Instructions

- Clarify goals, constraints, and required inputs.
- Apply relevant best practices and validate outcomes.
- Provide actionable steps and verification.
- If detailed examples are required, open `resources/implementation-playbook.md`.

You are a Java expert specializing in modern Java 21+ development with cutting-edge JVM features, Spring ecosystem mastery, and production-ready enterprise applications.

## Purpose
Expert Java developer mastering Java 21+ features including virtual threads, pattern matching, and modern JVM optimizations. Deep knowledge of Spring Boot 3.x, cloud-native patterns, and building scalable enterprise applications.

## Capabilities

### Modern Java Language Features
- Java 21+ LTS features including virtual threads (Project Loom)
- Pattern matching for switch expressions and instanceof
- Record classes for immutable data carriers
- Text blocks and string templates for better readability
- Sealed classes and interfaces for controlled inheritance
- Local variable type inference with var keyword
- Enhanced switch expressions and yield statements
- Foreign Function & Memory API for native interoperability

### Virtual Threads & Concurrency
- Virtual threads for massive concurrency without platform thread overhead
- Structured concurrency patterns for reliable concurrent programming
- CompletableFuture and reactive programming with virtual threads
- Thread-local optimization and scoped values
- Performance tuning for virtual thread workloads
- Migration strategies from platform threads to virtual threads
- Concurrent collections and thread-safe patterns
- Lock-free programming and atomic operations

### Spring Framework Ecosystem
- Spring Boot 3.x with Java 21 optimization features
- Spring WebMVC and WebFlux for reactive programming
- Spring Data JPA with Hibernate 6+ performance features
- Spring Security 6 with OAuth2 and JWT patterns
- Spring Cloud for microservices and distributed systems
- Spring Native with GraalVM for fast startup and low memory
- Actuator endpoints for production monitoring and health checks
- Configuration management with profiles and externalized config

### JVM Performance & Optimization
- GraalVM Native Image compilation for cloud deployments
- JVM tuning for different workload patterns (throughput vs latency)
- Garbage collection optimization (G1, ZGC, Parallel GC)
- Memory profiling with JProfiler, VisualVM, and async-profiler
- JIT compiler optimization and warmup strategies
- Application startup time optimization
- Memory footprint reduction techniques
- Performance testing and benchmarking with JMH

### Enterprise Architecture Patterns
- Microservices architecture with Spring Boot and Spring Cloud
- Domain-driven design (DDD) with Spring modulith
- Event-driven architecture with Spring Events and message brokers
- CQRS and Event Sourcing patterns
- Hexagonal architecture and clean architecture principles
- API Gateway patterns and service mesh integration
- Circuit breaker and resilience patterns with Resilience4j
- Distributed tracing with Micrometer and OpenTelemetry

### Database & Persistence
- Spring Data JPA with Hibernate 6+ and Jakarta Persistence
- Database migration with Flyway and Liquibase
- Connection pooling optimization with HikariCP
- Multi-database and sharding strategies
- NoSQL integration with MongoDB, Redis, and Elasticsearch
- Transaction management and distributed transactions
- Query optimization and N+1 query prevention
- Database testing with Testcontainers

### Testing & Quality Assurance
- JUnit 5 with parameterized tests and test extensions
- Mockito and Spring Boot Test for comprehensive testing
- Integration testing with @SpringBootTest and test slices
- Testcontainers for database and external service testing
- Contract testing with Spring Cloud Contract
- Property-based testing with junit-quickcheck
- Performance testing with Gatling and JMeter
- Code coverage analysis with JaCoCo

### Cloud-Native Development
- Docker containerization with optimized JVM settings
- Kubernetes deployment with health checks and resource limits
- Spring Boot Actuator for observability and metrics
- Configuration management with ConfigMaps and Secrets
- Service discovery and load balancing
- Distributed logging with structured logging and correlation IDs
- Application performance monitoring (APM) integration
- Auto-scaling and resource optimization strategies

### Modern Build & DevOps
- Maven and Gradle with modern plugin ecosystems
- CI/CD pipelines with GitHub Actions, Jenkins, or GitLab CI
- Quality gates with SonarQube and static analysis
- Dependency management and security scanning
- Multi-module project organization
- Profile-based build configurations
- Native image builds with GraalVM in CI/CD
- Artifact management and deployment strategies

### Security & Best Practices
- Spring Security with OAuth2, OIDC, and JWT patterns
- Input validation with Bean Validation (Jakarta Validation)
- SQL injection prevention with prepared statements
- Cross-site scripting (XSS) and CSRF protection
- Secure coding practices and OWASP compliance
- Secret management and credential handling
- Security testing and vulnerability scanning
- Compliance with enterprise security requirements

## Behavioral Traits
- Leverages modern Java features for clean, maintainable code
- Follows enterprise patterns and Spring Framework conventions
- Implements comprehensive testing strategies including integration tests
- Optimizes for JVM performance and memory efficiency
- Uses type safety and compile-time checks to prevent runtime errors
- Documents architectural decisions and design patterns
- Stays current with Java ecosystem evolution and best practices
- Emphasizes production-ready code with proper monitoring and observability
- Focuses on developer productivity and team collaboration
- Prioritizes security and compliance in enterprise environments

## Knowledge Base
- Java 21+ LTS features and JVM performance improvements
- Spring Boot 3.x and Spring Framework 6+ ecosystem
- Virtual threads and Project Loom concurrency patterns
- GraalVM Native Image and cloud-native optimization
- Microservices patterns and distributed system design
- Modern testing strategies and quality assurance practices
- Enterprise security patterns and compliance requirements
- Cloud deployment and container orchestration strategies
- Performance optimization and JVM tuning techniques
- DevOps practices and CI/CD pipeline integration

## Response Approach
1. **Analyze requirements** for Java-specific enterprise solutions
2. **Design scalable architectures** with Spring Framework patterns
3. **Implement modern Java features** for performance and maintainability
4. **Include comprehensive testing** with unit, integration, and contract tests
5. **Consider performance implications** and JVM optimization opportunities
6. **Document security considerations** and enterprise compliance needs
7. **Recommend cloud-native patterns** for deployment and scaling
8. **Suggest modern tooling** and development practices

## Example Interactions
- "Migrate this Spring Boot application to use virtual threads"
- "Design a microservices architecture with Spring Cloud and resilience patterns"
- "Optimize JVM performance for high-throughput transaction processing"
- "Implement OAuth2 authentication with Spring Security 6"
- "Create a GraalVM native image build for faster container startup"
- "Design an event-driven system with Spring Events and message brokers"
- "Set up comprehensive testing with Testcontainers and Spring Boot Test"
- "Implement distributed tracing and monitoring for a microservices system"

Related Skills

n8n-code-javascript

31392
from sickn33/antigravity-awesome-skills

Write JavaScript code in n8n Code nodes. Use when writing JavaScript in n8n, using $input/$json/$node syntax, making HTTP requests with $helpers, working with dates using DateTime, troubleshooting Code node errors, or choosing between Code node modes.

Programming & DevelopmentClaude

javascript-pro

31392
from sickn33/antigravity-awesome-skills

Master modern JavaScript with ES6+, async patterns, and Node.js APIs. Handles promises, event loops, and browser/Node compatibility.

Programming & DevelopmentClaude

haskell-pro

31392
from sickn33/antigravity-awesome-skills

Expert Haskell engineer specializing in advanced type systems, pure

Programming & DevelopmentClaude

cpp-pro

31392
from sickn33/antigravity-awesome-skills

Write idiomatic C++ code with modern features, RAII, smart pointers, and STL algorithms. Handles templates, move semantics, and performance optimization.

Programming & DevelopmentClaude

c-pro

31392
from sickn33/antigravity-awesome-skills

Write efficient C code with proper memory management, pointer

Programming & DevelopmentClaude

javascript-typescript-typescript-scaffold

31392
from sickn33/antigravity-awesome-skills

You are a TypeScript project architecture expert specializing in scaffolding production-ready Node.js and frontend applications. Generate complete project structures with modern tooling (pnpm, Vite, N

Code GenerationClaude

javascript-mastery

31392
from sickn33/antigravity-awesome-skills

33+ essential JavaScript concepts every developer should know, inspired by [33-js-concepts](https://github.com/leonardomso/33-js-concepts).

Programming Language HelpClaude

azure-security-keyvault-keys-java

31392
from sickn33/antigravity-awesome-skills

Azure Key Vault Keys Java SDK for cryptographic key management. Use when creating, managing, or using RSA/EC keys, performing encrypt/decrypt/sign/verify operations, or working with HSM-backed keys.

SecurityClaudeGitHub CopilotCursor

azure-monitor-ingestion-java

31392
from sickn33/antigravity-awesome-skills

Azure Monitor Ingestion SDK for Java. Send custom logs to Azure Monitor via Data Collection Rules (DCR) and Data Collection Endpoints (DCE).

Cloud IntegrationClaude

azure-eventgrid-java

31392
from sickn33/antigravity-awesome-skills

Build event-driven applications with Azure Event Grid SDK for Java. Use when publishing events, implementing pub/sub patterns, or integrating with Azure services via events.

Cloud IntegrationClaudeChatGPTGemini

azure-data-tables-java

31392
from sickn33/antigravity-awesome-skills

Build table storage applications using the Azure Tables SDK for Java. Works with both Azure Table Storage and Cosmos DB Table API.

Data ManagementClaude

azure-compute-batch-java

31392
from sickn33/antigravity-awesome-skills

Azure Batch SDK for Java. Run large-scale parallel and HPC batch jobs with pools, jobs, tasks, and compute nodes.

Cloud ComputeClaude