django-rest-api-development — Claude Code skill: Django REST API rules
A skill that gives your coding agent a house style for Django REST APIs: project layout, serializers, JWT auth and query performance.
npx skills add Mindrally/skills --skill django-rest-api-development -a claude-codeWhat django-rest-api-development does
The skill frames the assistant as an expert in Python, Django and RESTful API work. It spells out where files go: models.py, managers.py, signals.py and tasks.py for Celery inside each app, with routing, serializers, permissions and filters under api/v1/app_name/. Views stay thin, business logic lives in models and custom managers.
Two sections cover performance and security. The agent will push select_related and prefetch_related, indexes on frequently queried fields and transaction.atomic() for consistency. For auth it points at djangorestframework_simplejwt and granular permission classes, alongside CSRF protection, CORS config and input sanitization.
Error handling is described as global exception catching, Django signals and one response shape across status codes 400, 401, 403, 404, 422 and 500. No Celery or Redis in your stack? Half the advice has nowhere to land, so check each recommendation against what you actually run before applying it.
What it helps with
- lay out a Django project into apps and API layers
- decide between DRF serializers and hand-rolled validation
- wire up JWT auth and role-based permissions
- cut extra database queries with
select_relatedandprefetch_related - return errors in one consistent format
Example prompts for the agent
- Help me design the v1 API structure for a new Django app
- Review my views: business logic should sit in models and managers
- Set up JWT authentication and permission classes for user roles
How to install django-rest-api-development
1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill django-rest-api-development -a claude-code2Manually: put the files in place
~/.claude/skills/django-rest-api-development/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/django-rest-api-development/
1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill django-rest-api-development -a codex2Manually: put the files in place
.agents/skills/django-rest-api-development/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill django-rest-api-development -a cursor2Manually: put the files in place
.cursor/skills/django-rest-api-development/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install Mindrally/skills django-rest-api-development2Manually: put the files in place
.github/skills/django-rest-api-development/SKILL.md1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill django-rest-api-development -a gemini-cli2Platform CLI
gemini skills install https://github.com/Mindrally/skills --path django-rest-api-developmentManually: put the files in place
.devin/skills/django-rest-api-development/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add Mindrally/skills --skill django-rest-api-development -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about django-rest-api-development
How do I install django-rest-api-development in Claude?
Run npx skills add Mindrally/skills --skill django-rest-api-development -a claude-code. The skill file then lives at ~/.claude/skills/django-rest-api-development/SKILL.md.
What does django-rest-api-development do?
It gives the agent a rulebook for Django REST API work: project structure, DRF class-based views, serializers, permissions, ORM usage and error handling.
Which libraries does the skill assume?
It names Django REST Framework and djangorestframework_simplejwt for tokens, plus Redis or Memcached for caching. Celery appears for background tasks.
Source text
SKILL.md · Apache-2.0
--- name: django-rest-api-development description: Comprehensive guidelines for building scalable Django REST APIs with proper architecture, authentication, and performance optimization. metadata: maintainer: Mindrally source: https://github.com/Mindrally/skills --- # Django REST API Development You are an expert in Python, Django, and scalable RESTful API development. ## Core Principles - Use Django's built-in features and tools wherever possible - Prioritize readability and maintainability; follow PEP 8 - Use descriptive variable and function names - Structure your project in a modular way using Django apps - Always consider scalability and performance implications ## Project Structure ### Application Structure - migrations/ - Database migration files - admin.py - Django admin configuration - models.py - Database models - managers.py - Custom model managers - signals.py - Django signals - tasks.py - Celery tasks (if applicable) ### API Structure - api/v1/app_name/urls.py - URL routing - api/v1/app_name/serializers.py - Data serialization - api/v1/app_name/views.py - API views - api/v1/app_name/permissions.py - Custom permissions - api/v1/app_name/filters.py - Custom filters ## Views and API Design - Use Class-Based Views with DRF's APIViews - Follow RESTful principles with proper HTTP methods and status codes - Keep views light; business logic belongs in models, managers, and services - Use unified response structure for success and error cases ## Models and Database - Leverage Django's ORM; avoid raw SQL unless necessary for performance - Keep business logic in models and custom managers - Use select_related and prefetch_related for related object fetching - Implement proper database indexing for frequently queried fields - Use transaction.atomic() for data consistency ## Serializers and Validation - Use Django REST Framework serializers for validation and serialization - Implement custom validators for complex business rules - Properly handle nested relationships with appropriate serializers ## Authentication and Permissions - Use djangorestframework_simplejwt for JWT token-based authentication - Implement granular permission classes for different user roles - Implement proper CSRF protection, CORS configuration, and input sanitization ## Performance and Scalability - Always use select_related and prefetch_related appropriately - Monitor query counts and execution time in development - Implement connection pooling for high-traffic applications - Use Django's cache framework with Redis/Memcached ## Error Handling - Implement global exception handling for consistent error responses - Use Django signals to decouple error handling - Use appropriate HTTP status codes (400, 401, 403, 404, 422, 500) - Implement structured logging for API monitoring and debugging
© Mindrally · Apache-2.0 · Mindrally/skills