clean-architecture

Guide implementing Clean Architecture and Hexagonal Architecture patterns in Java/Kotlin with Spring Boot.

1|Updated Mar 16, 2026
One-click install
npx skills add https://github.com/iceflower/opencode-agents-and-skills --skill clean-architecture-iceflower
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: clean-architecture
Source: https://github.com/iceflower/opencode-agents-and-skills/tree/main/skills/clean-architecture
Command: npx skills add https://github.com/iceflower/opencode-agents-and-skills --skill clean-architecture-iceflower

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides a comprehensive guide to designing and implementing software systems using Clean Architecture and Hexagonal Architecture principles, ensuring maintainability, testability, and flexibility.

Core Features & Use Cases

  • Architectural Principles: Understand the Dependency Rule, Separation of Concerns, and core tenets of Clean Architecture.
  • Layered Structure: Learn the recommended package layout for Domain, Application, Infrastructure, and Presentation layers.
  • Ports and Adapters: Master the implementation of inbound and outbound ports and their corresponding adapters for flexible integration.
  • Data Transformation: Define clear strategies for mapping data objects between different architectural layers.
  • Dependency Inversion: Apply DIP to decouple high-level modules from low-level implementations.
  • Use Case Pattern: Structure application logic around clear, testable use case interfaces and implementations.
  • Testability: Design for testability at every layer, from domain logic to integration tests.
  • Anti-Patterns: Identify and avoid common pitfalls that compromise architectural integrity.
  • Use Case: A software architect can use this guide to establish a robust architectural foundation for a new microservice, ensuring it can evolve easily with changing business requirements and technologies.

Quick Start

Follow the recommended package structure for a new Kotlin + Spring Boot project adhering to Clean Architecture principles.

Frequently Asked Questions about clean-architecture

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

FAQPage Schema
How do I implement clean architecture in a Spring Boot application?

Implement clean architecture in Spring Boot by structuring your project into Domain, Application, Infrastructure, and Presentation layers. This layered structure ensures separation of concerns, making your application maintainable and testable.

What is the difference between clean architecture and hexagonal architecture?

Clean architecture focuses on the dependency rule across layers, while hexagonal architecture emphasizes ports and adapters. This guide combines both, using ports and adapters to decouple application logic from infrastructure details.

How do you structure use cases and ports in domain-driven design?

Structure use cases in domain-driven design by defining clear application logic interfaces. Use inbound ports to trigger use cases and outbound ports to interact with external systems, ensuring high-level modules remain decoupled.

Why use dependency inversion in software architecture patterns?

Use dependency inversion in software architecture patterns to decouple high-level modules from low-level implementations. This principle allows you to swap infrastructure components without affecting core business logic.

What are common anti-patterns when applying clean architecture?

Common clean architecture anti-patterns include leaking infrastructure dependencies into the domain layer and bypassing data transformation boundaries. Identifying these pitfalls preserves architectural integrity and maintains testability.

Can I use clean architecture for microservices in Kotlin?

Yes, you can use clean architecture for microservices in Kotlin. It provides a robust architectural foundation that allows your services to evolve easily with changing business requirements and technologies.