Django Cursor Rules
Cursor rules for Django: security settings, ORM best practices, performance patterns, and production Django configuration.
- Use select_related() and prefetch_related() to avoid N+1 query problems - Keep business logic in service functions, not in views or models - Always use Django's ORM; avoid raw SQL except for complex aggregations - Use Django's CSRF protection; never exempt views without explicit justification - Store secrets in environment variables, never in settings.py - Use custom user model from project start; migrating later is painful - Add __str__ and get_absolute_url to all models - Use django-extensions and django-debug-toolbar in development
How to use with Cursor
Create a `.cursorrules` file in your project root and paste these rules. Cursor reads this automatically on every AI interaction.
Related Rules
Python Cursor Rules
Best Cursor AI coding rules for Python development. Enforce type hints, PEP 8, Pythonic patterns, and modern Python best practices in your .cursorrules file.
TypeScript Cursor Rules
Cursor rules for TypeScript: enforce strict mode, eliminate any types, and write type-safe code with these .cursorrules configurations.
React Cursor Rules
Cursor rules for React: component patterns, hooks best practices, performance optimization, and clean state management conventions.
Next.js Cursor Rules
Cursor rules for Next.js App Router: server components, data fetching, routing, and deployment best practices.