layered-architecture

Enforce strict layer boundaries in Spring Boot code generation and scaffolding.

203|35|Updated Apr 14, 2026
One-click install
npx skills add https://github.com/rrezartprebreza/spring-boot-skills --skill layered-architecture
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: layered-architecture
Source: https://github.com/rrezartprebreza/spring-boot-skills/tree/main/skills/layered-architecture
Command: npx skills add https://github.com/rrezartprebreza/spring-boot-skills --skill layered-architecture

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

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.

Core Features & Use Cases

  • Layer Rules: REST controller should be HTTP-only; services hold business logic; repositories handle data access; DTOs map responses; mappings should be in dedicated mappers; configuration lives in config packages.
  • Controller/Service/Repository guidance: ensure one service per aggregate, avoid business logic in controllers, map entities to DTOs, use @Transactional on services, constructor injection, etc.
  • Use Case: When integrating a new module, structure code to align with layers, ensure no coupling across layers, and add tests for layer boundaries.

Quick Start

Describe a Spring Boot project following the Layered Architecture, and I will help enforce and validate the structure across controllers, services, repositories, DTOs, and configurations.

Frequently Asked Questions about layered-architecture

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent business logic from leaking into Spring Boot controllers?

Prevent business logic from leaking into Spring Boot controllers by enforcing strict layer separation, keeping controllers strictly HTTP-only while moving all business logic into dedicated service classes that handle transactional boundaries.

What is the correct way to map entities to DTOs in a layered Spring Boot architecture?

Mapping entities to DTOs in a layered Spring Boot architecture should be handled by dedicated mapper classes rather than directly in controllers or services. This approach enforces strict layer boundaries and ensures safe data transformation across presentation and data layers.

Where should @Transactional annotations go in a Spring Boot layered architecture?

In a Spring Boot layered architecture, @Transactional annotations belong on service classes rather than controllers or repositories. This placement ensures business logic manages transactional boundaries correctly while maintaining clean separation between presentation and data access layers.

How do I structure a new Spring Boot module to follow clean code and layered architecture guidelines?

Structure a new Spring Boot module by enforcing strict layer separation across controllers, services, repositories, DTOs, mappers, and configuration packages. Ensure one service per aggregate, use constructor injection, and add tests for layer boundaries to validate structural integrity.

Does this layered architecture approach work with existing Spring Boot projects or only new scaffolding?

This layered architecture approach works for both modifying existing Spring Boot classes and generating new project scaffolding. It applies documented rules and examples to enforce consistent project structure, clear responsibilities, and safe mappings across all generated or modified components.