django-api

django-api is a skill for Claude Code from jpoutrin/product-forge. It costs 58 tokens per session (2,364 once invoked), scanned A, original, MIT.

A guide to building APIs in Django using Django Ninja or Django REST Framework, tools for exposing application data and actions through web endpoints.

In plain words
What is it for?
Use it to create Django REST APIs, define typed request and response schemas, add access control, filter results, paginate data, and generate API documentation.
Why use it?
It helps choose an API approach and implement authentication, permissions, filtering, pagination, validation, and asynchronous endpoints.

Skill for Claude Code

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

Part of the python-experts plugin — 11 skills, 5 agents shipped together

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.

agentmods
npx agentmods add skills/jpoutrin/product-forge/django-api
Any agent
npx skills add jpoutrin/product-forge --skill django-api
Clone the repo
git clone --depth 1 https://github.com/jpoutrin/product-forge

Made for: Claude Code.

Or install python-experts, the plugin that ships this one along with the rest of its 11 skills, 5 agents.

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/jpoutrin/product-forge/django-api.svg)](https://agentmods.dev/skills/jpoutrin/product-forge/django-api)
Your own site
<a href="https://agentmods.dev/skills/jpoutrin/product-forge/django-api"><img src="https://agentmods.dev/badge/skills/jpoutrin/product-forge/django-api.svg" alt="Measured on agentmods" height="20"></a>
Per session 58 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,364 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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.00058 $0.02364
Opus 5 $0.00029 $0.01182
Sonnet 5 $0.00012 $0.00473
Haiku 4.5 $0.00006 $0.00236

Measured 2d ago against content hash 46353c0b5cb9, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

django-api 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 2d 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.

plugins/python-experts/skills/django-api/SKILL.md · 422 lines

How it starts

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

Django API Development (2025)

Framework Choice

Factor Django Ninja Django REST Framework
Best for New projects, performance-critical, type-safety Complex apps, mature ecosystem needs
Validation Pydantic (type hints) Serializers
Async Native, first-class Via adrf package
Docs Auto-generated OpenAPI Via drf-spectacular
Learning curve Lower (FastAPI-like) Steeper but well-documented
Ecosystem Growing Extensive third-party packages

Recommendation: Start with Django Ninja for new projects. Use DRF when you need its ecosystem (complex permissions, nested routers, etc).


Setup

pip install django-ninja
# config/urls.py
from ninja import NinjaAPI

api = NinjaAPI(
    title="My API",
    version="1.0.0",
    docs_url="/docs",  # Swagger UI at /api/docs
)

urlpatterns = [
    path("admin/", admin.site.urls),
    path("api/", api.urls),
]

Schemas (Pydantic)

# apps/blog/api/schemas.py
from ninja import Schema, ModelSchema
from datetime import datetime
from apps.blog.models import Article


class ArticleIn(Schema):
    title: str
    body: str
    tag_ids: list[int] = []


class ArticleOut(ModelSchema):
    author_name: str

    class Meta:
        model = Article
        fields = ["id", "title", "slug", "status", "created_at"]

    @staticmethod
    def resolve_author_name(obj: Article) -> str:
        return obj.author.username


class ArticleDetailOut(ArticleOut):
    body: str
    tags: list[str]

    @staticmethod
    def resolve_tags(obj: Article) -> list[str]:
        return [t.name for t in obj.tags.all()]

Key patterns:

  • Use Schema for input, ModelSchema for output
  • Type hints drive validation and docs
  • Use resolve_* for computed fields

Endpoints

# apps/blog/api/views.py
from ninja import Router
from django.shortcuts import get_object_or_404
from apps.blog.models import Article
from .schemas import ArticleIn, ArticleOut, ArticleDetailOut

router = Router(tags=["articles"])


@router.get("/", response=list[ArticleOut])
def list_articles(request, status: str | None = None):
    qs = Article.objects.select_related("author")
    if status:
        qs = qs.filter(status=status)
    return qs


@router.get("/{slug}", response=ArticleDetailOut)
def get_article(request, slug: str):
    return get_object_or_404(
        Article.objects.select_related("author").prefetch_related("tags"),
        slug=slug,
    )


@router.post("/", response=ArticleOut)
def create_article(request, payload: ArticleIn):
    article = Article.objects.create(
        author=request.user,
        title=payload.title,
        body=payload.body,
    )
    if payload.tag_ids:
        article.tags.set(payload.tag_ids)
    return article

Read the full file on GitHub · 422 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. 2d ago First seen · 422 lines · 58 tokens per session scan A 46353c0b5cb9

Subscribe to this mod's changes

django-api is a skill published in the GitHub repository jpoutrin/product-forge (15 stars, last pushed 6mo ago), licensed MIT. It adds 58 tokens to every session and 2,364 once invoked, about $0.0003 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

matlab

Build, review, migrate, and safely plan MATLAB or GNU Octave numerical workflows, including arrays, tabular/time data, tests, projects, graphics, MAT files, and explicit Python interoperability.

K-Dense-AI/scientific-agent-skills · 42 tokens

pennylane

Hardware-agnostic quantum ML framework with automatic differentiation. Use when training quantum circuits via gradients, building hybrid quantum-classical models, or needing device portability across IBM/Google/Rigetti/IonQ. Best for variational algorithms (VQE, QAOA), quantum neural networks, and integration with…

K-Dense-AI/scientific-agent-skills · 98 tokens

dd-code-generation

Use pup CLI for immediate Datadog operations or generate code for integration into applications.

DataDog/pup · 16 tokens

typing-exclusion-worker

Python typing exclusion worker: remove assigned mypy exclusion modules in small scoped batches, fix typing issues, run validation, and produce a structured completion summary. Use when running parallel typing-debt workers or when asked to remove modules from pyproject mypy exclusion overrides.

getsentry/skills · 57 tokens

python

Python development with ruff, mypy, pytest - TDD and type safety.

alinaqi/maggy · 18 tokens

splitting-oversized-modules

Split an oversized Python module (a thousand-plus-line logic.py, models.py, api.py, or its test file) into a package of one module per concern, mechanically and provably without changing behavior. Use on a request to split / break up / decompose a god module or move functions out of one, once a human has agreed to…

PostHog/posthog · 197 tokens