Overview
A CLAUDE.md template is a copyable Claude Code instruction block designed to be pasted into a CLAUDE.md file to drive a project stack. This page provides a complete, ready-to-paste CLAUDE.md for the Angular Material + Django Celery stack, including architecture guidance, file structure, authentication, and production rules. Direct answer: paste the block below into CLAUDE.md to bootstrap a reproducible setup for this stack.
When to Use This CLAUDE.md Template
- You are starting a new Angular Material frontend paired with a Django REST backend and Celery tasks.
- You need a copyable CLAUDE.md block to document roles, rules, and constraints for Claude Code in this stack.
- You require stack-specific constraints to avoid architecture drift during development and deployment.
- You want a ready-made project structure, validation, and security rules to share with teammates or a CI workflow.
Copyable CLAUDE.md Template
# CLAUDE.md
Project role: Full-stack Lead Engineer for Angular Material + Django Celery
Architecture rules:
- Frontend: Angular (v16+) with Angular Material components and a clean component-per-feature structure.
- Backend: Django 4.x + DRF with serializers and viewsets; Celery for async tasks using Redis as broker/backend.
- API layer: JWT-based authentication (DRF SimpleJWT) with refresh tokens; API versioning v1.
- Communication: RESTful API with predictable schemas; frontend communicates via HTTP with proper CORS/configs.
- Deployment: Dockerized frontend and backend; shared environment variables via .env files; consistent runtime versions.
File structure rules:
- frontend/ contains angular.json, package.json, tsconfig.*.json, src/ with app/ and assets/
- backend/ contains manage.py, django_project/ with settings.py, urls.py, wsgi.py, app/ with models.py, serializers.py, views.py, urls.py, and celery.py
- Dockerfile(s) for frontend and backend; docker-compose.yml for local dev
Authentication rules:
- DRF JWT (SimpleJWT): access token short-lived, refresh token long-lived; rotation and revocation where applicable
- CSRF is enforced for cookie-based sessions; API endpoints use token-based auth where possible
- Protect sensitive endpoints with proper permissions and throttling
Database rules:
- PostgreSQL with proper migrations; use environment-based connection settings
- Use atomic transactions for write-heavy API endpoints
Validation rules:
- Server-side validation using DRF serializers; client-side validation with Angular forms
- Sanitize all inputs; reject unexpected fields early
Security rules:
- Use HTTPS in all environments; secure cookies; CSRF protection enabled
- Restrict CORS to allowed origins; avoid wildcard origins in prod
- Do not hard-code secrets; use environment variables and secret managers
- Keep Celery worker processes isolated behind proper network rules
Testing rules:
- Backend: unit tests for models, serializers, viewsets; integration tests for API endpoints; Celery task tests
- Frontend: unit tests for components/services; end-to-end tests for critical flows using Cypress or similar
- Run tests in CI with a matrix for frontend/backend; ensure tests pass before merges
Deployment rules:
- Use docker-compose for local development; Kubernetes or cloud container services for prod
- Migrate DB automatically on deployment; seed essential data via migrations/fixtures
- Collect logs and metrics; monitor Celery task queues and API latency
Things Claude must not do:
- Do not bypass authentication checks or expose protected endpoints
- Do not call external services with untrusted input or without credentials
- Do not hard-code credentials or secrets in code or CLAUDE.md
- Do not bypass CORS/CSRF protections in production configs
Recommended Project Structure
angular-material-django-celery/
├── frontend/
│ ├── src/
│ │ ├── app/
│ │ │ └── components/
│ │ └── main.ts
│ ├── angular.json
│ ├── package.json
│ └── tsconfig.json
├── backend/
│ ├── manage.py
│ ├── django_project/
│ │ ├── settings.py
│ │ ├── urls.py
│ │ └── wsgi.py
│ ├── app/
│ │ ├── models.py
│ │ ├── serializers.py
│ │ ├── views.py
│ │ └── urls.py
│ ├── celery.py
│ ├── requirements.txt
│ └── CeleryWorker/
│ └── __init__.py
├── docker-compose.yml
└── README.md
Core Engineering Principles
- Clear separation of concerns between frontend and backend with well-defined interfaces (APIs and components).
- Explicit architecture constraints to prevent drift and ensure reproducibility.
- Principle of least privilege for services, tokens, and network access.
- Type-safe contracts on API boundaries; emphasize validation and predictable schemas.
- Automated tests and CI checks; deterministic deployment processes.
Code Construction Rules
- Frontend must use Angular Material components for all UI widgets; avoid custom CSS that conflicts with Material themes.
- Backend must expose DRF viewsets with serializers; use PostgreSQL migrations for schema changes.
- Celery tasks must be idempotent and include retry/backoff strategies; use Redis as broker/backend.
- Environment configuration must be driven by environment variables; avoid hard-coded values.
- Authentication should rely on JWTs; protect endpoints with DRF permissions and throttling.
- All API inputs must be validated on the server; client-side validation mirrors server rules.
Security and Production Rules
- Serve over HTTPS; enforce HSTS; use secure cookies for tokens.
- Restrict CORS to known frontends; disable wildcards in production.
- Regularly rotate secrets; use secret management; avoid logging sensitive data.
- Keep dependencies up to date and audit for vulnerabilities; pin versions where possible.
- Configure Celery with proper queues, timeouts, and monitor task failures.
Testing Checklist
- Backend: unit tests for models/serializers; integration tests for API endpoints; Celery task testing with in-memory broker if possible.
- Frontend: unit tests for components and services; UI tests for key flows; accessibility checks.
- CI/CD: run full test suite on PRs; linting and type checks; ensure container builds succeed.
Common Mistakes to Avoid
- Mixing frontend logic into backend services; keep concerns separated.
- Using non-deterministic tests that rely on external services without mocks.
- Over-permissive API permissions or insecure token handling.
- Skipping migrations or seeding data in production deployment steps.
FAQ
Below are concise answers to common questions about this CLAUDE.md Template for Angular Material + Django Celery.
Q1: What is this CLAUDE.md Template for?
A ready-to-paste CLAUDE.md block for documenting and guiding a project that combines Angular Material frontend with Django + Celery backend.
Q2: Which stack does it cover?
Angular Material frontend paired with Django REST Framework backend and Celery for asynchronous tasks.
Q3: How do I use the copyable CLAUDE.md Template?
Copy the block under Copyable CLAUDE.md Template and paste into your CLAUDE.md to standardize scope, rules, and workflow.
Q4: What should be included in the project structure?
Frontend and backend directories with a clean separation, standard Docker/Kubernetes deployment, and CI-ready configuration.
Q5: How is production security handled?
Enforce HTTPS, secure cookies, restricted CORS, token-based auth, and secret management; avoid embedding credentials.