/major-ai-skills:djangofrom major-ai-skills
Ship Django apps with env-backed secrets, safe migrations, ORM N+1 hygiene, Celery/Redis workers, and gunicorn/ASGI deploy settings agents routinely misconfigure.
Ships in major-ai-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Django is a batteries-included Python web framework: ORM + migrations, URLconf, middleware, forms/admin, and optional ASGI for async. Requests enter via WSGI/ASGI (gunicorn / uvicorn), pass middleware, resolve to views, and hit the ORM or cache. Agents treat SECRET_KEY / DB URLs as runtime secrets, review every migration for locks, kill N+1 with select_related/prefetch_related, and never leave DEBUG=True or runserver in production.
┌─────────────────────────────────────────────────────────────┐
│ Django request → response │
│ │
│ Client → reverse proxy (@nginx / LB) │
│ → gunicorn (WSGI) or uvicorn (ASGI) │
│ → middleware (Security / CSRF / Auth / Session) │
│ → URLconf → view / DRF viewset │
│ ├── ORM → @postgresql (conn pool / indexes) │
│ ├── cache / sessions → @redis (optional) │
│ └── templates / JSON serializers │
│ │
│ Side paths │
│ ├── manage.py migrate / collectstatic / check --deploy │
│ └── Celery / RQ workers → broker (@redis) + result backend │
└─────────────────────────────────────────────────────────────┘
Use when
check --deploy, HTTPS/proxy headers, static files).Do not use when
@fastapi.@postgresql.SECRET_KEY, DB passwords, or leave DEBUG=True in prod → refuse; use env / @vault.SECRET_KEY = os.environ["SECRET_KEY"] (fail closed in prod). Use SECRET_KEY_FALLBACKS only during planned rotation; never invent or commit keys.python manage.py check --deploy against the production settings module before calling a deploy “done”.ALLOWED_HOSTS; set CSRF_TRUSTED_ORIGINS to full HTTPS origins (https://app.example.com). Behind TLS terminators set SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https").makemigrations → review SQL (sqlmigrate) for long locks → migrate. Prefer expand/contract for zero-downtime; never hand-edit prod schema.select_related / prefetch_related; add Meta.indexes for filter/sort columns; use iterator() for huge scans.@redis broker)—do not block the request thread.collectstatic in CI/image build; WhiteNoise or CDN for static; object storage for uploads (ephemeral containers lose local media).config/settings/prod.py (excerpt — no secrets in git):
import os
import dj_database_url
DEBUG = False
SECRET_KEY = os.environ["SECRET_KEY"]
ALLOWED_HOSTS = [h for h in os.environ.get("ALLOWED_HOSTS", "").split(",") if h]
CSRF_TRUSTED_ORIGINS = [o for o in os.environ.get("CSRF_TRUSTED_ORIGINS", "").split(",") if o]
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
SECURE_SSL_REDIRECT = True
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
DATABASES = {
"default": dj_database_url.config(
conn_max_age=600,
conn_health_checks=True,
ssl_require=os.environ.get("DB_SSL", "true").lower() == "true",
)
}
CACHES = {
"default": {
"BACKEND": "django.core.cache.backends.redis.RedisCache",
"LOCATION": os.environ["REDIS_URL"],
}
}
CELERY_BROKER_URL = os.environ["REDIS_URL"]
CELERY_RESULT_BACKEND = os.environ["REDIS_URL"]
Model + query pattern:
from django.db import models
class Order(models.Model):
customer = models.ForeignKey(
"customers.Customer", on_delete=models.PROTECT, related_name="orders"
)
status = models.CharField(max_length=32, db_index=True)
total_cents = models.PositiveIntegerField()
created_at = models.DateTimeField(auto_now_add=True)
class Meta:
indexes = [models.Index(fields=["customer", "-created_at"])]
# N+1 fix
orders = Order.objects.select_related("customer").filter(status="open")
Celery task (worker process):
from celery import shared_task
@shared_task(bind=True, max_retries=3, default_retry_delay=30)
def send_order_receipt(self, order_id: int) -> None:
# load Order, render email, send — never invent SMTP credentials in code
...
Validation / run loop:
export DJANGO_SETTINGS_MODULE=config.settings.prod
python manage.py check --deploy
python manage.py makemigrations --check --dry-run
python manage.py migrate --noinput
python manage.py collectstatic --noinput
gunicorn config.wsgi:application --bind 0.0.0.0:${PORT:-8000} --workers 3 --timeout 60
# separate process: celery -A config worker -l info
Compose with readiness (pair @docker + @postgresql):
# excerpt — secrets via env/files, never baked into image
services:
web:
command: gunicorn config.wsgi:application -b 0.0.0.0:8000
environment:
DATABASE_URL: postgres://app@db:5432/app
REDIS_URL: redis://redis:6379/0
depends_on:
db: { condition: service_healthy }
worker:
command: celery -A config worker -l info
depends_on: [web, redis]
| Signature | Likely cause | Fix path |
|---|---|---|
DisallowedHost / Invalid HTTP_HOST | Host not in ALLOWED_HOSTS | Add exact hostname; fix proxy Host header |
403 CSRF verification failed on HTTPS forms | Missing CSRF_TRUSTED_ORIGINS or wrong scheme | Add https://… origins; set proxy SSL header |
django-insecure- / check --deploy W009 | Default or short SECRET_KEY | Generate long random key from secrets manager / env |
relation "…" does not exist | Migrations not applied | migrate --noinput in release job before traffic |
| Pages without CSS/JS | collectstatic skipped or WhiteNoise/CDN miswired | Run collectstatic in build; verify STATIC_ROOT / middleware order |
| Slow list endpoints / many queries | N+1 ORM access | select_related / prefetch_related; assertNumQueries in tests |
| Uploads vanish after redeploy | Local disk in ephemeral container | S3/GCS (or volume) for MEDIA; not container FS |
| gunicorn binds but platform never healthy | Bound to 127.0.0.1 | Bind 0.0.0.0:$PORT |
Build KeyError: SECRET_KEY on collectstatic | Settings require secret at import during build | Placeholder build-time env or lazy settings for static-only |
base / dev / prod / test); prod fails closed on missing env.TestCase + factories; use TransactionTestCase only when transactions must commit.CONN_MAX_AGE / PgBouncer thoughtfully with serverless or many workers (@postgresql).Authorization headers.SECRET_KEY, migration blast radius, or worker/broker topology is unclear.@postgresql — indexes, locks, connection pooling behind the ORM@redis — cache, sessions, Celery/RQ broker@docker — multi-stage images, Compose healthchecks for web/db/worker@fastapi — lighter async API alternative when Django batteries are excess@nginx — TLS termination and static/ upstream in front of gunicornMANDATORY: Never invent or commit
SECRET_KEY/ DB credentials. Production meansDEBUG=False, explicitALLOWED_HOSTS, HTTPS CSRF origins, andcheck --deploy. Review migration SQL for locks; fix N+1 before merging list endpoints. Offload slow work to workers (@redis). Validate with migrate + collectstatic + gunicorn bind checks—notrunserver.
DisallowedHost, CSRF 403 without CSRF_TRUSTED_ORIGINS, missing migrate, 127.0.0.1 bind, ephemeral mediaWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub alivirgo/major-ai-skills --plugin major-ai-skills412 skills in this plugin
/3d-slicerAutomate 3D Slicer research workflows with MRML, VTK/ITK, DICOM data, and Segment Editor. Use for software workflows, not clinical interpretation./abbreviated-git-statusInspect Git branch, staging, and working-tree changes with short or porcelain status output when a compact repository check is needed./ableton-liveAutomate Ableton Live sessions with Python MIDI Remote Scripts, Max for Live, AbletonOSC, and Link synchronization./act-as-a-personal-tutorExplain a subject step by step, assess prior knowledge, and use short exercises to check understanding before advancing.Other plugins' skills for the same job