← ClaudeAtlas

django_clean_archlisted

Use this skill when working on a Django project that follows Clean Architecture, DDD (Domain-Driven Design), or a use-case-based structure — as opposed to standard Django MTV patterns. Triggers on: any Django code involving use cases, interactors, repositories, domain models (separate from Django ORM models), application services, or when the user mentions they use Clean Architecture with Django. Also use when the user asks how to structure Django code for testability, or how to avoid business logic in views or models.
feralbureau/luminy · ★ 0 · AI & Automation · score 68
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 │ │