routers

Java 编码指南

@user_a36dc51e/java-coding-guide-pro

By user_a36dc51e

About this Skill

Java 编码规范与避坑助手。在编写、修改、重构或审查任何 Java / Spring Boot 代码时使用本技能—— 无论用户是否提到编码规范或具体工具库(Java coding / code review / refactoring / best practices / code quality)。 覆盖:判空与字符串、集合与 Stream、日期时间、文件 IO / HTTP 调用 / JSON 序列化、 线程池与并发、Bean 拷贝、加密哈希、异常处理与日志、金额与浮点精确运算、 静默失效排查(注解自调用 / 包装类型比较 / 不可变集合)、 分层职责与代码组织(封装 / 复用 / 常量与配置归属 / 资源托管)、 现代 Java 语法(JDK 8~25,按特性最低版本门控)。 次级触发信号——代码中出现:SimpleDateFormat、Executors.newFixedThreadPool / newCachedThreadPool / newSingleThreadExecutor、new Thread(...)、 new BigDecimal(0.1) 小数构造、BeanUtils.copyProperties、BeanUtil.copyProperties、BeanUtil.toBean、BeanUtil.beanToMap、catch (Throwable) / catch (InterruptedException) 空块、MessageDigest(手写 MD5/SHA)、 log.error("x=" + x) 日志拼接、Optional.get()、subList(...)、 finally 块内 return / throw、Math.random()、new Random()、 @Transactional / @Async / @Cacheable 自调用或打在 private 方法上、@Autowired 字段注入、 @Value 注 static 字段、包装类型(Integer/Long)== 比较、List.of/Map.of 结果被 add、 并发 Map 先查后写、Lombok @Data 打在实体上、getXxx() 直接返回内部集合、 业务类内堆 static final 常量 / 硬编码 URL 与超时; 用户任务词出现:生成订单号 / 流水号 / 唯一 ID、生成验证码 / token / 盐、 密码加密 / 哈希存储、金额 / 价格计算、线程池 / 异步任务、日期格式化 / 时区、 分层 / 职责划分、常量放哪 / 配置外置、代码结构组织 / 复用抽取。 跟随项目既有技术栈(Spring / Hutool / commons-lang3 等),不强加任何库。 不适用:业务架构设计(微服务拆分 / 领域建模)、框架选型、DDL、纯算法、前端代码。

代码生成代码审查

Skill files and instructions

Read SKILL.md and the other instructions or configuration files published with this Skill.

Loading file list

Details

Category
Development
Source
Community
Version
3.8.0
Updated
Sep 23, 2026
View original listing
Drag to dock at either edge, or use arrow keys to move. Press Enter to open support.