django_clean_archlisted
Install: claude install-skill feralbureau/luminy
# django_clean_arch
Standard Django encourages "fat models" and business logic in views or model methods. Clean Architecture inverts this: Django becomes a delivery mechanism, and the core domain is framework-independent. This skill covers the patterns, file structure, and conventions for Clean Architecture in Django.
## The Layered Structure
```
myproject/
├── domain/ # Pure Python — no Django, no DB
│ ├── models/ # Domain entities and value objects
│ │ ├── order.py
│ │ └── user.py
│ ├── repositories/ # Abstract interfaces (Protocol/ABC)
│ │ ├── order_repository.py
│ │ └── user_repository.py
│ └── exceptions.py # Domain-specific exceptions
│
├── application/ # Use cases — orchestrates domain
│ ├── use_cases/
│ │ ├── create_order.py
│ │ ├── cancel_order.py
│ │ └── get_order_summary.py
│ └── services/ # Application services (not domain services)
│ └── email_service.py # Abstract interface for sending emails
│
├── infrastructure/ # Concrete implementations of interfaces
│ ├── repositories/
│ │ ├── django_order_repository.py # Uses Django ORM
│ │ └── django_user_repository.py
│ └── services/
│ └── sendgrid_email_service.py
│
├── interfaces/ # Delivery layer — Django views, DRF serializers
│ ├── api/
│ │ ├── views.py # Thin views: parse → use case → serialize
│ │ ├── serializers.py
│ │