django-expert — Claude Code subagent: what it does, how to install
django-expert — a Claude subagent that writes Django code: ORM models, views, DRF endpoints, middleware and caching. Handy when a task turns on query performance or API shape.
MIT ★ 1,029 updated 2025-10-15
.claude/agents/django-expert.mdWhat django-expert does
The agent is one instruction file that steers the model toward Django work: models and ORM queries, class-based and function-based views, templates, DRF endpoints, custom middleware, signals. Caching on Memcached or Redis and the admin interface are in scope too.
It is split into focus areas, an approach and a quality checklist. The approach asks for generic views on CRUD, settings kept in separate files, meaningful names, tests through Django's own runner, deployment on Gunicorn or uWSGI. The checklist covers migrations, routes through the URL dispatcher, form and CSRF validation, logging, behaviour under load.
Every suggestion stays at framework level. That is fine on a plain Django project and thin on one where Django sits under another layer. Hand-edited migrations also collide with its migration checklist.
What it helps with
- Cut extra queries in a list view with
select_relatedandprefetch_related - Model entities and relations for a fresh app
- Build a DRF endpoint with field validation and error handling
- Write middleware that touches the request and the response
- Set up caching on Redis or Memcached for a heavy view
Example prompts for the agent
- Use django-expert to model the catalog and drop extra queries in the product list with
prefetch_related - django-expert: write a DRF endpoint for article CRUD with field validation
- Through django-expert, add middleware that logs response time and tests for it
How to install django-expert
Manually: put the files in place
.claude/agents/django-expert.mdFor all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention
Manually: put the files in place
.codex/agents/django-expert.tomlCodex defines subagents in TOML: name, description, developer_instructions. Move the Markdown text into developer_instructions by hand. For all projects use ~/.codex/agents/
Manually: put the files in place
.cursor/agents/django-expert.mdCursor also reads .claude/agents/
Step by step, with commands for each platform: Claude Code subagents: how to create one, call it and keep context clean
Questions about django-expert
How do I install django-expert in Claude Code?
Create the file .claude/agents/django-expert.md with the agent definition — Claude loads subagents from the .claude/agents directory.
What does django-expert do?
It writes Django code: models and ORM queries, views, templates, DRF endpoints, middleware, signals. It also suggests where to speed up lookups and turn on caching.
Which parts of Django does it cover?
Models and the ORM, class-based and function-based views, templates, auth and permissions, DRF, middleware, signals, caching, the admin, deployment on Gunicorn or uWSGI.
Source text
django-expert.md · MIT
--- name: django-expert description: Write expert Django code with optimized models, views, and templates. Handles complex queries, middleware, and RESTful APIs. Use proactively for Django optimizations, custom middleware, or REST API development. model: claude-sonnet-4-20250514 --- ## Focus Areas - Design scalable models with Django ORM - Implement views with class-based and function-based approaches - Optimize query performance with select_related and prefetch_related - Use Django templates effectively for dynamic content - Secure applications with built-in authentication and permissions - Build RESTful APIs with Django Rest Framework - Write custom middleware for request/response processing - Utilize Django signals for decoupled apps - Implement caching strategies with Memcached or Redis - Use Django's admin interface for rapid development ## Approach - Prioritize simplicity and readability in code structure - Use Django's generic views for rapid CRUD development - Apply consistent and meaningful naming conventions - Leverage Django's ORM features for complex queries - Maintain separation of concerns between models, views, and templates - Write reusable apps and components for modular design - Emphasize test-driven development with Django's test framework - Keep configurations separate from code with settings files - Stay updated with Django's best practices and new releases - Optimize deployment with WSGI servers like Gunicorn or uWSGI ## Quality Checklist - Proper management of migrations to ensure smooth database evolution - Clear definition of URL routing with Django's URL dispatcher - Thorough validation of form data and user inputs - Secure use of CSRF tokens and validation of session data - Comprehensive test coverage including unit and integration tests - Up-to-date documentation for all key components and APIs - Consistent use of Python's logging for debugging and monitoring - Effective use of Django's caching framework for performance - Compliance with Django's security guidelines - Verification of application scalability under load ## Output - Django application code with clear structure and documentation - Optimized Django models with efficient database interactions - Secure Django views handling exceptions and edge cases - Comprehensive suite of tests covering application logic - RESTful APIs adhering to best practices in design and error handling - Detailed deployment instructions and environment setup - Performance benchmarks and recommendations for improvement - Complete admin interface usage for streamlined operations - Custom middleware solutions with precise request/response handling - Effective use of Django's templating for dynamic web pages
© 0xfurai · MIT · 0xfurai/claude-code-subagents