drf
Skill4 starsChanged 8 months agoUnlicenseView on GitHub
Use when building, securing, or fixing REST APIs with Django REST Framework (anything importing rest_framework). Triggers on: "DRF", "serializer", "ViewSet", "APIView", "router", "permission classes", "throttling", "pagination". Not for pure Django ORM/template/form/admin work — use django for those.
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 13
Use this skill for DRF API implementation: serializers, views, viewsets, routers, authentication, permissions, throttling, filtering, …
- Distinctive: line 71
Call out the critical DRF rules applied.
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Django REST Framework Reference
Use this skill for DRF API implementation: serializers, views, viewsets, routers, authentication, permissions, throttling, filtering, pagination, testing, and configuration. Apply the critical rules below, then route to the reference files the task needs.
Critical Rules
fieldsorexcludeis mandatory — Since v3.3.0,ModelSerializer.MetaMUST declarefieldsorexclude. Omitting both raisesImproperlyConfigured.- Writable nested representations require explicit code —
ModelSerializer.create()and.update()do NOT support writable nested serializers by default. You must override these methods. - Reverse relations are NOT auto-included —
ModelSerializerandHyperlinkedModelSerializerdo not include reverse FK/M2M fields. Add them explicitly tofields. - M2M with
throughmodel defaults to read-only — Relational fields targetingManyToManyFieldwith athroughmodel are automaticallyread_only=True. - Object-level permissions skip creation —
has_object_permission()is NOT called during object creation (POST). Restrict creation inperform_create()or the serializer. - Permission composition precedence —
~highest, then&, then|. Use parentheses to be explicit. HiddenFielddisappears in partial updates —HiddenField()does not appear inpartial=Trueserializers (PATCH requests).UniqueTogetherValidatortreats fields as required — All fields in aUniqueTogetherValidatorare implicitlyrequired=True, except those withdefaultvalues.- ViewSet
actionunavailable in early methods —self.actionis NOT set whenget_parsers,get_authenticators, orget_content_negotiatorare called. - No trailing slash in router
register()prefix — Routers append slashes automatically.router.register(r'users', ...)notr'users/'. - Throttling uses non-atomic cache operations — Race conditions possible under high concurrency. Not a security measure against brute force.
CursorPaginationdefaults to-createdordering — Models MUST have acreatedfield, or override theorderingattribute.Requestuses composition, not inheritance — DRFRequestwraps DjangoHttpRequestvia composition. Access standard attributes viarequest.META,request.sessionetc.extra_kwargssilently ignored for explicit fields — If you declare a field on the serializer class AND haveextra_kwargsfor it, theextra_kwargsdo nothing.- Serializer relations cause N+1 queries — Nested and related serializer fields fire one query per object during list serialization. Pair every list-returning view with
select_related/prefetch_relatedon its queryset (django-discipline's ORM rule applies to DRF views too).
When Not To Use This Skill
- Pure Django ORM/views/templates — Load
djangofor models, querysets, template rendering, forms, admin, or middleware outsiderest_framework. - FastAPI / Django Ninja APIs — This skill is
rest_framework-only; do not apply DRF patterns to other API frameworks. - HTMX interaction flows — For partial rendering, swaps, triggers, load
htmx. - Tabler UI work — For Tabler components and CSS patterns, load
tabler. - HTTP status code deep semantics — For 400 vs 422, 401 vs 403, redirect codes, load
http-status-codes. - Project-specific business rules — Load the project's custom skill.
Routing
Choose the primary reference; add one secondary reference only when the task clearly crosses domains. Keep the answer grounded in the reference files actually used.
Single-domain (one file):
| Use for | File |
| Serializer hierarchy, field types, relations, validators, nested writes | references/serializers-fields.md |
APIView, generics, mixins, viewsets, @action, routers | references/views-viewsets.md |
| Authentication, permissions, throttling | references/auth-permissions.md |
| Filter backends, search, ordering, pagination | references/filtering-pagination.md |
| Request, Response, exceptions, status codes | references/requests-responses.md |
| Parsers, renderers, negotiation, metadata | references/parsers-renderers.md |
| Test utilities, complete settings reference | references/testing-settings.md |
| Dispatch flow, parsing pipeline, versioning, schemas | references/internals.md |
Cross-domain (two files):
- Full CRUD API →
views-viewsets.md+serializers-fields.md - Secured API →
auth-permissions.md+views-viewsets.md - Filtered/paginated lists →
filtering-pagination.md+views-viewsets.md - Custom content handling →
parsers-renderers.md+requests-responses.md - Serializer with permissions →
serializers-fields.md+auth-permissions.md
Output Expectations
- Name the reference files used.
- State the minimum tests or verification steps.
- Call out the critical DRF rules applied.
In this repository73 other files it gives its agents.
- agent/AGENTS.mdAGENTS.md
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- git-guardrails-claude-codeSkill
- setup-project-skillsSkill
- skill-creatorSkill
- websearchSkill
- writing-great-skillsSkill
- codebase-designSkill
- construction-craftSkill
- critical-partnerSkill
- data-intensiveSkill
- diagnosing-bugsSkill
- django-disciplineSkill
- docker-disciplineSkill
- documentation-lifecycleSkill
- domain-driven-designSkill
- enterprise-patternsSkill
- git-disciplineSkill
- legacy-codeSkill
- production-readinessSkill
- refactoring-passSkill
- resolving-merge-conflictsSkill
- tddSkill
- testing-workflowSkill
- ui-design-directionSkill
- webapp-testingSkill
- writing-for-agentsSkill
- django-allauthSkill
- djangoSkill
- dockerSkill
- full-calendarSkill
- giteaSkill
- htmxSkill
- http-status-codesSkill
- hyperscriptSkill
- langchainSkill
- litestarSkill
- prestashopSkill
- prSkill
- pykeSkill
- python-asyncSkill
- tablerSkill
- cleanroom-rewriteSkill
- councilSkill
- court-jesterSkill
- domain-modelingSkill
- fix-prSkill
- grillingSkill
- grill-meSkill
- grill-with-docsSkill
- handoffSkill
- humanifySkill
- implementSkill
- implement-specSkill
- improve-codebase-architectureSkill
- ponytail-auditSkill
- ponytail-debtSkill
- prototypeSkill
- qaSkill
- The first 60 shown.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

