Skip to content

rrezartprebreza/spring-boot-skills / skills/spring-boot-3/layered-architecture

layered-architecture

Verified

Use 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.

examples/bad-service.java

View on GitHub
// BAD — every common layering violation in one class

@Service
public class OrderService {

    @Autowired                                   // field injection instead of constructor
    private OrderRepository orderRepository;

    @Autowired
    private HttpServletRequest httpRequest;       // HTTP concern in service layer

    public ResponseEntity<Order> createOrder(CreateOrderRequest request) {  // returns HTTP type
        String token = httpRequest.getHeader("Authorization");              // reads HTTP headers in service
        if (request.getItems().isEmpty()) {
            return ResponseEntity.badRequest().build();                     // HTTP status logic in service
        }
        Order order = new Order();                                          // no factory method
        order.setEmail(request.getEmail());
        order.setStatus("PENDING");                                         // string instead of enum
        Order saved = orderRepository.save(order);                          // no @Transactional
        return ResponseEntity.ok(saved);                                    // returns entity directly
    }

    @Transactional
    public Order findById(Long id) {             // Long ID instead of UUID
        return orderRepository.findById(id)
            .orElse(null);                       // returns null instead of throwing
    }

    public List<Order> findAll() {               // no pagination, no readOnly
        return orderRepository.findAll();        // unbounded query
    }
}
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: 198kUpdated Claude CodeCodexVerifiedInstall
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: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
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: 194kUpdated Claude CodeCodexVerifiedInstall