performance-optimizer

performance-optimizer is a skill for Claude Code from smicolon/ai-kit. It costs 57 tokens per session (2,911 once invoked), scanned A, original, MIT.

A guide for finding and fixing slow database access, especially in Django applications. Django is a Python web framework, and its ORM is the part used to read database data through Python code.

In plain words
What is it for?
Use it to optimize or diagnose Django ORM queries, fix slow queries, detect N+1 problems, and add indexes.
Why use it?
It helps locate inefficient queries, repeated related-data lookups known as N+1 problems, and missing database indexes. It focuses performance work on the database access causing the delay.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the django plugin — 8 skills shipped together

Good fit Use it to optimize or diagnose Django ORM queries, fix slow queries, detect N+1 problems, and add indexes.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/smicolon/ai-kit/performance-optimizer
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add smicolon/ai-kit --skill performance-optimizer
Clone the repo
git clone --depth 1 https://github.com/smicolon/ai-kit

Made for: Claude Code.

Or install django, the plugin that ships this one along with the rest of its 8 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for performance-optimizer

README.md
[![agentmods](https://agentmods.dev/badge/skills/smicolon/ai-kit/performance-optimizer/github.svg)](https://agentmods.dev/skills/smicolon/ai-kit/performance-optimizer)
Your own site
<a href="https://agentmods.dev/skills/smicolon/ai-kit/performance-optimizer"><img src="https://agentmods.dev/badge/skills/smicolon/ai-kit/performance-optimizer/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for performance-optimizer

Your own site · 80×15
<a href="https://agentmods.dev/skills/smicolon/ai-kit/performance-optimizer"><img src="https://agentmods.dev/badge/skills/smicolon/ai-kit/performance-optimizer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 57 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,911 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00057 $0.02911
Opus 5.5 $0.00023 $0.01164
Sonnet 5.5 $0.00011 $0.00582
Haiku 4.5 $0.00006 $0.00291

Measured 1mo ago against content hash cceaf0c4f89a, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

performance-optimizer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

packs/django/skills/performance-optimizer/SKILL.md · 481 lines

How it starts

The opening of the file, as written. The whole thing — 481 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Performance Optimizer

Auto-detects and fixes Django ORM performance issues before they reach production.

Activation Triggers

This skill activates when:

  • Writing ORM queries
  • Accessing related objects (foreign keys, M2M)
  • Creating views that fetch data
  • Mentioning "slow", "performance", "optimization"
  • Looping over querysets
  • Creating list/detail views

Performance Targets

  • ✅ NO N+1 queries
  • ✅ Appropriate indexes on frequently queried fields
  • ✅ Pagination for list endpoints
  • ✅ select_related() for foreign keys
  • ✅ prefetch_related() for reverse foreign keys and M2M
  • ✅ Caching for expensive operations

Auto-Detection Patterns

Pattern 1: N+1 Query Detection

❌ INEFFICIENT (N+1 query):

# Bad: 1 query for users + N queries for organizations
users = User.objects.all()  # 1 query
for user in users:  # N queries
    print(user.organization.name)  # Hits DB each time!

✅ OPTIMIZED:

# Good: 2 queries total (1 for users + 1 JOIN for organizations)
users = User.objects.select_related('organization').all()
for user in users:
    print(user.organization.name)  # No DB hit!

Pattern 2: Reverse Foreign Key N+1

❌ INEFFICIENT:

# Bad: 1 + N queries
organizations = Organization.objects.all()  # 1 query
for org in organizations:  # N queries
    users = org.users.all()  # Hits DB each time!
    print(f"{org.name}: {users.count()} users")

✅ OPTIMIZED:

# Good: 2 queries total
organizations = Organization.objects.prefetch_related('users').all()
for org in organizations:
    users = org.users.all()  # Pre-fetched!
    print(f"{org.name}: {users.count()} users")

Pattern 3: Many-to-Many N+1

❌ INEFFICIENT:

# Bad: 1 + N queries
users = User.objects.all()  # 1 query
for user in users:  # N queries
    roles = user.roles.all()  # Hits DB each time!

✅ OPTIMIZED:

# Good: 2 queries total
users = User.objects.prefetch_related('roles').all()
for user in users:
    roles = user.roles.all()  # Pre-fetched!

Read the full file on GitHub · 481 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago Changed · +33 lines cceaf0c4f89a
  2. 1mo ago First seen · 448 lines · 57 tokens per session scan A abe972862334

Subscribe to this mod's changes

performance-optimizer is a skill published in the GitHub repository smicolon/ai-kit (6 stars, last pushed 1mo ago), licensed MIT. It adds 57 tokens to every session and 2,911 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

optimize

Analyze and suggest performance improvements for code, queries, or systems.

FlorianBruniaux/claude-code-ultimate-guide · 15 tokens

triage-issues

Triage GitHub issues in the googleapis/mcp-toolbox repo: propose the correct labels (type / priority / product / status), check for duplicates, verify a bug has enough info to act on, and draft a triage comment. Use whenever a maintainer asks you to triage, label, categorize, prioritize, or "look at" an issue (or a…

googleapis/mcp-toolbox · 164 tokens

postgresql-indexing

PostgreSQL indexing best practices for Prowler: index design, partial indexes, partitioned table indexing, EXPLAIN ANALYZE validation, concurrent operations, monitoring, and maintenance. Trigger: When creating or modifying PostgreSQL indexes, analyzing query performance with EXPLAIN, debugging slow queries, reviewing…

prowler-cloud/prowler · 108 tokens

graphjin-eval

Create, extend, run, baseline, and diagnose GraphJin agent evaluations through the graphjin eval CLI.

dosco/graphjin · 27 tokens

ha-logs

A read-only troubleshooting skill for querying Hope Agent’s local SQLite databases, which store logs, conversations, and background-job status.

shiwenwen/hope-agent · 183 tokens

ha-data-stores

Map of Hope Agent's local data stores and safe read-only query workflow. Use when the user asks where Hope Agent stores data, wants to inspect sessions/messages/memory/logs/background jobs/knowledge indexes/settings, asks the model to query local app data, or debugging requires checking persisted state. Trigger…

shiwenwen/hope-agent · 115 tokens