From kotlin-architecture
Apply when creating or moving, files or packages (also plan mode) and project is using layered architecture.
How this skill is triggered — by the user, by Claude, or both
Slash command
/kotlin-architecture:applying-pragmatic-layeredThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Organise code with a modern layered architecture so business logic is clearly separated from infrastructure concerns.
Organise code with a modern layered architecture so business logic is clearly separated from infrastructure concerns. The following guidelines provide a pragmatic approach to layered architecture that keeps the simplicity of traditional 3-layer with a modern approach.
entrypoint → business → infrastructure
src/main/kotlin/<company-package>/
├── business/ # Core business logic
│ ├── domain/ # Aggregates, entities, value objects, domain events, domain errors
│ └── services/ # Use cases — orchestration of infrastructure and domain
├── entrypoint/ # Inbound adapters — triggers that invoke business services (HTTP endpoints, Kafka consumers, etc...)
└── infrastructure/ # Outbound adapters — technical concerns
├── db/ # Repositories
├── clients/ # HTTP clients (internal and external)
├── observability/ # Logging, metrics via domain event listeners
└── config/ # Spring configuration, framework wiring
Allow any other structure as long as it is consistent and logical to layered architecture.
This approach intentionally simplifies classical layered architecture:
@Transactional, @Service)| Aspect | Hexagonal | Modern Layered |
|---|---|---|
| Port interfaces | Domain defines interfaces for all outbound dependencies | No interfaces — services depend on concrete infrastructure classes |
| Dependency direction | Infrastructure depends on domain (dependency inversion) | Business depends on infrastructure (traditional downward) |
| Adapter registration | Adapters implement domain-defined ports | Infrastructure classes are Spring beans injected directly |
| Testability | Test domain with fake implementations of ports | Tests use mocking libraries to mock concrete infrastructure classes |
| Complexity | Higher ceremony (interface per dependency) | Lower ceremony (no boilerplate interfaces) |
npx claudepluginhub allousas/claude-code-plugins --plugin kotlin-architectureImplements Clean Architecture layers, SOLID principles, dependency injection, DDD, hexagonal architecture, and code quality patterns. Use for new service design or refactoring legacy code.
Implements Clean Architecture, Hexagonal Architecture (Ports & Adapters), and DDD patterns in Java 21+ Spring Boot 3.5+ apps for layered structures, domain-framework separation, ports/adapters, entities/value objects/aggregates, and monolith refactoring.
Reviews Java code for Clean/Hexagonal Architecture violations and DDD patterns; scaffolds hexagonal structure with ports, adapters, and value objects.