- name
SKILL.md
스킬 파일은 게시자의 저장소에 그대로 있습니다.
복사한 명령을 터미널에 붙여넣습니다. 이 SKILL.md가 해당 에이전트에 설치됩니다.
npx skills add rrezartprebreza/spring-boot-skills --skill layered-architecture -a cursor -y복사한 명령을 터미널에 붙여넣습니다. 이 SKILL.md가 해당 에이전트에 설치됩니다.
npx skills add rrezartprebreza/spring-boot-skills --skill layered-architecture -a claude-code -y복사한 명령을 터미널에 붙여넣습니다. 이 SKILL.md가 해당 에이전트에 설치됩니다.
npx skills add rrezartprebreza/spring-boot-skills --skill layered-architecture -a codex -y복사한 명령을 터미널에 붙여넣습니다. 이 SKILL.md가 해당 에이전트에 설치됩니다.
npx skills add rrezartprebreza/spring-boot-skills --skill layered-architecture -a grok -y복사한 메시지를 Grok Bot 채팅에 보냅니다. Bot이 GitHub에서 이 SKILL.md를 가져와 모든 Bot이 공유하는 스킬에 추가합니다.
Install this skill: https://github.com/rrezartprebreza/spring-boot-skills/tree/HEAD/skills/spring-boot-3/layered-architecture게시자 제공
@RestController ← HTTP only. No business logic. No JPA entities in responses.
↓ DTOs
@Service ← All business logic lives here. Orchestrates repositories.
↓ Domain objects / Entities
@Repository ← Data access only. No business logic. Returns entities or projections.
↓ JPA / JDBC
Database
@Valid), returning responses@Entity classes directly — always map to response DTOs@Repository — always goes through a @Service@ControllerAdvice, never try/catch in controllers// GOOD
@PostMapping("/orders")
public ResponseEntity<OrderResponse> createOrder(@Valid @RequestBody CreateOrderRequest request) {
Order order = orderService.createOrder(request);
return ResponseEntity.status(HttpStatus.CREATED).body(OrderResponse.from(order));
}
// BAD — business logic in controller
@PostMapping("/orders")
public ResponseEntity<Order> createOrder(@RequestBody CreateOrderRequest request) {
if (request.getItems().isEmpty()) throw new RuntimeException("No items");
Order order = orderRepository.save(new Order(request)); // direct repo access
return ResponseEntity.ok(order); // returning entity
}
@Transactional lives here, not in controllers or repositories@Autowired field injectionHttpServletRequest / HttpServletResponse// GOOD
@Service
@RequiredArgsConstructor
public class OrderService {
private final OrderRepository orderRepository;
private final InventoryService inventoryService;
@Transactional
public Order createOrder(CreateOrderRequest request) {
inventoryService.reserve(request.items()); // records use accessor names, not getX()
Order order = Order.from(request);
return orderRepository.save(order);
}
}
// BAD — field injection, HTTP concern in service
@Service
public class OrderService {
@Autowired private OrderRepository orderRepository;
public ResponseEntity<Order> createOrder(...) { ... } // HTTP type in service
}
JpaRepository<Entity, ID> or CrudRepository@Query or query derivation — no raw SQL unless unavoidableObject[]@NotNull, @Size, etc.) on Request DTOs onlyResponseDto.from(Entity entity) for mapping// GOOD
public record OrderResponse(UUID id, String status, List<LineItemResponse> items, Instant createdAt) {
public static OrderResponse from(Order order) {
return new OrderResponse(order.getId(), order.getStatus().name(),
order.getItems().stream().map(LineItemResponse::from).toList(),
order.getCreatedAt());
}
}
OrderResponse.from(order))Order.from(request)) or a mapper class.stream().map(OrderResponse::from).toList() — never manual loops// GOOD — dedicated mapper for complex mappings
public class OrderMapper {
public static OrderResponse toResponse(Order order) {
return new OrderResponse(
order.getId(),
order.getStatus().name(),
order.getItems().stream().map(OrderMapper::toLineItem).toList(),
order.getCreatedAt()
);
}
public static Order toEntity(CreateOrderRequest request, User user) {
Order order = Order.create(request.customerEmail(), user);
request.items().forEach(item ->
order.addItem(item.productId(), item.quantity()));
return order;
}
private static LineItemResponse toLineItem(OrderItem item) {
return new LineItemResponse(item.getProductId(), item.getQuantity(), item.getPrice());
}
}
@Configuration classes live in a config/ package — never in service/ or controller/@ConfigurationProperties for type-safe config — never raw @Value for groups of related settings@Slf4j — never System.out.println@Valid on controller parameters, custom validators as @Component@RestControllerAdvice class, never try/catch in controllers@CreatedDate / @LastModifiedDate with @EnableJpaAuditing@Transactional on controllers — move it to services@Autowired field injection — always use constructor injection (@RequiredArgsConstructor)List<Entity> from controllers — always map to List<ResponseDto>OrderAndInventoryService god classes — split by aggregate@Configuration classes that depend on @Service beans — configuration should only wire infrastructure>
---name: layered-architecturedescription: >---# skills/spring-boot-3/layered-architecture/SKILL.mdFAQ
게시자에게서 skills/spring-boot-3/layered-architecture/SKILL.md를 다운로드하거나 경로를 복사해 저장소를 엽니다. PlugMCP는 스킬을 목록에 올릴 뿐 파일을 호스팅하지 않습니다.
게시자가 https://github.com/rrezartprebreza/spring-boot-skills에서 관리합니다.
Claude, Cursor, Codex, Grok Build는 게시자의 저장소에서 추가한 SKILL.md를 읽을 수 있습니다. Grok Bot은 채팅에서 스킬의 GitHub 폴더 링크를 보내면 설치합니다.