CursorDjangoGeneral AI
HTMX (Django) Rules
const htmxDjangoBestPractices = [
.cursorrules
// HTMX with Django .cursorrules
// HTMX and Django best practices
const htmxDjangoBestPractices = [
"Use Django's template system with HTMX attributes",
"Implement Django forms for form handling",
"Utilize Django's URL routing system",
"Use Django's class-based views for HTMX responses",
"Implement Django ORM for database operations",
"Utilize Django's middleware for request/response processing",
];
// Folder structure
const folderStructure = `
project_name/
app_name/
templates/
static/
css/
js/
models.py
views.py
urls.py
project_name/
settings.py
urls.py
manage.py
`;
// Additional instructions
const additionalInstructions = `
1. Use Django's template tags with HTMX attributes
2. Implement proper CSRF protection with Django's built-in features
3. Utilize Django's HttpResponse for HTMX-specific responses
4. Use Django's form validation for HTMX requests
5. Implement proper error handling and logging
6. Follow Django's best practices for project structureHow to use with Cursor
Create a `.cursorrules` file in your project root and paste these rules. Cursor reads this automatically on every AI interaction.
#cursor#django#ai-coding-rules
Related Rules
Python Cursor Rules
CursorPython
Best Cursor AI coding rules for Python development. Enforce type hints, PEP 8, Pythonic patterns, and modern Python best practices in your .cursorrules file.
Code Style
python · type-hintsCopy Ready
TypeScript Cursor Rules
CursorTypeScript
Cursor rules for TypeScript: enforce strict mode, eliminate any types, and write type-safe code with these .cursorrules configurations.
Code Style
typescript · strictCopy Ready
React Cursor Rules
CursorReact
Cursor rules for React: component patterns, hooks best practices, performance optimization, and clean state management conventions.
Architecture
react · hooksCopy Ready
Next.js Cursor Rules
CursorNext.js
Cursor rules for Next.js App Router: server components, data fetching, routing, and deployment best practices.
Architecture
nextjs · app-routerCopy Ready