django-drf

Implement Django REST Framework ViewSets, serializers, filters, and OpenAPI docs.

Updated May 17, 2026
One-click install
npx skills add https://github.com/cheetah-alo/NegritaOS --skill django-drf-cheetah-alo
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: django-drf
Source: https://github.com/cheetah-alo/NegritaOS/tree/main/.codex/skills/django-drf
Command: npx skills add https://github.com/cheetah-alo/NegritaOS --skill django-drf-cheetah-alo

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and assets (resource) components.

What problem does it solve?

This Skill solves the problem of building correct, secure, and maintainable Django REST Framework (DRF) APIs by standardizing serializers, viewsets, filters, permissions, pagination, and OpenAPI documentation patterns.

Core Features & Use Cases

  • Operation-specific serializers: Separate Read/Create/Update/Include serializers to keep validation and response shapes correct and auditable.
  • RLS- and tenant-aware querying: Provide safe get_queryset() patterns that avoid N+1 queries and handle OpenAPI schema generation via swagger_fake_view.
  • Predictable filtering & permissions: Use filterset_class and dedicated filter base classes for consistent query semantics, plus per-action permission gating.
  • Governance-first REST output: Enforce JSON:API conventions, explicit field whitelisting (no mass assignment), and consistent OpenAPI schema annotations (drf-spectacular).

Quick Start

Apply the django-drf skill to design a new DRF ViewSet endpoint with UUID primary keys, action-specific serializers, filterset_class-based filtering, tenant/RLS-safe get_queryset(), and drf-spectacular OpenAPI annotations.

Frequently Asked Questions about django-drf

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent N+1 queries in Django REST Framework ViewSets?

Prevent N+1 queries in Django REST Framework by using deterministic select_related and prefetch_related statements within a safe get_queryset method. This ensures optimized database access and avoids performance bottlenecks during list and retrieve actions.

How do I prevent mass assignment in DRF serializers?

Prevent mass assignment in DRF serializers by applying explicit field whitelisting and strict write validation for unknown fields. Using operation-specific Read, Create, and Update serializers ensures only intended fields are accepted.

How do I generate OpenAPI docs for DRF filters without schema errors?

Generate OpenAPI docs for DRF filters safely by handling swagger_fake_view within your get_queryset method. This prevents schema generation errors during drf-spectacular documentation parsing while maintaining filterset_class functionality.

What is the best way to structure DRF serializers for create and update actions?

The best way to structure DRF serializers is using operation-specific Read, Create, Update, and Include serializers. This separation keeps validation logic and response shapes correct, auditable, and governance-compliant for each endpoint action.

Does this Django REST Framework pattern support JSON:API conventions?

Yes, this Django REST Framework pattern enforces JSON:API conventions alongside governance constraints. It standardizes output formatting, uses UUIDv4 or UUIDv7 identifiers, and disables trailing-slash URL routing for consistent REST output.

Why does my DRF schema generation fail with custom filterset_class?

DRF schema generation fails with custom filterset_class when get_queryset executes without request context. Handle swagger_fake_view conditions to safely bypass tenant-aware RLS logic during OpenAPI schema generation.