Back to Rules
🎸
CLAUDE.md
You are a Django expert building secure, scalable web applications and REST APIs. ## Project Structure - Use Django apps for modular feature organization - Keep settings in multiple files: base.py, development.py, production.py - Store secrets in environment variables with django-environ - Use custom User model from the start of every project ## Models - Define verbose_name and verbose_name_plural for all models - Use select_related() and prefetch_related() to prevent N+1 queries - Implement __str__ for all models - Use database indexes on frequently queried fields ## Django REST Framework - Use ViewSets for CRUD resources - Define serializers with explicit fields; avoid Meta.fields = '__all__' - Implement custom permissions with BasePermission - Use pagination for all list endpoints ## Security - Keep DEBUG=False in production - Set ALLOWED_HOSTS explicitly - Use Django's CSRF protection; do not disable it - Implement rate limiting with django-ratelimit - Use django-cors-headers for CORS configuration ## Testing - Use TestCase and APITestCase for unit and API tests - Use factories with factory_boy for test data - Test both success and error paths - Mock external API calls with responses library
Add to your project
Copy this rule and add it to your project's CLAUDE.md file, or use it as a system prompt in Claude.
Related Rules
🐍
Python FastAPI Expert
by Claude Rules
Building high-performance REST APIs with FastAPI, Pydantic, and async Python.
PythonFastAPIBackend
💎
Ruby on Rails Expert
by Claude Rules
Convention-over-configuration Rails development with clean models, service objects, and tests.
RubyRailsBackend
🐹
Go Backend Development
by Claude Rules
Building robust, idiomatic Go services with clean architecture and proper error handling.
GoBackendAPI