Loading...
Loading...
Use when editing, reviewing, or auditing DRF viewsets and serializers in PostHog. Triggers on files in posthog/api/, products/*/backend/api/, products/*/backend/presentation/, or any file importing rest_framework serializers or viewsets. Covers OpenAPI spec quality, field typing, schema annotations, and DRF best practices that flow through the type pipeline to generated TypeScript types and MCP tools.
npx skill4agent add posthog/posthog improving-drf-endpointsDjango serializer → drf-spectacular → OpenAPI JSON → Orval → Zod schemas → MCP toolshelp_text@extend_schemahelp_textListField()z.unknown()SerializerViewSetfrontend/src/generated/core/products/<product>/frontend/generated/api.schemas.tsunknownListFieldJSONFieldhelp_textRecord<string, unknown>api.ts@extend_schemahelp_textListField()DictField()child=JSONField()@extend_schema_field(TypedSchema)SerializerMethodField@extend_schema_fieldget_*ChoiceFieldchoices=@action@extend_schema@validated_requestViewSetModelViewSetserializer_classViewSet@extend_schemagetpostcreatelistOpenApiResponse(response=ErrorSerializer)OpenApiTypes.OBJECTpagination_class=None@validated_requestserializer.is_valid()@extend_schemaproducts/@extend_schema(tags=["<product>"])products/<name>/backend/posthog/api/ee/@extend_schema(request=InputSerializer, responses={(200, "text/event-stream"): OpenApiTypes.STR})visual_reviewDataclassSerializercontracts.pyhelp_text@validated_request@extend_schemadigraph audit {
rankdir=TB
node [shape=diamond fontsize=10]
edge [fontsize=9]
start [label="Serializer or\nViewSet file?" shape=box]
is_model [label="ModelViewSet with\nserializer_class?"]
is_plain [label="Plain ViewSet or\ncustom @action?"]
is_facade [label="DataclassSerializer\n(facade product)?"]
check_fields [label="Check fields:\nhelp_text, ListField,\nJSONField, ChoiceField" shape=box]
add_schema [label="Add @validated_request\nor @extend_schema to\nevery method" shape=box]
check_help [label="Focus on help_text\nand response declarations" shape=box]
check_responses [label="Check response types,\npagination, error schemas" shape=box]
start -> is_model
is_model -> check_fields [label="yes"]
is_model -> is_plain [label="no"]
is_plain -> add_schema [label="yes"]
is_plain -> is_facade [label="no"]
is_facade -> check_help [label="yes"]
check_fields -> check_responses
add_schema -> check_fields
check_help -> check_responses
}posthog/api/alert.pyproducts/tasks/backend/api.pyproducts/llm_analytics/backend/api/evaluation_summary.pyproducts/visual_review/backend/presentation/views.pyimplementing-mcp-toolsdocs/published/handbook/engineering/type-system.mdposthog/api/mixins.py@validated_requestposthog/settings/web.pySPECTACULAR_SETTINGS