Java Coding Standards
Spring Boot服务的Java编码标准:命名、不可变性、Optional用法、流、异常、泛型和项目布局。
Install
/plugin marketplace add xu-xiang/everything-claude-code-zhThe repo is a Claude Code plugin marketplace. Run /plugin afterwards to pick the plugin that includes this skill.
npx skills add xu-xiang/everything-claude-code-zh --skill java-coding-standardsgit clone --depth 1 https://github.com/xu-xiang/everything-claude-code-zh.git /tmp/everything-claude-code-zh
mkdir -p ~/.claude/skills
cp -r /tmp/everything-claude-code-zh/docs/zh-CN/skills/java-coding-standards ~/.claude/skills/java-coding-standardsPersonal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.
From the SKILL.md
# Java 编码规范
适用于 Spring Boot 服务中可读、可维护的 Java (17+) 代码的规范。
## 何时激活
* 在 Spring Boot 项目中编写或审查 Java 代码时
* 强制执行命名、不可变性或异常处理约定时
* 使用记录类、密封类或模式匹配(Java 17+)时
* 审查 Optional、流或泛型的使用时
* 构建包和项目布局时
## 核心原则
* 清晰优于巧妙
* 默认不可变;最小化共享可变状态
* 快速失败并提供有意义的异常
* 一致的命名和包结构
## 命名
```java
// ✅ Classes/Records: PascalCase
public class MarketService {}
public record Money(BigDecimal amount, Currency currency) {}
// ✅ Methods/fields: camelCase
private final MarketRepository marketRepository;
public Market findBySlug(String slug) {}
// ✅ Constants: UPPER_SNAKE_CASE
private static final int MAX_PAGE_SIZE = 100;
```
## 不可变性
```java
// ✅ Favor records and final fields
public record MarketDto(Long id, String name, MarketStatus status) {}
public class Market {
private final Long id;
private final String name;
// getters only, no setters
}
```
## Optional 使用
```java
// ✅ Return Optional from find* methods
Optional<Market> market = marketRepository.findBySlug(slug);
// ✅ Map/flatMap instead of get()
return market
.map(MarketResponse::from)
.orElseThrow(() -> new EntityNotFoundException("Market not found"));
```
## Streams 最佳实践
```java
// ✅ Use streams for transformations, keep pipelines short
List<String> names = markets.stream()
.map(Market::name)
.filter(Objects::nonNull)
.toList();
// ❌ Avoid complex nested streams; prefer loops for clarity
```
## 异常
* 领域错误使用非受检异常;包装技术异常时提供上下文
* 创建特定领域的异常(例如,`MarketNotFoundException`)
* 避免宽泛的 `catch (Exception ex)`,除非在中心位置重新抛出/记录Details
- Skill name
java-coding-standards- Repository
- xu-xiang/everything-claude-code-zh
- Path
docs/zh-CN/skills/java-coding-standards/SKILL.md- License
- MIT
- Repo updated
- 5 March 2026
FAQ
What does the Java Coding Standards skill do?
Spring Boot服务的Java编码标准:命名、不可变性、Optional用法、流、异常、泛型和项目布局。
How do I install the Java Coding Standards skill?
Claude Code plugin: /plugin marketplace add xu-xiang/everything-claude-code-zh. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.
Is Java Coding Standards popular?
It lives in xu-xiang/everything-claude-code-zh, which has 2,037 GitHub stars and 332 forks.
Related skills
Backend Patterns
2kxu-xiang/everything-claude-code-zh
Backend architecture patterns, API design, database optimization, and server-side best practices for Node.js, Express, and Next.js API routes.
Coding Standards
2kxu-xiang/everything-claude-code-zh
Universal coding standards, best practices, and patterns for TypeScript, JavaScript, React, and Node.js development.
Frontend Patterns
2kxu-xiang/everything-claude-code-zh
Frontend development patterns for React, Next.js, state management, performance optimization, and UI best practices.
Java Coding Standards
2kxu-xiang/everything-claude-code-zh
Spring Boot 服务的 Java 编码规范:命名、不可变性、Optional 使用、流(streams)、异常、泛型以及项目布局。
Java Coding Standards
2kxu-xiang/everything-claude-code-zh
适用于 Spring Boot 服务的 Java 编码规范:命名、不可变性、Optional 使用、流(Stream)、异常、泛型及项目布局。
Plankton Code Quality
2kxu-xiang/everything-claude-code-zh
使用 Plankton 实现编写时代码质量强制执行 —— 通过钩子在每次文件编辑时进行自动格式化、代码检查,并由 Claude 驱动自动修复。
Browse the most popular Claude skills, all software development skills, or write your own with the skills generator.