用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/G1Joshi/Agent-Skills --skill java命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
基于 SOC 职业分类
| name | java |
| description | Java OOP with Spring ecosystem, Maven/Gradle, streams, and JVM optimization. Use for .java files. |
Modern Java development with Java 17+ features, streams, and enterprise patterns.
.java files// 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");
}
}
// 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();
}
}
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); }
}
// 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<User> user = Optional.ofNullable(findUser(id));
String name = user
.map(User::name)
.orElse("Unknown");
user.ifPresentOrElse(
u -> process(u),
() -> handleMissing()
);
Do:
var for local variables with obvious typesDon't:
Optional.get() without checkingException (be specific)| 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 |