Claude Code configuration for Django projects with HTMX and modern Python tooling.
- Stack: Django, PostgreSQL, HTMX
- Package Manager: uv
- Test Command:
uv run pytest - Lint Command:
uv run ruff check . - Format Command:
uv run ruff format . - Type Check:
uv run pyright
apps/- Django applicationsconfig/- Django settings and root URLconftemplates/- Django/Jinja2 templatesstatic/- CSS, JavaScript, imagestests/- Test filestasks/- Celery tasks
- Python 3.12+ with type hints required
- Ruff for linting and formatting (replaces black, isort, flake8)
- pyright strict mode enabled
- No
Anytypes - use proper type hints orobject - Use early returns, avoid nested conditionals
- Prefer composition over inheritance
- Branch naming:
{initials}/{description}(e.g.,jd/fix-login) - Commit format: Conventional Commits (
feat:,fix:,docs:, etc.) - PR titles: Same as commit format
- NEVER swallow errors silently
- Always show user feedback for errors (Django messages, HTMX response headers)
- Log errors with proper context for debugging
- Prefer Function-Based Views
- Always validate request.method explicitly
- Return proper HTTP status codes
- Use
select_related()/prefetch_related()to avoid N+1 queries
- Use template inheritance (
{% extends %},{% block %}) - Create partial templates for HTMX responses (
_partial.htmlnaming) - Always include
hx-indicatorfor loading states - Handle
HX-Requestheader for partial vs full page responses
- Use ModelForm for model-backed forms
- Validate in
clean()andclean_<field>()methods - Always handle form errors in templates
- Disable submit buttons during HTMX requests
- Tasks must be idempotent
- Use proper retry strategies with exponential backoff
- Always log task start/completion/failure
- Pass serializable arguments only (no model instances)
- Write failing test first (TDD)
- Use Factory Boy:
UserFactory.create(is_admin=True) - Use pytest fixtures in
conftest.py - Test behavior, not implementation
- Run tests before committing
Before implementing ANY task, check if relevant skills apply:
- Debugging issues →
systematic-debuggingskill - Exploring Django project (models, URLs, settings) →
django-extensionsskill - Creating new skills →
skill-creatorskill - Starting a new task →
onboardskill - Working a ticket →
ticketskill - Reviewing a PR →
pr-reviewskill - Summarizing branch changes →
pr-summaryskill - Running quality checks →
code-qualityskill - Checking docs accuracy →
docs-syncskill - Committing worktree changes and merging to master/main →
worktree-commit-mergeskill
# Development
uv run python manage.py runserver # Start dev server
uv run pytest # Run tests
uv run pytest -x --lf # Run last failed, stop on first failure
uv run ruff check . # Lint code
uv run ruff format . # Format code
uv run pyright # Type check
# Django
uv run python manage.py makemigrations
uv run python manage.py migrate
uv run python manage.py shell_plus # Enhanced shell (django-extensions)
uv run python manage.py createsuperuser
# Celery
uv run celery -A config worker -l info
uv run celery -A config beat -l info
# Dependencies
uv sync # Install from pyproject.toml
uv add <package> # Add new dependency
uv add --dev <package> # Add dev dependency
# Git
gh pr create # Create PR