Agent Skill
2/7/2026

django-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

Namedjango-rest-framework-best-practices
DescriptionDjango 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

PriorityCategoryImpactPrefix
1Architecture & Design PatternsHIGHarch-
2Project Configuration & ToolingMEDIUMconf-

Quick Reference

1. Architecture & Data Integrity (HIGH)

  • arch-app-structure - Enforces apps/ directory and package-based models/views
  • arch-orm-model-structure - One model per file, strict meta options, and typing
  • arch-api-serializer-definition - Action-based naming and representation delegation

2. Configuration & DevOps (MEDIUM)

  • conf-settings-structure - Modular settings (base/development/production) and secure secrets
  • conf-env-dependencies - Segregated .venv and split requirement files
  • conf-docker-standards - Slim images, layer caching, and reverse-domain naming
  • arch-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