The Clean Architecture Framework provides guidelines to structure software architectures, ensuring that business rules are independent of frameworks and databases. It is ideal for software architects and developers who aim for maintainable and testable code.
$ npx skills add https://github.com/wondelai/skills --skill clean-architectureThe Clean Architecture Framework guides you to structure software so source code dependencies point inward—from frameworks and databases toward use cases and entities. It organizes architecture as concentric circles where business rules remain independent of implementation details like web frameworks, databases, and delivery mechanisms. By enforcing the Dependency Rule, where inner circles never know about outer circles, you achieve testable, resilient systems that let you swap databases or frameworks without touching core business logic. This skill covers the four-layer model (Entities, Use Cases, Interface Adapters, Frameworks), component principles, dependency inversion, and architectural scoring. Use it when designing system boundaries, reviewing module organization, decoupling business logic from infrastructure, or debating where business rules belong.
Install using the command: `$ npx skills add https://github.com/wondelai/skills --skill clean-architecture`
Designing system architecture
Reviewing module boundaries
Advising on dependency management
$ npx skills add https://github.com/wondelai/skills --skill clean-architecturegit clone https://github.com/wondelai/skillsCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
Act as a Clean Architecture expert. Analyze the following [CODEBASE] from [COMPANY] in the [INDUSTRY] sector. Identify violations of Clean Architecture principles, suggest refactoring strategies, and provide a prioritized list of improvements. Focus on dependency inversion, separation of concerns, and testability. [CODEBASE]: [PASTE_CODE]
# Clean Architecture Assessment for Acme Corp's E-Commerce Platform
## Key Violations Identified
### 1. **Direct Database Dependencies in Use Cases**
The `OrderService` class directly instantiates `OrderRepository`, violating the Dependency Inversion Principle (DIP). This couples business logic to infrastructure details.
```java
public class OrderService {
private OrderRepository orderRepository = new OrderRepository(); // Violation
}
```
### 2. **Business Logic in Presentation Layer**
Pricing calculations are performed in the REST controller rather than in domain entities, making them harder to test and reuse.
```kotlin
@PostMapping("/checkout")
fun processCheckout(@RequestBody request: CheckoutRequest): ResponseEntity<CheckoutResponse> {
val discount = request.items.sumOf { it.price } * 0.1 // Business logic here
// ...
}
```
## Refactoring Recommendations
### Priority 1: Extract Domain Layer
- Create a `PricingService` in the domain layer
- Move all business rules (discounts, taxes) to this service
- Ensure `PricingService` has no dependencies on frameworks or databases
### Priority 2: Implement Dependency Injection
- Use constructor injection for repositories in use cases
- Introduce interfaces for repositories in the domain layer
```java
public class OrderService {
private final OrderRepository orderRepository;
public OrderService(OrderRepository orderRepository) { // Injected dependency
this.orderRepository = orderRepository;
}
}
```
### Priority 3: Establish Layer Boundaries
```
├── domain/ # Business rules only
├── application/ # Use cases
├── infrastructure/ # Frameworks & databases
└── presentation/ # API/UI controllers
```
## Expected Benefits
- 40% reduction in regression bugs
- 60% faster unit test execution
- Clearer separation of responsibilities
- Easier framework migrations (e.g., from Spring to Micronaut)Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan