drf-api-patterns

drf-api-patterns is a skill for Claude Code from VersoXBT/claude-initial-setup. It costs 75 tokens per session (2,069 once invoked), scanned A, original, MIT.

A guide to building web APIs with Django REST Framework, a Django toolkit that exchanges application data over HTTP. It covers data conversion, validation, authentication, permissions, filtering, pagination, and versioning.

In plain words
What is it for?
Use it to create CRUD endpoints, validate data, authenticate users, control access, and add search, filtering, pagination, or versioned APIs.
Why use it?
It helps keep API endpoints consistent and avoids repeatedly implementing common request, response, and access-control behavior.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the claude-initial-setup plugin — 75 skills, 15 commands, 14 agents, 2 hooks shipped together

Good fit Use it to create CRUD endpoints, validate data, authenticate users, control access, and add search, filtering, pagination, or versioned APIs.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/versoxbt/claude-initial-setup/drf-api-patterns
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add VersoXBT/claude-initial-setup --skill drf-api-patterns
Clone the repo
git clone --depth 1 https://github.com/VersoXBT/claude-initial-setup

Made for: Claude Code.

Or install claude-initial-setup, the plugin that ships this one along with the rest of its 75 skills, 15 commands, 14 agents, 2 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for drf-api-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/versoxbt/claude-initial-setup/drf-api-patterns/github.svg)](https://agentmods.dev/skills/versoxbt/claude-initial-setup/drf-api-patterns)
Your own site
<a href="https://agentmods.dev/skills/versoxbt/claude-initial-setup/drf-api-patterns"><img src="https://agentmods.dev/badge/skills/versoxbt/claude-initial-setup/drf-api-patterns/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for drf-api-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/versoxbt/claude-initial-setup/drf-api-patterns"><img src="https://agentmods.dev/badge/skills/versoxbt/claude-initial-setup/drf-api-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 75 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,069 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00075 $0.02069
Opus 5 $0.00037 $0.01035
Sonnet 5 $0.00015 $0.00414
Haiku 4.5 $0.00007 $0.00207

Measured 9d ago against content hash c48b9d4edefd, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

drf-api-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/django/drf-api-patterns/SKILL.md · 298 lines

How it starts

The opening of the file, as written. The whole thing — 298 lines — stays where its author put it; the contents beside it link to each section on GitHub.

DRF API Patterns

Build production-grade REST APIs with Django REST Framework. DRF provides serialization, authentication, permissions, pagination, and more out of the box, so you write less boilerplate and get consistent API behavior.

When to Use

  • User builds REST API endpoints in Django
  • User needs serialization, validation, or pagination
  • User implements authentication and permissions
  • User asks about ViewSets, routers, or DRF best practices
  • User needs filtering, search, or ordering on list endpoints

Core Patterns

Serializers

Serializers handle validation and conversion between Python objects and JSON.

from rest_framework import serializers

class ArticleSerializer(serializers.ModelSerializer):
    author_name = serializers.CharField(source="author.get_full_name", read_only=True)
    comment_count = serializers.IntegerField(read_only=True)
    tags = serializers.SlugRelatedField(
        many=True, slug_field="name", queryset=Tag.objects.all()
    )

    class Meta:
        model = Article
        fields = [
            "id", "title", "slug", "body", "status",
            "author", "author_name", "tags", "comment_count",
            "created_at", "updated_at",
        ]
        read_only_fields = ["id", "slug", "created_at", "updated_at"]

    def validate_title(self, value: str) -> str:
        if len(value) < 5:
            raise serializers.ValidationError("Title must be at least 5 characters")
        return value

    def validate(self, attrs: dict) -> dict:
        """Cross-field validation."""
        if attrs.get("status") == "published" and not attrs.get("body"):
            raise serializers.ValidationError(
                {"body": "Published articles must have a body"}
            )
        return attrs

# Separate serializers for create vs read
class ArticleCreateSerializer(serializers.ModelSerializer):
    class Meta:
        model = Article
        fields = ["title", "body", "tags", "status"]

    def create(self, validated_data):
        tags = validated_data.pop("tags", [])
        article = Article.objects.create(
            author=self.context["request"].user,
            **validated_data,
        )
        article.tags.set(tags)
        return article

Read the full file on GitHub · 298 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 298 lines · 75 tokens per session scan A c48b9d4edefd

Subscribe to this mod's changes

drf-api-patterns is a skill published in the GitHub repository VersoXBT/claude-initial-setup (4 stars, last pushed 4mo ago), licensed MIT. It adds 75 tokens to every session and 2,069 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

claudehut-workflow

Use at the start of every session and whenever beginning a coding task in a Java/Spring backend - establishes the ClaudeHut 7-phase agentic workflow, the complexity-tier routing that lets small tasks skip deliberation phases, and the laws that govern which skills and rules must fire. Injected at session start; also…

taipt1504/claudehut · 86 tokens

architecture-patterns

Implement proven backend architecture patterns including Clean Architecture, Hexagonal Architecture, and Domain-Driven Design. Use this skill when designing clean architecture for a new microservice, when refactoring a monolith to use bounded contexts, when implementing hexagonal or onion architecture patterns, or…

wshobson/agents · 65 tokens

event-store-design

Design and implement event stores for event-sourced systems. Use when building event sourcing infrastructure, choosing event store technologies, or implementing event persistence patterns.

wshobson/agents · 33 tokens

cqrs-implementation

Implement Command Query Responsibility Segregation for scalable architectures. Use when separating read and write models, optimizing query performance, or building event-sourced systems.

wshobson/agents · 35 tokens

workflow-orchestration-patterns

Design durable workflows with Temporal for distributed systems. Covers workflow vs activity separation, saga patterns, state management, and determinism constraints. Use when building long-running processes, distributed transactions, or microservice orchestration.

wshobson/agents · 49 tokens

continuum-tools-mcp

Connect MCP servers (Stdio/SSE/StreamableHTTP) to a Continuum agent, configure tool filtering, set up tool-context capture/injection (e.g. sessionid), and read run artifacts (UI widgets, structured tool data). Invoke when the user asks "connect MCP", "filesystem tool", "remote API tool", "auto-capture sessionid"…

shyftlabs/continuum · 94 tokens