为什么标记为观察中?
它还需要在更多 DRF 项目结构中验证,才能作为生产默认模板。
模板详情
帮助 DRF 团队让 AI agent 尊重权限检查、serializer 边界和数据库查询成本。
命令仍是 MVP 预览。真实使用前请检查目标文件和覆盖行为。
npx rulesmarket add django-rest-api-guardrails# Django REST Framework Rules - Keep permissions explicit on every viewset and custom action. - Use serializers for validation and representation; avoid business logic in views. - Optimize queryset access with select_related and prefetch_related when returning lists. - Add tests for permissions, validation and serializer edge cases. - Do not change migrations or settings without explaining the operational impact. - Avoid exposing internal model fields in API responses.
它还需要在更多 DRF 项目结构中验证,才能作为生产默认模板。
它主要面向 serializers 和 viewsets,但原则也适用于函数式端点。