Real prompts you can paste into Claude Code / Codex / OpenCode / ZCode once the skill is installed. Each shows what the agent does with the skill loaded.
The skill triggers automatically from the description keywords — you don't
need to mention "Java" explicitly or name any file.
English | 中文
You type:
帮我写一个 OrderService,要保存订单、调用支付,订单金额不能超过库存上限
What happens:
- Skill triggers on "Service" + "保存订单" (Chinese for "save order").
- Agent reads
spring-boot/sb-dependency-injection.md→ writes it with constructor injection +@RequiredArgsConstructor(not field@Autowired). - Agent reads
spring-boot/sb-mybatis-plus.md→ extendsServiceImpl, uses@Transactional(rollbackFor = Exception.class)on the write method. - Agent reads
spring-boot/sb-config-profiles.md→ pulls the max-amount limit from@ConfigurationProperties, not a hardcoded magic number.
Result you get (excerpt):
@Service
@RequiredArgsConstructor
@Slf4j
public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order>
implements OrderService {
private final OrderProperties props; // typed config, not @Value
private final PaymentClient paymentClient;
@Override
@Transactional(rollbackFor = Exception.class)
public Order placeOrder(OrderRequest request) {
if (request.amount().compareTo(props.maxAmount()) > 0) {
throw new OrderAmountExceededException(props.maxAmount());
}
Order order = buildOrder(request);
save(order); // ServiceImpl#save, same tx
paymentClient.charge(request); // same tx, rolls back together
return order;
}
}Without the skill, the model might write @Autowired field injection, a raw
@Value for the limit, and forget @Transactional. The skill steers it to the
project's conventions.
You type:
Review this method for thread safety:
private Map<Long, Order> cache = new HashMap<>(); public Order get(Long id) { return cache.computeIfAbsent(id, this::load); }
What happens:
- Skill triggers on "thread safety".
- Agent reads
code-review/cr-concurrency.md→ recognizes the shared mutableHashMapacross threads. - Agent reads
code-review/cr-anti-patterns.md→ flags the non-finalfield.
Result you get:
⚠ Race condition —
HashMapunder concurrentcomputeIfAbsentcan lose updates or infinite-loop on resize. Two callers hittingget()simultaneously will corrupt the map.Fix: use a thread-safe map and make the field final:
private final Map<Long, Order> cache = new ConcurrentHashMap<>();Or, if you need bounded eviction, use
Caffeine:private final Cache<Long, Order> cache = Caffeine.newBuilder() .maximumSize(10_000) .build();
The skill turns a vague "review this" into a structured checklist pass
(cr-concurrency.md has an explicit checklist).
You type:
用 Testcontainers 配 MySQL,测我的 OrderMapper
What happens:
- Skill triggers on "Testcontainers" + "Mapper".
- Agent reads
testing/test-testcontainers.md→ uses@ServiceConnection(Spring Boot 3.1+) instead of the old verbose@DynamicPropertySource. - Agent reads
testing/test-layering.md→ keeps it as an integration test, not a unit test (Mapper tests need a real DB).
Result you get:
@SpringBootTest
@Testcontainers
class OrderMapperTest {
@Container
@ServiceConnection // auto-wires url/user/pass
static MySQLContainer<?> mysql = new MySQLContainer<>("mysql:8")
.withReuse(true); // fast re-runs
@Autowired OrderMapper orderMapper;
@Test
void insertsAndSelects() {
Order o = new Order();
o.setUserId("u1");
o.setStatus("CREATED");
orderMapper.insert(o);
Order found = orderMapper.selectById(o.getId());
assertThat(found.getUserId()).isEqualTo("u1");
}
}Without the skill, the model often reaches for H2 (which hides MySQL-specific
SQL bugs) or the verbose @DynamicPropertySource boilerplate.
You type:
线上 OOM 了,怎么排查?服务跑了几小时就挂
What happens:
- Skill triggers on "OOM" + "线上" (production).
- Agent reads
jvm/jvm-oom-analysis.md→ walks the diagnostic flow.
Result you get:
First, capture a heap dump automatically on the next crash if you haven't:
-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/log/app/oom-%p.hprofThen classify by the OOM message — the fix differs per type:
Message Cause Java heap spaceHeap leak or too-large working set MetaspaceClass-loader leak Direct buffer memoryNIO ByteBuffer.allocateDirectnot releasedOpen the
.hprofin Eclipse MAT and look at the Dominator Tree (sort by Retained Heap). The top retainer is the leak source. Right-click → Path to GC Roots to find what's holding it.Common leaks to check: static cache without eviction,
ThreadLocalwithoutremove(), listeners never deregistered, huge result sets loaded in memory.See
jvm/jvm-oom-analysis.mdfor the full step-by-step.
The skill gives a structured playbook instead of generic advice.
The skill auto-loads on any of these (from the SKILL.md description):
- Spring Boot:
@RestController,@Service,@Repository,@Configuration,@SpringBootApplication,@TableName,@TableId,LambdaQueryWrapper - Testing:
JUnit 5,Mockito,AssertJ,Testcontainers,@SpringBootTest,@WebMvcTest,@DataJpaTest - Code review:
concurrency,thread safety,NPE,Optional,equals/hashCode,Stream - JVM:
GC tuning,OOM,thread dump,deadlock,high CPU,heap dump - General:
Java,JVM,MyBatis-Plus,JPA,Maven,pom.xml,@Autowired,Lombok,jakarta.*,javax.*
If a prompt doesn't trigger and you want to force-load it, use your tool's
skill-invocation command (e.g. /skill java-development <prompt> in ZCode).