PromptArchPromptArch.ai
Django

CLAUDE.md for Django + DRF

Nota: 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.

Estes exemplos são publicados sob CC0. Use livremente, sem atribuição. São fornecidos como estão, sem garantia de qualquer tipo: revise e adapte ao seu projeto antes de usar, pois você é responsável pelo resultado de aplicá-los.

Leve o PromptArch para sua equipe

Implemente o PromptArch como ferramenta interna em todas as áreas da sua empresa. Obtenha contas de equipe com créditos pré-carregados compartilhados e domínios personalizados para sua organização.

Fale Conosco