$npx skillfedfor your agent

django-drf

Learn proven Django REST Framework patterns for building scalable APIs. This skill covers ViewSets, Serializers for different operations, filtering strategies, custom permissions, pagination setup, and routing conventions. Includes testing patterns and common management commands.

django-drf teaches you Django REST Framework patterns for building production APIs with ViewSets, Serializers, and Filters.

AI-generated summary based on this skill's SKILL.md

604 88 MITupdated by Gentleman-Programming

Decision gist · record as of 2026-03-28

django-drf teaches you Django REST Framework patterns for building production APIs with ViewSets, Serializers, and Filters. Learn proven Django REST Framework patterns for building scalable APIs. This skill covers ViewSets, Serializers for different operations, filtering strategies, custom permissions, pagination setup, and routing conventions. Includes testing patterns and common management commands.

manual: git clone https://github.com/Gentleman-Programming/Gentleman-Skills → cp -r Gentleman-Skills/curated/django-drf ~/.claude/skills/django-drf
curated/django-drf/SKILL.md · version 761c5887

Use it when

  • django-drf simplifies REST API development through ViewSets, Serializers, and routers.
  • django-drf supports multiple serializer patterns: use one serializer for list/retrieve and another for create/update operations.

Verify before relying

Read SKILL.md below before installing (1 file). Open directory: indexed for reading, not audited.

Same gist for agents: .md · .json

Install

Gentleman-Programming/Gentleman-Skills/django-drf

Open directory. Skills are indexed for reading, not audited. Review a skill's body before installing it.

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

What are django-drf ViewSet examples and how do I use them?

django-drf ViewSets combine related views into a single class, reducing boilerplate. ModelViewSet provides full CRUD operations automatically. Basic example: inherit from ModelViewSet, set queryset and serializer_class, then register with a router. ViewSets handle list, create, retrieve, update, and destroy actions. Use @action decorator for custom endpoints. This pattern is central to building production APIs efficiently.

How do I build a REST API with Django and django-drf?

django-drf simplifies REST API development through ViewSets, Serializers, and routers. Define models, create Serializers to handle data validation and transformation, build ViewSets to handle HTTP requests, then register routes with DefaultRouter. Add filtering, permissions, and pagination in settings. Use token or JWT authentication for security. Test endpoints with pytest or the browsable API. This structured approach ensures scalable, maintainable APIs.

What are the key django-drf serializer patterns for different operations?

django-drf supports multiple serializer patterns: use one serializer for list/retrieve and another for create/update operations, implement SerializerMethodField for computed properties, set read_only_fields for output-only data, and use nested serializers for relationships. Create separate serializers when input validation differs from output format. Override to_representation() and to_internal_value() for custom logic. These patterns ensure clean separation of concerns and robust validation.

How do I set up filtering, permissions, and pagination in django-drf?

django-drf filtering uses DjangoFilterBackend with filterset_fields or custom FilterSet classes. Permissions are applied via permission_classes on ViewSets—use IsAuthenticated, IsAdminUser, or custom classes like IsOwner. Pagination is configured globally in settings with DEFAULT_PAGINATION_CLASS and PAGE_SIZE, or per-ViewSet. Combine these in ViewSet: set filter_backends, permission_classes, and pagination_class. This ensures secure, scalable APIs with controlled data access.

How do I test django-drf endpoints and API logic effectively?

django-drf testing uses APITestCase or pytest fixtures to create test clients and authenticate users. Test each ViewSet action: list, create, retrieve, update, destroy. Verify status codes, response data, and side effects. Use factories for test data, mock external services, and test permissions by making requests as different users. Test serializer validation separately. This comprehensive approach catches bugs early and ensures API reliability.

What is the difference between django-drf ModelViewSet and ViewSet?

django-drf ViewSet is a base class requiring manual action definition; ModelViewSet extends it with automatic CRUD actions (list, create, retrieve, update, destroy, partial_update). Use ModelViewSet for standard database operations, ViewSet for custom logic or non-database endpoints. Both work with routers for automatic URL generation. Choose based on your needs: ModelViewSet saves code for typical resources, ViewSet offers flexibility for complex scenarios.

SKILL.md

Rendered from the published skill. Quoted content, verbatim.

ViewSet Pattern

from rest_framework import viewsets, status
from rest_framework.response import Response
from rest_framework.decorators import action

class UserViewSet(viewsets.ModelViewSet):
    queryset = User.objects.all()
    serializer_class = UserSerializer
    filterset_class = UserFilter
    permission_classes = [IsAuthenticated]

    def get_serializer_class(self):
        if self.action == "create":
            return UserCreateSerializer
        if self.action in ["update", "partial_update"]:
            return UserUpdateSerializer
        return UserSerializer

    @action(detail=True, methods=["post"])
    def activate(self, request, pk=None):
        user = self.get_object()
        user.is_active = True
        user.save()
        return Response({"status": "activated"})

Serializer Patterns

```python from rest_framework import serializers

Read Serializer

class UserSerializer(serializers.ModelSerializer):

(truncated - see the full file via the links below)

File tree — 1 file
curated/django-drf/SKILL.md

Let your AI agent find skills like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 56,283 agent skills by what they can do, searchable in plain language.

wish › “Learn Django REST Framework patterns for building production APIs”

Give your agent the search over MCP, or paste the wish link into any chat. No install? Search from any chat →

Related skills

django-expert
by personamanagmentlayer · personamanagmentlayer/pcl

Django Expert delivers in-depth instruction on the Django framework for constructing robust Python web applications. It covers the MVT pattern, database modeling through ORM, view logic, template rendering, URL routing, form handling, and Django's authentication system. The skill also explores REST API development and admin interface customization.

Apache-2.0updated Mar 2026
★ 38repo stars
django-expert
by Jeffallan · Jeffallan/claude-skills

Django Expert guides you through building production-grade REST APIs using Django and Django REST Framework. It covers model design with database indexes, query optimization via select_related and prefetch_related, serializer validation, viewset implementation, and authentication setup. The skill enforces best practices like environment-based secrets, proper permissions, and comprehensive testing.

MITupdated May 2026
★ 10,759repo stars
django-tdd
by xu-xiang · xu-xiang/everything-claude-code-zh

Learn test-driven development for Django applications using pytest and factory_boy. This skill covers the red-green-refactor workflow, test configuration, fixture setup, and testing Django models, views, and REST Framework APIs with practical examples.

MITdocs in Chineseupdated Mar 2026
★ 1,767repo stars
django-tdd
by affaan-m · affaan-m/ECC

Master test-driven development for Django projects using pytest and factory_boy to build reliable models, views, and APIs. This skill covers the red-green-refactor cycle, test fixtures, factory patterns, and Django REST Framework testing.

MITupdated Jul 2026
★ 234,207repo stars
django-patterns
by xu-xiang · xu-xiang/everything-claude-code-zh

Master production-ready Django patterns covering project structure, model design, QuerySet optimization, and REST Framework integration. Learn configuration management across environments, custom managers, serializers, and middleware strategies for building maintainable, scalable applications.

MITupdated Mar 2026
★ 1,767repo stars
django-patterns
by affaan-m · affaan-m/ECC

Master production-ready Django development through architectural patterns covering project structure, model design, QuerySet optimization, and REST Framework integration. This skill guides you through split settings for environment management, custom managers and querysets to prevent N+1 queries, and serializer patterns for robust API development.

MITupdated Jul 2026
★ 234,207repo stars

More skills Django Coder (NOASSERTION)

Tags
api-developmentrest-patternsbackend-frameworkrequest-handlingdata-validationaccess-controltest-automationquery-filteringresponse-formattingendpoint-routing