Kaiber
Generate, edit, and beat-sync AI video with leading models in one workspace.
django-best-practices
Django and Django REST Framework best practices guide. Use this skill to review, optimize, architect, and write performant Django applications. Triggers when the user asks to implement or review Django models, ORM queries, DRF APIs, Celery tasks, background workers, WebSockets (Channels), caching...
Full skill instructions
A strict guide to writing correct and performant Django and DRF code. Based on real-world patterns, the HackSoftware Styleguide, and common architectural pitfalls.
This skill is the final word on Django design constraints. It covers 15 core categories of real-world expertise (like zero-downtime migrations, avoiding ORM locks, and decoupling business logic). Treat these patterns as strict rules rather than suggestions.
Whenever you write new Django code, modify existing architecture, or refactor for performance:
AGENTS.md (the compiled reference containing all 15 rule domains).rules/ directory (e.g., rules/orm-queries.md, rules/architecture.md).❌ Wrong blocks documented in the guidelines. Look out for:
select_related/prefetch_related).async def views or Channels without sync_to_async.post_save signals.✅ Right patterns. Follow all architectural notes and constraints.select_for_update(skip_locked=True) to prevent deadlocks.order.paid = True).orm-nplusone) and print the recommended fix.orm-nplusone, orm-only-defer, orm-laziness, orm-explainorm-select-for-update, orm-select-for-update-nowait, orm-f-expressions, orm-bulk-insertsarch-services-layer, model-fat-models, arch-selectorsviews-fbv-vs-cbv, api-drf-serializers, api-viewset-optimization, api-paginationasync-celery-idempotency, async-django-views, channels-sync-to-async, channels-security-authsecurity-uuids-in-urls, security-env-secrets, security-csrf, caching-layermigrations-runpython, test-pytest-fixtures, test-query-countsExample Review Output:
### ❌ CRITICAL: N+1 Query Detected (`orm-nplusone`)
The current mapping loops over `Author.objects.all()` and accesses `author.books.count()`. This triggers 101 queries for 100 authors.
**Recommendation:** Use the database to aggregate this mathematically:
`Author.objects.annotate(book_count=Count('books'))`
Example Code Generation (Celery Idempotency):
@shared_task
def process_payment(order_id, amount):
# Rule applied: async-celery-idempotency - Protect against multiple concurrent executions
order = Order.objects.get(id=order_id)
if order.paid:
return
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience