java
Java OOP with Spring ecosystem, Maven/Gradle, streams, and JVM optimization. Use for .java files.
Best use case
java is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Java OOP with Spring ecosystem, Maven/Gradle, streams, and JVM optimization. Use for .java files.
Teams using java should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/java/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How java Compares
| Feature / Agent | java | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Java OOP with Spring ecosystem, Maven/Gradle, streams, and JVM optimization. Use for .java files.
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.
SKILL.md Source
# Java
Modern Java development with Java 17+ features, streams, and enterprise patterns.
## When to Use
- Working with `.java` files
- Building enterprise applications with Spring Boot
- Android development with Kotlin interop
- Microservices architecture
## Quick Start
```java
// Modern record with validation
public record User(String id, String name, String email) {
public User {
Objects.requireNonNull(id, "id must not be null");
Objects.requireNonNull(name, "name must not be null");
}
}
```
## Core Concepts
### Records (Java 17+)
```java
// Immutable data carriers
public record User(String id, String name, String email) {
// Compact constructor for validation
public User {
Objects.requireNonNull(id, "id must not be null");
}
// Additional methods
public String displayName() {
return name.toUpperCase();
}
}
```
### Sealed Classes
```java
public sealed interface Result<T> permits Success, Failure {
T getOrThrow();
}
public record Success<T>(T value) implements Result<T> {
@Override
public T getOrThrow() { return value; }
}
public record Failure<T>(Exception error) implements Result<T> {
@Override
public T getOrThrow() { throw new RuntimeException(error); }
}
```
## Common Patterns
### Streams & Collections
```java
// Immutable collections
var list = List.of("a", "b", "c");
var map = Map.of("key1", "value1", "key2", "value2");
// Stream operations
List<String> names = users.stream()
.filter(User::active)
.map(User::name)
.sorted()
.toList();
// Collectors grouping
Map<String, List<User>> byRole = users.stream()
.collect(Collectors.groupingBy(User::role));
```
### Optional
```java
Optional<User> user = Optional.ofNullable(findUser(id));
String name = user
.map(User::name)
.orElse("Unknown");
user.ifPresentOrElse(
u -> process(u),
() -> handleMissing()
);
```
## Best Practices
**Do**:
- Use `var` for local variables with obvious types
- Prefer records for data transfer objects
- Use Optional instead of null checks
- Use virtual threads for I/O-bound tasks (Java 21+)
**Don't**:
- Use raw types for collections (use generics)
- Use `Optional.get()` without checking
- Catch generic `Exception` (be specific)
- Create mutable DTOs unnecessarily
## Troubleshooting
| Error | Cause | Solution |
| --------------------------------- | -------------------------- | -------------------------------- |
| `NullPointerException` | Null value access | Use Optional or null checks |
| `ClassCastException` | Invalid type cast | Use instanceof pattern matching |
| `ConcurrentModificationException` | Modifying during iteration | Use Iterator.remove() or streams |
## References
- [Java Official Docs](https://docs.oracle.com/en/java/)
- [Baeldung](https://www.baeldung.com/)Related Skills
javascript
JavaScript ES6+ programming including async/await, DOM manipulation, modules, and Node.js. Use for .js files and web development.
template
Expert [skill-name] assistance covering [feature 1], [feature 2], and [feature 3]. Use when [working with X], [debugging Y], or [implementing Z].
zsh
Zsh shell with oh-my-zsh. Use for terminal shell.
zed
Zed high-performance collaborative editor. Use for fast editing.
xcode
Xcode Apple development IDE with simulators. Use for iOS/macOS development.
webstorm
WebStorm JavaScript IDE with debugging. Use for web development.
webpack
Webpack module bundler with loaders and plugins. Use for bundling.
warp
Warp modern terminal with AI. Use for terminal work.
vscode
Visual Studio Code editor with extensions and debugging. Use for code editing.
vite
Vite fast build tool with HMR. Use for modern frontend builds.
visual-studio
Visual Studio IDE for Windows with debugging and profiling. Use for .NET development.
vim
Vim text editor with motions, macros, and plugins. Use for terminal editing.