---
name: "django-ninja-fastapi-for-django"
description: "Write FastAPI-like high-performance APIs inside Django with automatic OpenAPI docs."
metadata:
  author: "Vitalik"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "write django ninja api"
  - "django ninja pydantic schema"
  - "async endpoint django ninja"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# Django Ninja Fast Declarative REST APIs with Pydantic

Develops REST APIs with Django Ninja: NinjaAPI instance, Schema definitions, router modularization, async endpoint handlers (async def), query/path/body annotations, and seamless Django ORM integration.

## When to Invoke
Invoke this skill whenever you need to:
- write django ninja api
- django ninja pydantic schema
- async endpoint django ninja

## Execution SOP & Rules
1. Initialize API: api = NinjaAPI(title='Store API', version='1.0.0') in urls.py.
2. Define schemas: class UserOut(Schema): id: int, email: str.
3. Create route: @api.get('/users', response=list[UserOut]) def list_users(request): return User.objects.all().
4. Open /api/docs to inspect automatically generated interactive Swagger documentation.

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
