SOC 직업 분류 기준
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/diegosouzapw/awesome-omni-skill --skill java-dev명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SKILL.md 표시 중
Token-efficient tracking for AI orchestration. CLI-first for status updates (~50 tokens), agent fallback for complex ops (~1KB). Use when: updating task status, querying blockers, creating progress files, validating phases.
AshAi extension guidelines for integrating AI capabilities with Ash Framework. Use when implementing vectorization/embeddings, exposing Ash actions as LLM tools, creating prompt-backed actions, or setting up MCP servers. Covers semantic search, LangChain integration, and structured outputs.
This skill should be used when solving hard questions, complex architectural problems, or debugging issues that benefit from GPT-5 Pro or GPT-5.1 thinking models with large file context. Use when standard Claude analysis needs deeper reasoning or extended context windows.
| name | java-dev |
| description | Java 开发规范,包含命名约定、异常处理、Spring Boot 最佳实践等 |
| version | v3.0 |
| paths | ["**/*.java","**/pom.xml","**/build.gradle","**/build.gradle.kts"] |
参考来源: Google Java Style Guide、阿里巴巴 Java 开发手册
# Maven
mvn clean compile # 编译
mvn test # 运行测试
mvn verify # 运行所有检查
# Gradle
./gradlew build # 构建
./gradlew test # 运行测试
| 类型 | 规则 | 示例 |
|---|---|---|
| 包名 | 全小写,域名反转 | com.example.project |
| 类名 | 大驼峰,名词/名词短语 | UserService, HttpClient |
| 方法名 | 小驼峰,动词开头 | findById, isValid |
| 常量 | 全大写下划线分隔 | MAX_RETRY_COUNT |
| 布尔返回值 | is/has/can 前缀 | isActive(), hasPermission() |
public class Example {
// 1. 静态常量
public static final String CONSTANT = "value";
// 2. 静态变量
private static Logger logger = LoggerFactory.getLogger(Example.class);
// 3. 实例变量
private Long id;
// 4. 构造函数
public Example() { }
// 5. 静态方法
public static Example create() { return new Example(); }
// 6. 实例方法(公共 → 私有)
public void doSomething() { }
private void helperMethod() { }
// 7. getter/setter(或使用 Lombok)
}
// ✅ 好:捕获具体异常,添加上下文
try {
user = userRepository.findById(id);
} catch (DataAccessException e) {
throw new ServiceException("Failed to find user: " + id, e);
}
// ✅ 好:资源自动关闭
try (InputStream is = new FileInputStream(file)) {
// 使用资源
}
// ❌ 差:捕获过宽
catch (Exception e) { e.printStackTrace(); }
// ✅ 使用 Optional
public Optional<User> findById(Long id) {
return userRepository.findById(id);
}
// ✅ 参数校验
public void updateUser(User user) {
Objects.requireNonNull(user, "user must not be null");
}
// ✅ 安全的空值处理
String name = Optional.ofNullable(user)
.map(User::getName)
.orElse("Unknown");
// ✅ 使用 ExecutorService
ExecutorService executor = Executors.newFixedThreadPool(10);
Future<Result> future = executor.submit(() -> doWork());
// ✅ 使用 CompletableFuture
CompletableFuture<User> future = CompletableFuture
.supplyAsync(() -> findUser(id))
.thenApply(user -> enrichUser(user));
// ❌ 差:直接创建线程
new Thread(() -> doWork()).start();
class UserServiceTest {
@Test
@DisplayName("根据 ID 查找用户 - 用户存在时返回用户")
void findById_whenUserExists_returnsUser() {
// given
when(userRepository.findById(1L)).thenReturn(Optional.of(expected));
// when
Optional<User> result = userService.findById(1L);
// then
assertThat(result).isPresent();
assertThat(result.get().getName()).isEqualTo("test");
}
}
// ✅ 构造函数注入
@Service
@RequiredArgsConstructor
public class UserService {
private final UserRepository userRepository;
private final EmailService emailService;
}
// ✅ REST Controller
@RestController
@RequestMapping("/api/users")
public class UserController {
@GetMapping("/{id}")
public ResponseEntity<UserDto> findById(@PathVariable Long id) {
return userService.findById(id)
.map(ResponseEntity::ok)
.orElse(ResponseEntity.notFound().build());
}
}
| 陷阱 | 解决方案 |
|---|---|
| N+1 查询 | 使用 JOIN FETCH 或批量查询 |
| 循环拼接字符串 | 使用 StringBuilder |
| 频繁装箱拆箱 | 使用原始类型流 |
| 未指定集合初始容量 | new ArrayList<>(size) |
// ✅ 参数化日志
log.debug("Finding user by id: {}", userId);
log.info("User {} logged in successfully", username);
log.error("Failed to process order {}", orderId, exception);
// ❌ 差:字符串拼接
log.debug("Finding user by id: " + userId);
| 文件 | 内容 |
|---|---|
references/java-style.md | 命名约定、异常处理、Spring Boot、测试规范 |
references/collections.md | 不可变集合(Guava)、字符串分割 |
references/concurrency.md | 线程池配置、CompletableFuture 超时 |
references/code-patterns.md | 卫语句、枚举优化、策略工厂模式 |
📋 本回复遵循:
java-dev- [具体章节]