Agent Skill
2/7/2026django-rest-framework-best-practices
Django and Django REST Framework optimization guidelines. This skill defines the architectural and performance standards for the back-end, focusing on ORM efficiency, serialization strategies, and API security
G
gianllopez
0GitHub Stars
1Views
npx skills add gianllopez/com.gianllopez.claude.skills
SKILL.md
| Name | django-rest-framework-best-practices |
| Description | Django and Django REST Framework optimization guidelines. This skill defines the architectural and performance standards for the back-end, focusing on ORM efficiency, serialization strategies, and API security |
name: django-rest-framework-best-practices description: Django and Django REST Framework optimization guidelines. This skill defines the architectural and performance standards for the back-end, focusing on ORM efficiency, serialization strategies, and API security license: MIT metadata: author: gianllopez version: 1.0.0
Django REST API Best Practices
Comprehensive guide for Django and Django REST Framework development. Contains rules prioritized by impact on database performance, response times, and security.
When to Apply
Reference these guidelines when:
- Designing or modifying Django models and database schemas (PostgreSQL).
- Implementing Django REST Framework serializers and data validation logic.
- Developing API views using Django REST Framework ViewSets or Generic Views.
- Optimizing database interactions using the Django ORM (e.g.,
select_related,prefetch_related). - Managing authentication flows, custom permissions, and throttling policies.
- Writing custom Django management commands for administrative tasks.
- Implementing middleware for global request or response processing.
- Handling Django signals and receivers for decoupled event logic.
- Structuring new applications and defining dependencies within the Django project.
- Customizing the Django Admin interface for internal data management.
Rule Categories by Priority
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Architecture & Design Patterns | HIGH | arch- |
| 2 | Project Configuration & Tooling | MEDIUM | conf- |
Quick Reference
1. Architecture & Data Integrity (HIGH)
arch-app-structure- Enforcesapps/directory and package-based models/viewsarch-orm-model-structure- One model per file, strict meta options, and typingarch-api-serializer-definition- Action-based naming and representation delegation
2. Configuration & DevOps (MEDIUM)
conf-settings-structure- Modular settings (base/development/production) and secure secretsconf-env-dependencies- Segregated.venvand split requirement filesconf-docker-standards- Slim images, layer caching, and reverse-domain namingarch-view-definition- Generic views usage and strict APIView typing
How to Use
Read individual rule files for detailed explanations and code examples:
./rules/*.md
Each rule file contains:
- Brief explanation of why it matters
- Incorrect code example with explanation
- Correct code example with explanation
- Additional context and references
Full Compiled Document
For the complete guide with all rules expanded: AGENTS.md
Skills Info
Original Name:django-rest-framework-best-practicesAuthor:gianllopez
Download