# django Rules for AI coding agents based on Django's official coding style, ORM query optimization, and security guidance. ```bash npx rulepack add django ``` ## What it covers - `CLAUDE.md` — Claude Code playbook: style, imports, models & ORM, views, security, and a "Don't" list. - `AGENTS.md` — universal agent spec condensed to the load-bearing rules. - `.cursor/rules/django.mdc` — Cursor rules for the same scope (`**/*.py`). Highlights: black/isort formatting and import order, model field/method ordering, `select_related` vs `prefetch_related` to kill N+1 queries, lazy/cached QuerySets and bulk operations, ORM-only SQL safety, and the production security baseline (CSRF, auto-escaping, `ALLOWED_HOSTS`, HTTPS/HSTS, secret `SECRET_KEY`, `DEBUG = False`). ## Source - Django coding style: https://docs.djangoproject.com/en/stable/internals/contributing/writing-code/coding-style/ - Database access optimization: https://docs.djangoproject.com/en/stable/topics/db/optimization/ - Security in Django: https://docs.djangoproject.com/en/stable/topics/security/ ## License MIT