rest-api-django
Skill266 starsChanged 10 months agoApache-2.0View on GitHub
Comprehensive guidelines for Django REST API development covering project structure, views, models, serializers, authentication, performance, and error handling.
In this repository264 other files it gives its agents.
- accessibility-a11ySkill
- alpine-jsSkill
- analytics-data-analysisSkill
- android-developmentSkill
- angular-developmentSkill
- angularSkill
- anime-jsSkill
- anthropic-claude-developmentSkill
- api-developmentSkill
- apollo-graphqlSkill
- aspnet-coreSkill
- astroSkill
- auth0-authenticationSkill
- autogen-developmentSkill
- automl-hyperparameter-optimizationSkill
- aws-developmentSkill
- azureSkill
- backend-developmentSkill
- bash-scriptingSkill
- beautifulsoup-parsingSkill
- bitbucket-workflowSkill
- blazorSkill
- blender-python-addonSkill
- blockchainSkill
- bootstrapSkill
- business-central-developmentSkill
- cheerio-parsingSkill
- chrome-extension-developmentSkill
- ci-cd-best-practicesSkill
- clean-architectureSkill
- clean-codeSkill
- clerk-authenticationSkill
- cloudflare-developmentSkill
- computer-vision-opencvSkill
- convexSkill
- cppSkill
- c-sharpSkill
- cssSkill
- cypressSkill
- data-analysis-jupyterSkill
- data-analystSkill
- data-jupyter-pythonSkill
- deep-learning-pythonSkill
- deep-learning-pytorchSkill
- deep-learningSkill
- deno-typescriptSkill
- design-systemsSkill
- devopsSkill
- django-pythonSkill
- django-rest-api-developmentSkill
- dockerSkill
- dotnetSkill
- drizzle-ormSkill
- drupal-developmentSkill
- elasticsearch-best-practicesSkill
- electron-developmentSkill
- elixirSkill
- embedded-stm32Skill
- esbuild-bundlerSkill
- ethereumSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
15 rules. About 0 are common, 12 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈12
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
Use Django's built-in features wherever possible
- Distinctive: line 14
Use descriptive names with lowercase underscores
- Distinctive: line 16
Consider scalability in all design decisions
- Distinctive: line 45
Use class-based views with DRF's APIViews
- Distinctive: line 46
Follow RESTful principles for endpoint design
- Distinctive: line 47
Keep business logic in models, not views
- Very specific: line 52
Use select_related() and prefetch_related() to prevent N+1 queries
- Very specific: line 54
Use transaction.atomic() for critical operations
- Distinctive: line 57
Use DRF serializers for all data transformation
- Distinctive: line 60
Keep serializers focused and composable
- Very specific: line 63
Use djangorestframework_simplejwt for JWT authentication
- Distinctive: line 65
Ensure CSRF protection for session-based auth
- Distinctive: line 71
Use Redis or Memcached for caching
- Distinctive: line 86
Use appropriate HTTP status codes
- Distinctive: line 89
Never expose internal errors to clients
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
REST API Development with Django
You are an expert in Django REST Framework for building scalable APIs.
Core Principles
- Use Django's built-in features wherever possible
- Prioritize readability following PEP 8 compliance
- Use descriptive names with lowercase underscores
- Structure projects using Django apps for reusability
- Consider scalability in all design decisions
Project Structure
Application Structure
app_name/
migrations/ # Database migrations
admin.py # Admin configuration
models.py # Data models
managers.py # Custom model managers
signals.py # Django signals
tasks.py # Celery tasksAPI Structure
api/
v1/
urls.py # URL routing
serializers.py # DRF serializers
views.py # API views
permissions.py # Custom permissions
filters.py # Query filtersDevelopment Guidelines
Views and API Design
- Use class-based views with DRF's APIViews
- Follow RESTful principles for endpoint design
- Keep business logic in models, not views
- Maintain consistent response formats
Models and Database
- Leverage Django ORM for all database operations
- Use
select_related()andprefetch_related()to prevent N+1 queries - Apply proper indexing on frequently queried fields
- Use
transaction.atomic()for critical operations
Serializers and Validation
- Use DRF serializers for all data transformation
- Implement custom validators for complex validation
- Handle nested relationships properly
- Keep serializers focused and composable
Authentication and Authorization
- Use
djangorestframework_simplejwtfor JWT authentication - Implement granular permissions per endpoint
- Ensure CSRF protection for session-based auth
- Apply principle of least privilege
Performance Optimization
- Prevent N+1 queries through eager loading
- Implement database connection pooling
- Use Redis or Memcached for caching
- Apply standardized pagination to list endpoints
Error Handling
{
"success": False,
"message": "Validation failed",
"errors": {
"field_name": ["Error message"]
},
"error_code": "VALIDATION_ERROR"
}- Use appropriate HTTP status codes
- Return consistent error response structure
- Apply structured logging for debugging
- Never expose internal errors to clients
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

