跳到正文
TakoAPI
返回技能列表

drf

由 pradeepcep 提供

Coding Agents & IDEs
514下载量由 clawskills.sh 提供
0浏览量
0 个赞登录后即可为这个技能点赞
—暂无评分
你的评分

简介

Django REST Framework scaffolding best practices, and gotchas.

描述

该技能的功能

Covers building REST APIs with Django REST Framework, including project setup, serializers, viewsets, routing, authentication, pagination, filtering, and query optimization. Includes guidance on common pitfalls like N+1 queries, silent permission bugs, and misplaced business logic.

Collects opinionated defaults and common pitfalls in one place so engineers avoid silent security bugs and performance problems that DRF does not surface on its own.

何时使用

  • Scaffolding a new Django REST API project from scratch
  • Adding token or JWT authentication to Django endpoints
  • Fixing N+1 query problems in DRF list views
  • Writing serializers with separate read and write representations
  • Setting up rate limiting for anonymous and authenticated users

示例工作流

输入

User asks: Set up a new Django REST API project with authentication and pagination

智能体
  1. 1

    Create a virtual environment and install django and djangorestframework

  2. 2

    Run django-admin startproject and manage.py startapp to scaffold the project

  3. 3

    Configure REST_FRAMEWORK settings with IsAuthenticated, JSONRenderer, and LimitOffsetPagination

  4. 4

    Create a ModelSerializer and ModelViewSet for the target resource

  5. 5

    Register the viewset with a DRF router and include the URLs in the main urls.py

输出

A working Django REST API with authenticated endpoints, paginated list views, and standard CRUD routes

安装

clawhub install pradeepcep/drf

运行 CLI 命令,或把这段提示词粘贴到 Claude Code、Cursor、Codex 或你在用的任意编程智能体里。

链接