AI & Agents
Skill
/java-best-practices
Java 编码最佳实践与设计模式
Install
$ npx -y skills add leavesfly/jimi --skill java-best-practices --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/java-best-practices
Context preview
The summary Claude sees to decide when to auto-load this skill.
Java 编码最佳实践与设计模式
SKILL.md
java-best-practices.SKILL.mdname: java-best-practices
description: Java 编码最佳实践与设计模式
version: 1.0.0
category: development
triggers:
- java best practice
- Java 最佳实践
- 设计模式
- Java 编码规范
scriptPath: check-java-env.sh
scriptType: bash
autoExecute: true
scriptTimeout: 5
Java 最佳实践技能包
编码规范
命名规范
- **类名**:PascalCase(UserService)
- **方法/变量**:camelCase(getUserById)
- **常量**:UPPER_SNAKE_CASE(MAX_SIZE)
- **包名**:小写(com.example.service)
常用设计模式
**单例模式(枚举实现)**:
public enum Singleton {
INSTANCE;
public void doSomething() {}
}**工厂模式**:
public class UserFactory {
public static User createUser(String type) {
return switch (type) {
case "admin" -> new AdminUser();
case "guest" -> new GuestUser();
default -> new RegularUser();
};
}
}**Builder 模式**:
User user = User.builder()
.name("张三")
.age(25)
.build();Stream API
List<String> names = users.stream()
.filter(u -> u.getAge() > 18)
.map(User::getName)
.collect(Collectors.toList());异常处理
try {
// 业务逻辑
} catch (SpecificException e) {
log.error("Error: {}", e.getMessage(), e);
throw new BusinessException("操作失败");
} finally {
// 清理资源
}并发编程
ExecutorService executor = Executors.newFixedThreadPool(10);
executor.submit(() -> {
// 异步任务
});Optional 使用
Optional<User> user = userRepository.findById(id);
return user.orElseThrow(() -> new NotFoundException());
Read more
name: java-best-practices description: Java 编码最佳实践与设计模式 version: 1.0.0 category: development triggers: - java best practice - Java 最佳实践 - 设计模式 - Java 编码规范 scriptPath: check-java-env.sh scriptType: bash autoExecute: true scriptTimeout: 5
Java 最佳实践技能包
编码规范
命名规范
- **类名**:PascalCase(UserService)
- **方法/变量**:camelCase(getUserById)
- **常量**:UPPER_SNAKE_CASE(MAX_SIZE)
- **包名**:小写(com.example.service)
常用设计模式
**单例模式(枚举实现)**:
public enum Singleton {
INSTANCE;
public void doSomething() {}
}**工厂模式**:
public class UserFactory {
public static User createUser(String type) {
return switch (type) {
case "admin" -> new AdminUser();
case "guest" -> new GuestUser();
default -> new RegularUser();
};
}
}**Builder 模式**:
User user = User.builder()
.name("张三")
.age(25)
.build();Stream API
List<String> names = users.stream()
.filter(u -> u.getAge() > 18)
.map(User::getName)
.collect(Collectors.toList());异常处理
try {
// 业务逻辑
} catch (SpecificException e) {
log.error("Error: {}", e.getMessage(), e);
throw new BusinessException("操作失败");
} finally {
// 清理资源
}并发编程
ExecutorService executor = Executors.newFixedThreadPool(10);
executor.submit(() -> {
// 异步任务
});Optional 使用
Optional<User> user = userRepository.findById(id); return user.orElseThrow(() -> new NotFoundException());
Other skills on jimi.
- /maven-troubleshoot
Maven 构建故障排查专家,擅长解决依赖冲突、编译错误、插件配置问题
Open skill - /api-design
RESTful API design best practices and conventions guide
Open skill - /code-quality-suite
代码质量综合技能包(代码审查 + 单元测试)
Open skill - /code-review
代码审查最佳实践指南
Open skill - /database-design
数据库设计规范与优化指南
Open skill - /git-commit-guide
Git 提交规范(Conventional Commits)
Open skill

