improving-drf-endpoints

improving-drf-endpoints is a skill for Claude Code, Codex from PostHog/posthog-foss. It costs 86 tokens per session (3,039 once invoked), scanned A, original, MIT.

A review workflow for Django REST Framework endpoints, which are HTTP API operations that return or accept structured data. It focuses on serializers, the definitions that describe API fields, and the generated OpenAPI documentation.

In plain words
What is it for?
Use it when editing or reviewing API viewsets and serializers, fixing schema warnings, improving endpoint documentation, or preparing an endpoint for MCP tool access.
Why use it?
Correct field types and descriptions flow into generated API schemas, frontend types, validation code, and agent tools. The workflow helps find problems in those generated outputs before changing the source code.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: installed under .agents/ (shared by several agents).

Good fit Use it when editing or reviewing API viewsets and serializers, fixing schema warnings, improving endpoint documentation, or preparing an endpoint for MCP tool access.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/posthog/posthog-foss/improving-drf-endpoints
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 PostHog/posthog-foss --skill improving-drf-endpoints
Clone the repo
git clone --depth 1 https://github.com/PostHog/posthog-foss

Made for: Claude Code, Codex.

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 improving-drf-endpoints

README.md
[![agentmods](https://agentmods.dev/badge/skills/posthog/posthog-foss/improving-drf-endpoints/github.svg)](https://agentmods.dev/skills/posthog/posthog-foss/improving-drf-endpoints)
Your own site
<a href="https://agentmods.dev/skills/posthog/posthog-foss/improving-drf-endpoints"><img src="https://agentmods.dev/badge/skills/posthog/posthog-foss/improving-drf-endpoints/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 improving-drf-endpoints

Your own site · 80×15
<a href="https://agentmods.dev/skills/posthog/posthog-foss/improving-drf-endpoints"><img src="https://agentmods.dev/badge/skills/posthog/posthog-foss/improving-drf-endpoints.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 86 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,039 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00086 $0.03039
Opus 5.5 $0.00034 $0.01216
Sonnet 5.5 $0.00017 $0.00608
Haiku 4.5 $0.00009 $0.00304

Measured 24d ago against content hash 40f41a60af36, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

improving-drf-endpoints 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 24d 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.

.agents/skills/improving-drf-endpoints/SKILL.md · 187 lines

How it starts

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

Improving DRF Endpoints

Before you propose a contract test against the generated OpenAPI schema, check things already tried. Six PRs took that idea, and none merged.

Overview

Serializer fields are the source of truth for PostHog's entire type pipeline:

Django serializer → drf-spectacular → OpenAPI JSON → Orval → Zod schemas → MCP tools

Every help_text, every field type, every @extend_schema annotation flows downstream. A missing help_text means an agent guessing at parameters. A bare ListField() means z.unknown() in the generated Zod schema. Getting the serializer right means every consumer — frontend types, MCP tools, API docs — gets correct types and descriptions automatically.

When to use

  • Editing or reviewing any file that defines a Serializer or ViewSet
  • Fixing OpenAPI spec warnings or generated type issues
  • Preparing an endpoint for MCP tool exposure
  • Code review of API changes

Audit checklist

Triage: check the generated output first

Before diving into Python, look at the committed generated types to see what's broken. Find the generated files for the endpoint's product:

  • Core API: frontend/src/generated/core/
  • Product APIs: products/<product>/frontend/generated/

Each has two files:

  • api.schemas.ts — TypeScript interfaces derived from serializers. Search for the serializer name and look for unknown types (bare ListField/JSONField), missing JSDoc descriptions (missing help_text), or overly generic Record<string, unknown> shapes.
  • api.ts — API client functions. Check if the endpoint's operation exists at all — if missing, the viewset method likely lacks @extend_schema.

This tells you exactly which fields and endpoints to prioritize.

Serializer fields

Work through this list for every serializer and viewset you touch.

  1. Every field has help_text — describes purpose, format, constraints, valid values
  2. No bare ListField() or DictField() — always specify child= with a typed serializer or field
  3. No bare JSONField() — create a custom field class with @extend_schema_field(TypedSchema)
  4. SerializerMethodField has @extend_schema_field on its get_* method
  5. ChoiceField has explicit choices= with all valid values listed
  6. Define choices as a class — models.TextChoices in a product's internal modules, LabeledStrEnum or LabeledIntEnum from posthog/enums.py in facade contract files (backend/facade/contracts.py, backend/facade/enums.py), which must not import Django. The OpenAPI component is named after the class either way (EarlyAccessFeature.Stage -> EarlyAccessFeatureStageEnum, via ChoicesEnumNameOverrides in posthog/openapi/enum_names.py), so a class-backed enum never collides on field names like format, type, status, kind. Pass X.choices to choices=, and to name a labeled enum on a SerializerMethodField use @extend_schema_field(ChoiceField(choices=X.choices)), not a return type hint. Inline choices=[...] lists have no class to read, collide with existing choices, and fail CI under --fail-on-warn; an explicit ENUM_NAME_OVERRIDES entry in posthog/settings/web.py is the fallback for choice sets no class can carry (see serializer-fields.md)
  7. Read vs write serializers are separate when input shape differs from output
  8. Every success response is backed by a serializer — returning raw dicts or untyped lists means no generated types downstream

Read the full file on GitHub · 187 lines

Files

What ships with it

4 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 24d ago Changed 40f41a60af36
  2. 1mo ago Changed e469784497b1
  3. 1mo ago Changed · +1 lines 48223fe7d549
  4. 1mo ago Changed · +2 lines 1e82cafc2010
  5. 2mo ago Changed 1698ddf8c670
  6. 2mo ago Changed 8489e2b49378
  7. 3mo ago Changed 30a17e21bdb0
  8. 3mo ago Changed bcf3aff80b59
  9. 3mo ago First seen · 184 lines · 86 tokens per session scan A e330e72f7a5c

Subscribe to this mod's changes

improving-drf-endpoints is a skill published in the GitHub repository PostHog/posthog-foss (736 stars, last pushed today), licensed MIT. It adds 86 tokens to every session and 3,039 once invoked, about $0.0003 per session on Opus 5.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-08-30.

Related

improving-drf-endpoints compared with skills from other repositories

improving-drf-endpoints next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
improving-drf-endpointsPostHog/posthog-fossSkill736todayMITA86Claude Code, Codex
mem0-oss-to-platformmem0ai/mem0Skill70ktodayApache-2.0A217Claude Code, Codex
tao-run-inference-serviceNVIDIA/skillsSkill4.3ktodayApache-2.0A92Claude Code
azure-mgmt-botservice-dotnetmicrosoft/skillsSkill3.3ktodayMITA78Claude Code
fastapi-router-pymicrosoft/skillsSkill3.3ktodayMITA46Claude Code
dev-runtimelangwatch/langwatchSkill5.1ktodayApache-2.0A172Claude Code
api-designericrisco/rsc-harnessSkill7072d agoMITA105Claude Code, Codex