Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Spring Boot 服务的 Java 编码规范:命名、不可变性、Optional 使用、流(streams)、异常、泛型以及项目布局。
.claude/skills/xu-xiang-java-coding-standards/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 10% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 16% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 11% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 96% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 87% | 0% |
适用于 Spring Boot 服务中可读、可维护的 Java (17+) 代码的规范。
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 }
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"));
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),除非在中心位置重新抛出/记录javathrow new MarketNotFoundException(slug);
javapublic <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/... (mirrors main)javaprivate 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)记住:保持代码意图明确、类型安全且可观察。除非证明有必要,否则优先考虑可维护性而非微优化。
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-11 | pass→pass | 2,964 | 2,426 | -18% | 1 | 1 | 0% | 517 | 1,315 | +154% | 0 | 0 | — |
case-01 | fail→pass | 17,150 | 11,910 | -31% | 1 | 1 | 0% | 3,053 | 3,352 | +10% | 0 | 0 | — |
case-02 | fail→pass | 18,923 | 16,382 | -13% | 1 | 1 | 0% | 3,996 | 4,635 | +16% | 0 | 0 | — |
case-03 | fail→pass | 7,806 | 4,659 | -40% | 1 | 1 | 0% | 1,623 | 1,805 | +11% | 0 | 0 | — |
case-04 | pass→pass | 7,045 | 7,483 | +6% | 1 | 1 | 0% | 1,509 | 2,414 | +60% | 0 | 0 | — |
case-05 | fail→pass | 4,319 | 3,688 | -15% | 1 | 1 | 0% | 854 | 1,674 | +96% | 0 | 0 | — |
case-06 | fail→pass | 4,359 | 3,766 | -14% | 1 | 1 | 0% | 872 | 1,632 | +87% | 0 | 0 | — |
case-07 | fail→pass | 3,467 | 3,574 | +3% | 1 | 1 | 0% | 590 | 1,580 | +168% | 0 | 0 | — |
case-08 | pass→pass | 7,328 | 6,356 | -13% | 1 | 1 | 0% | 1,336 | 2,276 | +70% | 0 | 0 | — |
case-09 | pass→pass | 12,185 | 6,834 | -44% | 1 | 1 | 0% | 2,599 | 2,283 | -12% | 0 | 0 | — |
case-10 | pass→pass | 11,036 | 8,191 | -26% | 1 | 1 | 0% | 2,278 | 2,684 | +18% | 0 | 0 | — |
case-12 | pass→pass | 5,814 | 4,901 | -16% | 1 | 1 | 0% | 1,122 | 1,796 | +60% | 0 | 0 | — |
case-13 | pass→pass | 14,956 | 12,738 | -15% | 1 | 1 | 0% | 3,515 | 3,807 | +8% | 0 | 0 | — |
case-14 | pass→pass | 5,662 | 3,913 | -31% | 1 | 1 | 0% | 1,139 | 1,775 | +56% | 0 | 0 | — |
case-15 | fail→pass | 5,265 | 6,066 | +15% | 1 | 1 | 0% | 989 | 2,062 | +108% | 0 | 0 | — |
case-16 | pass→pass | 3,088 | 2,979 | -4% | 1 | 1 | 0% | 578 | 1,442 | +149% | 0 | 0 | — |
case-17 | pass→pass | 7,666 | 7,107 | -7% | 1 | 1 | 0% | 1,802 | 2,622 | +46% | 0 | 0 | — |
case-18 | pass→pass | 3,574 | 3,290 | -8% | 1 | 1 | 0% | 657 | 1,626 | +147% | 0 | 0 | — |
case-19 | pass→pass | 4,600 | 3,242 | -30% | 1 | 1 | 0% | 1,105 | 1,592 | +44% | 0 | 0 | — |
case-20 | pass→pass | 6,417 | 5,291 | -18% | 1 | 1 | 0% | 1,602 | 2,164 | +35% | 0 | 0 | — |
case-21 | fail→fail | 9,005 | 7,672 | -15% | 1 | 1 | 0% | 1,906 | 2,373 | +25% | 0 | 0 | — |
case-22 | pass→pass | 5,958 | 5,174 | -13% | 1 | 1 | 0% | 1,229 | 2,097 | +71% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +32 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.