java
Use when the user asks about modern Java (21 and 25 LTS), records, sealed classes, pattern matching, virtual threads, streams, Optional, Maven, Gradle, JUnit…
от j4flmao★ 47 звёзд на GitHub
Установить java в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Java
Purpose
Guide for Java build tools (Maven/Gradle), module system, modern language features (records, sealed classes, pattern matching), streams, concurrency, testing, and production deployment.
Agent Protocol
Trigger
Keywords: java build, maven, gradle, java module, record, stream, optional, completablefuture, junit, spring boot, jakarta.
Input Context
- Build tool (Maven, Gradle)
- Java version
- Framework (Spring Boot, Quarkus, Micronaut, Jakarta EE)
- Deployment target
Output Artifact
Code, build-file changes, or JVM flags. No file unless requested.
Response Format
Java: {release} Build: {maven|gradle}
Change: {what and why}
Code: {snippet}
Verify: {mvn verify | ./gradlew check}
Decision Trees
Build Tool Selection
Team preference?
├── Declarative, XML, convention → Maven (stable, predictable, standard)
│ ├── pom.xml, lifecycle phases (compile, test, package)
│ └── Best for: large orgs, strict conventions, established projects
├── Flexible, programmable, fast → Gradle (Kotlin DSL, incremental builds)
│ ├── build.gradle.kts, task-based, build cache
│ └── Best for: Android, multi-module, custom build logic
└── Modern, fast, no-nonsense → Maven + mvnd (Maven Daemon, parallel builds)
Framework Selection
What kind of application?
├── Full-stack web app → Spring Boot (most mature, vast ecosystem, auto-config)
├── Cloud-native / low-resource → Quarkus (GraalVM native, fast startup)
├── Microservices / reactive → Micronaut (compile-time DI, AOT)
├── REST API / lightweight → JAX-RS (Jakarta REST) + Helidon / Dropwizard
└── Batch processing → Spring Batch / Apache Beam
Module Strategy
Project size?
├── Small (<10k LOC) → Single module, package-based organization
├── Medium (10-100k LOC) → Multi-module with clear boundaries (api, core, infra)
├── Large (>100k LOC) → Java Platform Module System (JPMS) with module-info.java
└── Library → Single module, minimize exports, use JPMS for strong encapsulation
Build & Dependency Management
Maven pom.xml
<project>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.3.0</version>
</parent>
<properties>
<java.version>21</java.version>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
</project>
Gradle build.gradle.kts
plugins {
java
id("org.springframework.boot") version "3.3.0"
id("io.spring.dependency-management") version "1.1.5"
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
dependencies {
implementation("org.springframework.boot:spring-boot-starter-web")
testImplementation("org.springframework.boot:spring-boot-starter-test")
compileOnly("org.projectlombok:lombok")
annotationProcessor("org.projectlombok:lombok")
}
Version Catalog (Gradle)
# gradle/libs.versions.toml
[versions]
spring-boot = "3.3.0"
testcontainers = "1.19.0"
[libraries]
spring-boot-starter = { module = "org.springframework.boot:spring-boot-starter-web", version.ref = "spring-boot" }
testcontainers = { module = "org.testcontainers:testcontainers", version.ref = "testcontainers" }
Language-Specific Patterns
Records (Java 16+)
// Immutable data carrier — replaces Lombok @Data, manual POJOs
public record Order(Long id, String customer, BigDecimal total, OrderStatus status) {
// Compact constructor for validation
public Order {
if (total.compareTo(BigDecimal.ZERO) < 0) {
throw new IllegalArgumentException("total must be positive");
}
if (status == null) status = OrderStatus.PENDING;
}
// Static factory
public static Order create(String customer, BigDecimal total) {
return new Order(null, customer, total, OrderStatus.PENDING);
}
}
Sealed Classes (Java 17+)
// Exhaustive hierarchy — compiler knows all subtypes
public sealed interface Payment
permits CreditCard, PayPal, CryptoPayment {}
public record CreditCard(String lastFour, String expiry) implements Payment {}
public record PayPal(String email) implements Payment {}
public record CryptoPayment(String walletAddress, String currency) implements Payment {}
// Switch with pattern matching (Java 21+)
public String processPayment(Payment payment) {
return switch (payment) {
case CreditCard c -> "Processing card ending in " + c.lastFour();
case PayPal p -> "Redirecting to PayPal for " + p.email();
case CryptoPayment cp -> "Verifying " + cp.currency() + " transfer";
};
}
Streams & Optional
//
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- references/design-patterns-generics.md
- references/generics-reified-workarounds.md
- references/generics-type-erasure.md
- references/generics-wildcards-pecs.md
- references/java-advanced.md
- references/java-fundamentals.md
- references/java-testing.md
- references/records-sealed-classes.md
- references/streams-optional.md
FAQ
Что делает скилл java?
Use when the user asks about modern Java (21 and 25 LTS), records, sealed classes, pattern matching, virtual threads, streams, Optional, Maven, Gradle, JUnit 5 or JVM tuning. Produces idiomatic Java, builds and JVM settings. Not for Spring Boot architecture (use spring-boot-architecture) or Kotlin (use lang-kotlin).
Как установить скилл java?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл java запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…