CLAUDE.md for Django
Migrations discipline and N+1 querysets are where agents need explicit rules in Django projects. Below is a complete, committable example for a typical Django project. To get one tailored to your dependencies and scripts, paste your manifest into the free generator (client-side, nothing uploaded) or run npx getagentready in your repo.
Complete example
# CLAUDE.md This file guides Claude Code when working in this repository. ## Project This project — Stack: Python, Django, pytest. ## Commands - Install dependencies: `pip install -r requirements.txt` - Run all tests: `pytest` - Run a single test: `pytest tests/test_file.py::test_name` ## Testing Tests use pytest. Write or update tests alongside behavior changes; run the single-test command during iteration and the full suite before finishing. ## Conventions - Fat models / thin views; business logic in model methods or service functions, not views or templates. - Schema changes always go through migrations: `makemigrations` then `migrate`; never edit applied migrations. - Use the ORM; drop to raw SQL only with a comment explaining why. - Prefer small, focused changes; do not refactor unrelated code in the same change. - Match the existing code style of the file you are editing over any global preference. - Never commit secrets. `.env*` files are local-only. - After making changes, run the test and lint commands above before considering work done. ## Gotchas - N+1 queries are the default failure mode — reach for `select_related`/`prefetch_related` on any queryset used in a loop. - Settings differ across environments; check `DJANGO_SETTINGS_MODULE` before debugging "works locally" issues. <!-- generated with https://getagentready.dev -->
Going further
This is the generated baseline. The Agent-Ready Pro Pack includes a hand-tuned, deeper Django configuration — architecture guidance, testing strategy, common-task recipes — plus 12 workflow skills and enforcement hooks. See also the CLAUDE.md guide and AGENTS.md guide.
Generate yours in 30 seconds — tailored to your actual Django repo.
Generate mine →