Skip to content
AI & Agents
Skill

/java-best-practices

Java 编码最佳实践与设计模式

From plugin
jimi
2389 skills2 agents

Claude Code

$ npx -y skills add leavesfly/jimi --skill java-best-practices --agent claude-code

SKILL.md

java-best-practices.SKILL.md
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());
Read more
@leavesfly
Ships withjimi

纯 Java 实现的 AI 编程助手,CLI 与 JavaFX Desktop 共用同一入口与运行时

2389 skills2 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
238
Star history of leavesfly/jimi on GitHub, a chart by star-history.com

Other skills on jimi.

More skills from other plugins.

1password

1password

Set up and use 1Password CLI for sign-in, desktop integration, and reading or injecting secrets.

openclaw2w393k
@openclaw@openclawInstall Skill

Questions about java-best-practices.

Which coding agents can use java-best-practices?
java-best-practices installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.