用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/bobmatnyc/claude-mpm --skill toolchains-java-core命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | toolchains-java-core |
| description | Java 21+ core patterns for minimalism, efficiency, code reuse, and performance |
| version | 1.0.0 |
| category | toolchains-java |
| tags | ["java","patterns","performance","minimalism","efficiency","virtual-threads"] |
| effort | medium |
Modern Java development patterns targeting 21+ LTS for minimal, efficient, reusable, and performant code.
New code: Use records for DTOs/value objects, sealed classes + pattern matching for type-safe dispatch, virtual threads for I/O-bound concurrency, SequencedCollection for ordered access.
Performance: Profile first with JFR/async-profiler. Use JMH for benchmarks, Generational ZGC for low-latency, Stream API for declarative data transforms.
record for immutable data carriers — eliminates boilerplate (equals, hashCode, toString, accessors)switch expressions over if-elif chains; leverage pattern matching with instanceof to collapse cast+checksealed classes/interfaces to restrict type hierarchies — compiler verifies exhaustiveness in switchvar for local variables when type is obvious from RHS — improves readability, not a replacement for field types_) for unused bindings in patterns, catch blocks, and lambdas (Java 22+)Optional return types over nullable returns — never use Optional as field or parameter type""") for multi-line strings — SQL, JSON, HTML templateswhen) in switch patterns eliminate nested if-conditions inside casestoList() (Java 16+) over collect(Collectors.toList())SequencedCollection (Java 21) for getFirst()/getLast()/reversed() — replaces index-based access hacksMap.of(), List.of(), Set.of() for immutable collections — avoid Collections.unmodifiableX() wrappersString.formatted() or "".formatted() over String.format() for readabilityArrayList and HashMap when capacity is known — avoids rehashing/reallocationEnumMap/EnumSet for enum-keyed collections — array-backed, faster than HashMapStringBuilder for string concatenation in loops; single expressions use + (JIT optimizes)addBatch()/executeBatch() — never N+1 queriesFunction, Predicate, Supplier functional interfaces for composable behaviorsealed interface Shape permits Circle, Rect — exhaustive pattern matchingwhen), null handlingThread.ofVirtual().start() or Executors.newVirtualThreadPerTaskExecutor() — millions of threadsStructuredTaskScope for grouped subtask lifecycle — fork/join/throwIfFailedSequencedCollection, SequencedSet, SequencedMap with defined encounter order_ for unused variables in patterns, catches, lambdasSoftMaxHeapSize for predictable RSSShenandoahGCHeuristics=adaptive for containerized workloadssynchronized blocks (causes pinning)ReentrantLock instead of synchronized with virtual threads to prevent carrier thread pinning-XX:+TieredCompilation for startup/peak balance; warm up JVM before benchmarkingIntStream, LongStream, mapToInt)@ParameterizedTest with @MethodSource/@CsvSource for data-driven tests; assertAll() for grouped assertions@ExtendWith(MockitoExtension.class) — mock external dependencies only, never the class under testassertThat(result).isNotNull().hasSize(3).contains("expected")postgres:15), proper cleanupshouldReturnUser_whenValidIdIsGiven() — behavior-focused, not method-focused@SpringBootTest + @Testcontainers for full-stack validationCollections.emptyList() returned then modified — use List.of() (truly immutable)List instead of List<String> — loses type safety, produces unchecked warningsOptional for expected absent valuessynchronized with virtual threads — causes carrier thread pinning, use ReentrantLocknull returns from methods — use Optional<T> for values that may be absenttry (var resource = ...) for AutoCloseable resourcesException or Throwable — catch specific exceptions, let unexpected ones propagate