jpskill.com
🛠️ 開発・MCP コミュニティ

coding-java

Java 21+: records, sealed classes, pattern matching, virtual threads Loom, Spring Boot 3, Maven/Gradle

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o coding-java.zip https://jpskill.com/download/22082.zip && unzip -o coding-java.zip && rm coding-java.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/22082.zip -OutFile "$d\coding-java.zip"; Expand-Archive "$d\coding-java.zip" -DestinationPath $d -Force; ri "$d\coding-java.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して coding-java.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → coding-java フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1
📖 Claude が読む原文 SKILL.md(中身を展開)

この本文は AI(Claude)が読むための原文(英語または中国語)です。日本語訳は順次追加中。

coding-java

Purpose

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.

When to Use

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.

Key Capabilities

  • Handle Java records for immutable data classes: Define with record Point(int x, int y) {}.
  • Implement sealed classes to limit subclasses: Use sealed interface Shape permits Circle, Square {}.
  • Utilize pattern matching in switch: Example: switch (obj) { case String s -> process(s); default -> handleDefault(); }.
  • Manage virtual threads for concurrency: Launch with Thread.startVirtualThread(() -> task()); in Java 21+.
  • Build Spring Boot 3 apps: Configure with @SpringBootApplication and use embedded Tomcat.
  • Automate builds: Run Maven with mvn spring-boot:run or Gradle with gradle bootRun for project compilation.

Usage Patterns

To accomplish tasks, structure code or commands precisely. For example, to create a Java record for a data model:

  1. Write: public record User(String name, int age) {}.
  2. Use in main method: User user = new User("Alice", 30); System.out.println(user);.

Another example: Set up a Spring Boot 3 app with virtual threads.

  1. Add dependency in pom.xml: <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency>.
  2. In controller: @RestController public class MyController { @GetMapping("/") public String home() { Thread.startVirtualThread(() -> logMessage()); return "Hello"; } }.
  3. Run with Maven: mvn spring-boot:run --define spring.threads.virtual.enabled=true.

Common Commands/API

Use these exact commands for building and running projects:

  • Maven: mvn clean install -DskipTests to compile; mvn spring-boot:run to start app.
  • Gradle: gradle build --no-daemon for compilation; gradle bootRun --args='--server.port=8080' for running.
  • Java API for virtual threads: ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor(); executor.submit(() -> { /* task code */ });.
  • Spring Boot API: Access endpoints like http://localhost:8080/api/data after defining @GetMapping("/api/data") public ResponseEntity<?> getData() { return ResponseEntity.ok(data); }.
  • Config formats: Use application.properties for settings, e.g., server.port=8080; or YAML: server: port: 8080.

Integration Notes

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.

Error Handling

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.

Graph Relationships

  • Related to: coding-general (via cluster 'coding' for shared coding tools).
  • Connected to: coding-python (for cross-language development patterns).
  • Links with: devops-deployment (for integrating Java builds with CI/CD pipelines).