skills/coding/coding-java/SKILL.md
Java 21+: records, sealed classes, pattern matching, virtual threads Loom, Spring Boot 3, Maven/Gradle
npx skillsauth add alphaonedev/openclaw-graph coding-javaInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill enables the AI to assist with Java 21+ development, focusing on modern features like records, sealed classes, pattern matching, and virtual threads from Project Loom, plus Spring Boot 3 applications using Maven or Gradle for building and dependency management.
Use this skill for projects requiring Java 21+ syntax, such as implementing sealed classes for restricted inheritance, pattern matching in switch statements, or scalable applications with virtual threads. Apply it in backend development with Spring Boot 3, or when managing builds with Maven/Gradle for enterprise-grade Java apps.
record Point(int x, int y) {}.sealed interface Shape permits Circle, Square {}.switch (obj) { case String s -> process(s); default -> handleDefault(); }.Thread.startVirtualThread(() -> task()); in Java 21+.@SpringBootApplication and use embedded Tomcat.mvn spring-boot:run or Gradle with gradle bootRun for project compilation.To accomplish tasks, structure code or commands precisely. For example, to create a Java record for a data model:
public record User(String name, int age) {}.User user = new User("Alice", 30); System.out.println(user);.Another example: Set up a Spring Boot 3 app with virtual threads.
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency>.@RestController public class MyController { @GetMapping("/") public String home() { Thread.startVirtualThread(() -> logMessage()); return "Hello"; } }.mvn spring-boot:run --define spring.threads.virtual.enabled=true.Use these exact commands for building and running projects:
mvn clean install -DskipTests to compile; mvn spring-boot:run to start app.gradle build --no-daemon for compilation; gradle bootRun --args='--server.port=8080' for running.ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor(); executor.submit(() -> { /* task code */ });.http://localhost:8080/api/data after defining @GetMapping("/api/data") public ResponseEntity<?> getData() { return ResponseEntity.ok(data); }.server.port=8080; or YAML: server: port: 8080.Integrate by setting environment variables for secure keys, e.g., export $SPRING_API_KEY for external services in Spring Boot. For IDEs, add plugins like Spring Tools Suite and configure build tools: In VS Code, use extensions for Maven/Gradle. To link with databases, add dependencies in build.gradle: implementation 'org.springframework.boot:spring-boot-starter-data-jpa', then configure datasource in application.yml: spring.datasource.url=jdbc:mysql://localhost/dbname. Ensure Java 21+ is set via SDK manager.
Handle errors prescriptively: For build failures, check logs for "Compilation error" and fix syntax, e.g., if sealed class is misused, ensure all permitted subclasses are defined. For virtual threads, catch InterruptedException with try { Thread.startVirtualThread(() -> { throw new RuntimeException(); }); } catch (Exception e) { log.error(e.getMessage()); }. In Spring Boot, use @ExceptionHandler for API errors: @ControllerAdvice public class GlobalExceptionHandler { @ExceptionHandler(Exception.class) public ResponseEntity<?> handleError(Exception e) { return ResponseEntity.status(500).body("Error: " + e.getMessage()); } }. For Maven/Gradle, use --debug flag to diagnose, e.g., mvn clean install --debug.
tools
Root web development: project structure, tooling selection, deployment decisions
development
WebAssembly: Rust/Go/C to WASM, wasm-bindgen, Emscripten, WASM Component Model
development
Vue 3: Composition API script setup, Pinia, Vue Router 4, SFCs, Vite, Nuxt 3
tools
Tailwind CSS 4: utility classes, config, JIT, arbitrary values, darkMode, plugins, shadcn/ui