agents-md
Creates and maintains concise AGENTS.md and CLAUDE.md project instruction files. Use when asked to create AGENTS.md, update…
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.
Claude Code
$ npx -y skills add getsentry/skills --skill django-perf-review --agent claude-code
Codex
$ npx skills add getsentry/skills --skill django-perf-review -a codex -y
Cursor
$ npx skills add getsentry/skills --skill django-perf-review -a cursor -y
Gemini CLI
$ npx skills add getsentry/skills --skill django-perf-review -a gemini-cli -y
GitHub Copilot
$ npx skills add getsentry/skills --skill django-perf-review -a github-copilot -y
OpenCode
$ npx skills add getsentry/skills --skill django-perf-review -a opencode -y
Windsurf
$ npx skills add getsentry/skills --skill django-perf-review -a windsurf -y
name: django-perf-review description: 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. allowed-tools: Read Grep Glob Bash Task license: LICENSE
Review Django code for **validated** performance issues. Research the codebase to confirm issues before reporting. Report only what you can prove.
1. **Research first** - Trace data flow, check for existing optimizations, verify data volume 2. **Validate before reporting** - Pattern matching is not validation 3. **Zero findings is acceptable** - Don't manufacture issues to appear thorough 4. **Severity must match impact** - If you catch yourself writing "minor" in a CRITICAL finding, it's not critical. Downgrade or skip it.
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
# PROBLEM: N+1 - each iteration queries profile
def user_list(request):
users = User.objects.all()
return render(request, 'users.html', {'users': users})
# Template:
# {% for user in users %}
# {{ user.profile.bio }} ← triggers query per user
# {% endfor %}
# SOLUTION: Prefetch in view
def user_list(request):
users = User.objects.select_related('profile')
return render(request, 'users.html', {'users': users})DRF serializers accessing related fields cause N+1 if queryset isn't optimized.
# PROBLEM: SerializerMethodField queries per object
class UserSerializer(serializers.ModelSerializer):
order_count = serializers.SerializerMethodField()
def get_order_count(self, obj):
return obj.orders.count() # ← query per user
# SOLUTION: Annotate in viewset, access in serializer
class UserViewSet(viewsets.ModelViewSet):
def get_queryset(self):
return User.objects.annotate(order_count=Count('orders'))
class UserSerializer(serializers.ModelSerializer):
order_count = serializers.IntegerField(read_only=True)# PROBLEM: Property triggers query when accessed
class User(models.Model):
@property
def recent_orders(self):
return self.orders.filter(created__gte=last_week)[:5]
# Used in template loop = N+1
# SOLUTION: Use Prefetch with custom queryset, or annotate---
**Impact:** Loading entire tables exhausts memory. Large tables cause OOM kills and worker restarts.
# PROBLEM: No pagination - loads all rows
class UserListView(ListView):
model = User
template_name = 'users.html'
# SOLUTION: Add pagination
class UserListView(ListView):
model = User
template_name = 'users.html'
paginate_by = 25# PROBLEM: Loads all objects into memory at once
for user in User.objects.all():
process(user)
# SOLUTION: Stream with iterator()
for user in User.objects.iterator(chunk_size=1000):
process(user)# PROBLEM: Forces full evaluation into memory all_users = list(User.objects.all()) # SOLUTION: Keep as queryset, slice if needed users = User.objects.all()[:100]
---
**Impact:** Full table scans. Negligible on small tables, catastrophic on large ones.
# PROBLEM: Filtering on unindexed field
# User.objects.filter(email=email) # full scan if no index
class User(models.Model):
email = models.EmailField() # ← no db_index
# SOLUTION: Add index
class User(models.Model):
email = models.EmailField(db_index=True)# PROBLEM: Sorting requires full scan without index
Order.objects.order_by('-created')
# SOLUTION: Index the sort field
class Order(models.Model):
created = models.DateTimeField(db_index=True)class Order(models.Model):
user = models.ForeignKey(User)
status = models.CharField(max_length=20)
created = models.DateTimeField()
class Meta:
indexes = [
models.Index(fields=['user', 'status']), # for filter(user=x, status=y)
models.Index(fields=['status', '-created']), # for filter(status=x).order_by('-created')
]Agent skills for Sentry employees, following the Agent Skills open format.
Creates and maintains concise AGENTS.md and CLAUDE.md project instruction files. Use when asked to create AGENTS.md, update…
Write, review, and improve blog posts for the Sentry engineering blog following Sentry's specific writing standards, voice, and…
Write copy following Sentry brand guidelines. Use when writing UI text, error messages, empty states, onboarding flows, 404…
Analyze a repository to generate recommended Claude Code settings.json permissions. Use when setting up a new project, auditing…
Perform code reviews following Sentry engineering practices. Use when reviewing pull requests, examining code changes, or…
Simplifies and refines code for clarity, consistency, and maintainability while preserving all functionality. Use when asked to…
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
Ask which skill or flow fits your situation. A router over the skills in this repo.