Learn Django architecture, DRF API design, and production-ready development practices.
Copy the install command and let the AI configure it · recommended for beginners
Please install the "django-patterns" skill from askskill: 1. Download https://raw.githubusercontent.com/affaan-m/ECC/main/skills/django-patterns/SKILL.md 2. Save it as ~/.claude/skills/django-patterns/SKILL.md 3. Reload skills and tell me it's ready
I'm building a Django e-commerce project. Help me design the REST API structure for products, orders, and users with DRF, including serializers, viewsets, routing, permissions, pagination, and recommended project organization.
A clear DRF module design with endpoint structure and implementation recommendations.
Review this Django ORM scenario and suggest optimizations: an order list page shows user info, item counts, and payment status, but currently has N+1 queries and slow responses. Explain how to optimize it with select_related, prefetch_related, annotate, and indexes.
Actionable ORM performance improvements with concrete optimization techniques.
Create a production-grade architecture plan for a mid-sized Django project, covering caching strategy, Celery background tasks, middleware design, signal usage boundaries, logging and monitoring, static file handling, and deployment considerations.
A deployment-ready Django architecture plan and operations best-practices checklist.
Production-grade Django architecture patterns for scalable, maintainable applications.
myproject/
├── config/
│ ├── __init__.py
│ ├── settings/
│ │ ├── __init__.py
│ │ ├── base.py # Base settings
│ │ ├── development.py # Dev settings
│ │ ├── production.py # Production settings
│ │ └── test.py # Test settings
│ ├── urls.py
│ ├── wsgi.py
│ └── asgi.py
├── manage.py
└── apps/
├── __init__.py
├── users/
│ ├── __init__.py
│ ├── models.py
│ ├── views.py
│ ├── serializers.py
│ ├── urls.py
│ ├── permissions.py
│ ├── filters.py
│ ├── services.py
│ └── tests/
└── products/
└── ...
# config/settings/base.py
from pathlib import Path
BASE_DIR = Path(__file__).resolve().parent.parent.parent
SECRET_KEY = env('DJANGO_SECRET_KEY')
DEBUG = False
ALLOWED_HOSTS = []
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'rest_framework.authtoken',
'corsheaders',
# Local apps
'apps.users',
'apps.products',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'config.urls'
WSGI_APPLICATION = 'config.wsgi.application'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': env('DB_NAME'),
'USER': env('DB_USER'),
'PASSWORD': env('DB_PASSWORD'),
'HOST': env('DB_HOST'),
'PORT': env('DB_PORT', default='5432'),
}
}
# config/settings/development.py
from .base import *
DEBUG = True
ALLOWED_HOSTS = ['localhost', '127.0.0.1']
DATABASES['default']['NAME'] = 'myproject_dev'
INSTALLED_APPS += ['debug_toolbar']
MIDDLEWARE += ['debug_toolbar.middleware.DebugToolbarMiddleware']
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
# config/settings/production.py
from .base import *
DEBUG = False
ALLOWED_HOSTS = env.list('ALLOWED_HOSTS')
SECURE_SSL_REDIRECT = True
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
SECURE_HSTS_SECONDS = 31536000
SECURE_HSTS_INCLUDE_SUBDOMAINS = True
SECURE_HSTS_PRELOAD = True
# Logging
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'file': {
'level': 'WARNING',
'class': 'logging.FileHandler',
'filename': '/var/log/django/django.log',
},
},
'loggers': {
'django': {
'handlers': ['file'],
'level': 'WARNING',
'propagate': True,
},
},
}
from django.db import models
from django.contrib.auth.models import AbstractUser
from django.core.validators import MinValueValidator, MaxValueValidator
class User(AbstractUser):
"""Custom user model extending AbstractUser."""
email = models.EmailField(unique=True)
phone = models.CharField(max_length=20, blank=True)
birth_date = models.DateField(null=True, blank=True)
USERNAME_FIELD = 'email'
REQUIRED_FIELDS = ['username']
class Meta:
…
Run a four-voice council to evaluate tradeoffs before making tough decisions.
Run repo tasks, debug CI, and deliver fixes with verified evidence.
Learn FastAPI best practices for architecture, auth, service layers, and testing.
Use the correct Ethereum Keccak-256 hashing in Node.js and TypeScript.
Get PostgreSQL best practices for optimization, schema design, indexing, and security.
Extract shared principles from skills and turn them into maintainable rule files.
Learn Laravel production architecture patterns and core backend implementation practices.
Design and improve Spring Boot backend architecture, APIs, and service implementation.
Apply NestJS architecture patterns to build maintainable production-ready TypeScript backends.
Apply PyTorch best practices for robust, efficient, reproducible deep learning pipelines.
Learn production-ready Redis patterns for caching, concurrency, and messaging.
Apply Django security best practices for safer auth, app defenses, and deployment.