用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/xu-xiang/everything-claude-code-zh --skill java-coding-standards命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | java-coding-standards |
| description | 适用于 Spring Boot 服务的 Java 编码规范:命名、不可变性、Optional 使用、流(Stream)、异常、泛型及项目布局。 |
适用于 Spring Boot 服务中易读且可维护的 Java (17+) 代码标准。
// ✅ 类/记录(Record): PascalCase
public class MarketService {}
public record Money(BigDecimal amount, Currency currency) {}
// ✅ 方法/字段: camelCase
private final MarketRepository marketRepository;
public Market findBySlug(String slug) {}
// ✅ 常量: UPPER_SNAKE_CASE
private static final int MAX_PAGE_SIZE = 100;
// ✅ 优先使用 record 和 final 字段
public record MarketDto(Long id, String name, MarketStatus status) {}
public class Market {
private final Long id;
private final String name;
// 仅有 getter,没有 setter
}
// ✅ find* 方法返回 Optional
Optional<Market> market = marketRepository.findBySlug(slug);
// ✅ 使用 map/flatMap 代替 get()
return market
.map(MarketResponse::from)
.orElseThrow(() -> new EntityNotFoundException("Market not found"));
// ✅ 使用流进行转换,保持流水线(Pipeline)简洁
List<String> names = markets.stream()
.map(Market::name)
.filter(Objects::nonNull)
.toList();
// ❌ 避免复杂的嵌套流;为了清晰起见,优先使用循环
MarketNotFoundException)catch (Exception ex)(除非在中心位置重新抛出或记录日志)throw new MarketNotFoundException(slug);
public <T extends Identifiable> Map<Long, T> indexById(Collection<T> items) { ... }
src/main/java/com/example/app/
config/
controller/
service/
repository/
domain/
dto/
util/
src/main/resources/
application.yml
src/test/java/... (镜像 main 目录)
private static final Logger log = LoggerFactory.getLogger(MarketService.class);
log.info("fetch_market slug={}", slug);
log.error("failed_fetch_market slug={}", slug, ex);
@Nullable;否则使用 @NonNull@NotNull、@NotBlank)sleep记住:保持代码的意图清晰、类型安全且可观测。除非证明确有必要,否则应优先优化可维护性而非微小的性能优化。