rrezartprebreza/spring-boot-skills / skills/spring-boot-4/layered-architecture
layered-architecture
VerifiedUse when generating or modifying any Spring Boot class — controllers, services, repositories, DTOs, mappers, or configuration. Enforces strict layer separation and prevents business logic from leaking across boundaries.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 6.7 KB |
| agents/openai.yaml | config | 205 B |
| examples/bad-service.java | other | 1.5 KB |
| examples/good-service.java | other | 1.2 KB |
| templates/CreateOrderRequest.java | other | 881 B |
| templates/OrderMapper.java | other | 1.0 KB |
| templates/OrderResponse.java | other | 911 B |
examples/good-service.java
View on GitHub// GOOD — proper layer separation, constructor injection, @Transactional on service
@Service
@RequiredArgsConstructor
@Transactional(readOnly = true)
public class OrderService {
private final OrderRepository orderRepository;
private final InventoryService inventoryService;
public OrderResponse findById(UUID id) {
Order order = orderRepository.findById(id)
.orElseThrow(() -> new OrderNotFoundException(id));
return OrderResponse.from(order);
}
public Page<OrderResponse> findAll(Pageable pageable) {
return orderRepository.findAll(pageable).map(OrderResponse::from);
}
@Transactional
public Order createOrder(CreateOrderRequest request) {
inventoryService.reserve(request.items());
Order order = Order.create(request.customerEmail());
request.items().forEach(item ->
order.addItem(item.productId(), item.quantity()));
return orderRepository.save(order);
}
@Transactional
public void cancel(UUID id) {
Order order = orderRepository.findById(id)
.orElseThrow(() -> new OrderNotFoundException(id));
order.cancel();
inventoryService.release(order.getItems());
}
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |