PromptArchPromptArch.ai
Django

CLAUDE.md for Django + DRF

Score: A

A CLAUDE.md encoding thin viewsets, the cross-app services boundary, and the migration-review habit that prevents dropped columns.

# CLAUDE.md - Registry (Django + DRF)

## Commands
```bash
uv run python manage.py runserver          # dev on :8000
uv run pytest apps/orders -k test_create   # scope while iterating; full run is slow
uv run ruff check . && uv run ruff format .
uv run python manage.py makemigrations     # after model edits; review the output
```

## Architecture
- One app per bounded context under `apps/`; each app is
  models → services → serializers → views, dependencies flowing left.
- Views are thin DRF viewsets; anything conditional beyond permissions and
  serializer choice belongs in `services.py`.
- Cross-app calls go through the target app's `services.py`, never its models -
  that boundary is what keeps apps extractable.

## Conventions
- Serializers validate everything inbound; `request.data` is never read raw.
- Query efficiency is enforced: use `select_related`/`prefetch_related` and
  keep the assertNumQueries assertions in tests passing.
- New endpoints copy the shape of `apps/orders/views.py` (permissions,
  filterset, pagination).

## Workflow
- Model change: edit, `makemigrations`, read the generated migration before
  applying - autogeneration happily drops columns.
- Slow test hunt: `uv run pytest --durations=10`.

## Do not
- Do not edit applied migrations; write a follow-up.
- Do not import another app's models directly; use its service functions.
- Do not silence the N+1 test assertions by raising the query budget.

These examples are released under CC0. Use them freely, no attribution required. They are provided as is, without warranty of any kind: review and adapt them to your project before use, as you are responsible for the outcome of applying them.

Bring PromptArch to your team

Deploy PromptArch as an internal tool across every area of your company. Get team accounts with shared preloaded credits and custom domains tailored to your organization.

Contact Us
CLAUDE.md for Django + DRF - Example | PromptArch | PromptArch