npx skills add ...
npx skills add getsentry/sentry-skills --skill django-perf-review
Django performance code review. Use when asked to "review Django performance", "find N+1 queries", "optimize Django", "check queryset performance", "database performance", "Django ORM issues", or audit Django code for performance problems.
This repo is now called getsentry/skills. Both names install the same content, but the install count here only covers this one.
npx skills add getsentry/sentry-skills --skill django-perf-review
Review Django code for validated performance issues. Research the codebase to confirm issues before reporting. Report only what you can prove.
Issues are organized by impact. Focus on CRITICAL and HIGH - these cause real problems at scale.
| Priority | Category | Impact |
|---|---|---|
| 1 | N+1 Queries | CRITICAL - Multiplies with data, causes timeouts |
| 2 | Unbounded Querysets | CRITICAL - Memory exhaustion, OOM kills |
| 3 | Missing Indexes | HIGH - Full table scans on large tables |
| 4 | Write Loops | HIGH - Lock contention, slow requests |
| 5 | Inefficient Patterns | LOW - Rarely worth reporting |
Impact: Each N+1 adds O(n) database round trips. 100 rows = 100 extra queries. 10,000 rows = timeout.
Validate by tracing: View → Queryset → Template/Serializer → Loop access
DRF serializers accessing related fields cause N+1 if queryset isn't optimized.
Impact: Loading entire tables exhausts memory. Large tables cause OOM kills and worker restarts.
Impact: Full table scans. Negligible on small tables, catastrophic on large ones.
Impact: N database writes instead of 1. Lock contention. Slow requests.
Rarely worth reporting. Include only as minor notes if you're already reporting real issues.
Usually skip - difference is <1ms in most cases.
Only flag if queryset is large and not already evaluated.
Only flag if loop is large or this is in a very hot path.
Before reporting ANY issue:
If you cannot validate all steps, do not report.
Fix:
Querysets are lazy. Assigning to a variable doesn't execute anything.
Single query patterns are not N+1:
N+1 requires a loop that triggers additional queries. A single list() call is fine.
Missing select_related on single object fetch is not N+1:
N+1 requires a loop. A single object doing 2 queries instead of 1 can be reported as LOW if relevant, but never as CRITICAL/HIGH.
Style preferences are not performance issues: If your only suggestion is "combine these two lines" or "rename this variable" - that's style, not performance. Don't report it.