Agent skill

Django Orm Query Optimization

by hashgraph-online in hashgraph-online/awesome-codex-plugins

Optimize Django ORM query loading by fixing N+1 queries, duplicate related-object queries, over-fetching, serializer/template query loops, and inappropriate selectrelated, prefetchrelated, only, or…

MITAuto-check passedDatabases

Install Django Orm Query Optimization

skills CLI
$ npx skills add hashgraph-online/awesome-codex-plugins --skill django-orm-query-optimization -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install hashgraph-online/awesome-codex-plugins django-orm-query-optimization --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/hashgraph-online/awesome-codex-plugins.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/LVTD-LLC/skills/skills/django-orm-query-optimization .claude/skills/django-orm-query-optimization && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
django-orm-query-optimization
GitHub stars
1.2k
Token cost
~650 tokens
SKILL.md length
246 words
Files
2 (incl. references)
Skills in repo
736
Repo updated
First seen
Licence
MIT

At a glance

Optimize Django ORM query loading by fixing N+1 queries, duplicate related-object queries, over-fetching, serializer/template query loops, and inappropriate selectrelated, prefetchrelated, only, or…

  • Works in 4 steps: Prove the query pattern. → Choose the loading strategy. → Keep access consistent. → …
  • Queryset issues too many queries
  • SKILL.md covers Workflow, Anti-Patterns and Verification
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Django Orm Query Optimization is an agent skill from hashgraph-online/awesome-codex-plugins. Optimize Django ORM query loading by fixing N+1 queries, duplicate related-object queries, over-fetching, serializer/template query loops, and inappropriate selectrelated, prefetchrelated, only, or defer usage. Use when a Django page, API, admin view, template, serializer, or queryset issues too many queries or loads more model data than needed.

Its SKILL.md is about 650 tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files, including reference files (for example `references/relationship-and-column-loading.md`). Compatibility notes: Codex, Claude Code, and other Agent Skills-compatible clients.

It sits in Databases, covering Query optimization and Backend development. It works with Django. The repository describes itself as: A curated list of awesome OpenAI Codex / ChatGPT plugins, skills, and resources. The 1 Codex Marketplace. See live plugins at: https://hol.org/plugins/best-codex-plugins. The licence is MIT.

When your agent uses it

  • Queryset issues too many queries
  • Loads more model data than needed

Example prompts

  • “/django-orm-query-optimization”

Requirements

  • Compatibility (from SKILL.md): Codex, Claude Code, and other Agent Skills-compatible clients.

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. Prove the query pattern.
  2. Choose the loading strategy.
  3. Keep access consistent.
  4. Add a focused regression check when useful.

What it can do on your machine

Read from SKILL.md and the folder at commit 16b4156. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Codex, Claude Code, and other Agent Skills-compatible clients.

    From compatibility in the SKILL.md frontmatter.

Context cost

Django Orm Query Optimization loads about 650 tokens when it runs, and up to ~1.2k if it reads all its reference files. Until then it costs about 95 tokens; SKILL.md has 246 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~95
When it runs · the whole SKILL.md, loaded when a task matches
~650
With references · SKILL.md plus every file in references/, read only if the agent opens them
~1.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from hashgraph-online/awesome-codex-plugins at commit 16b4156, republished under its MIT licence (© hashgraph-online). 246 words, ~650 tokens.

Download SKILL.mdSave it as .claude/skills/django-orm-query-optimization/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
django-orm-query-optimization
description
Optimize Django ORM query loading by fixing N+1 queries, duplicate related-object queries, over-fetching, serializer/template query loops, and inappropriate select_related, prefetch_related, only, or defer usage. Use when a Django page, API, admin view, template, serializer, or queryset issues too many queries or loads more model data than needed.
compatibility
Codex, Claude Code, and other Agent Skills-compatible clients.
license
MIT
metadata.version
0.1.0
metadata.displayName
Django ORM Query Optimization
metadata.category
Django
metadata.tags
django,orm,querysets,performance,n-plus-one

Django ORM Query Optimization

Use this skill for query-count and object-loading problems. The usual target is an N+1 pattern where each rendered row or serialized object triggers more database work.

Workflow

  1. Prove the query pattern.

    • Capture query count and duplicate SQL for the slow path.
    • Identify the loop, serializer field, template access, admin display, or model property triggering related queries.
  2. Choose the loading strategy.

    • Use select_related() for single-valued relationships: ForeignKey and OneToOneField.
    • Use prefetch_related() for many-valued relationships: reverse FK and many-to-many.
    • Use Prefetch() when the related queryset needs filters, ordering, annotations, or nested select_related().
    • Use values() or values_list() when model instances are unnecessary.
    • Use only() or defer() only when large columns are truly unused.
  3. Keep access consistent.

    • If you prefetch items, do not later call items.filter(...) and expect the prefetch cache to help.
    • If using iterator() with prefetch_related(), provide chunk_size.
    • Avoid putting broad prefetches into default managers unless every caller needs them.
  4. Add a focused regression check when useful.

    • Use a query-count assertion around the exact view or serializer path.
    • Avoid brittle global query-count tests.

See relationship-and-column-loading.md for examples and review cues.

Anti-Patterns

  • Adding prefetch_related() to every queryset without checking memory.
  • Using only() and then touching deferred fields in a loop.
  • Optimizing a queryset but leaving serializer method fields to issue per-row queries.
  • Hiding queries in __str__(), model properties, template includes, or admin list methods.

Verification

Show the query count and duplicate-query pattern before and after, plus any wall-time or memory change.

© hashgraph-online, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file (references) in plugins/LVTD-LLC/skills/skills/django-orm-query-optimization of hashgraph-online/awesome-codex-plugins.

  • SKILL.md
  • references/relationship-and-column-loading.md

Open the folder on GitHubat commit 16b4156

Compare with similar skills

Django Orm Query Optimization next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Django Orm Query Optimization compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Django Orm Query Optimization this skillhashgraph-online/awesome-codex-plugins1.2k—~650Automated safety check: PassMIT
Dsqlawslabs/agent-plugins912—~6.9kAutomated safety check: PassApache-2.0
Profiling Slow API EndpointsPostHog/posthog-foss721—~1kAutomated safety check: PassMIT
Silk Debugletsrevel/revel-backend109—~1.2kAutomated safety check: PassMIT
Generate Migrationgetsentry/sentry45k—~2.2kAutomated safety check: PassCustom licence
Jpa Patternsaffaan-m/ECC274k5 repos~1.2kAutomated safety check: PassMIT

Similar skills

  • Dsql

    awslabs/agent-plugins

    Official

    Build with Aurora DSQL — manage schemas, execute queries, handle migrations, diagnose query plans, diagnose cluster performance, load data, and develop applications with a serverless, distributed…

    912 GitHub stars~6.9k tokensUpdated 2 days ago
    DatabasesAuto-check passed
  • Profiling Slow API Endpoints

    PostHog/posthog-foss

    Official

    Profiles slow PostHog API endpoints when the main cost is in Postgres or Python.

    721 GitHub stars~1k tokensUpdated today
    DatabasesAuto-check passed
  • Silk Debug

    letsrevel/revel-backend

    Analyze Django Silk profiling data to debug slow requests, detect N+1 queries, and optimize database performance.

    109 GitHub stars~1.2k tokensUpdated yesterday
    Backend & APIsAuto-check passed
  • Generate Migration

    getsentry/sentry

    Official

    Generate or review Django database migrations for Sentry. An agent skill from getsentry/sentry.

    45k GitHub stars~2.2k tokensUpdated today
    DatabasesAuto-check passed
  • Jpa Patterns

    affaan-m/ECC

    JPA/Hibernate patterns for entity design, relationships, query optimization, transactions, auditing, indexing, pagination, and pooling in Spring Boot.

    274k GitHub starsUsed in 5 repos~1.2k tokens
    DatabasesAuto-check passed
  • DB Migrator

    laolaoshiren/claude-code-skills-zh

    数据库迁移助手 - Schema 对比、迁移脚本生成

    877 GitHub stars~677 tokensUpdated 2 days ago
    DatabasesAuto-check passed

More from hashgraph-online/awesome-codex-plugins

All 736 skills in this repo
  • Anime Reaction Gif

    hashgraph-online/awesome-codex-plugins

    Create original anime-style reaction stickers as looping GIFs and MP4 previews, using generated character pose sheets and timed key poses.

    1.2k GitHub stars~922 tokensUpdated yesterday
    Auto-check passed
  • Calibredb

    hashgraph-online/awesome-codex-plugins

    Manage and query Calibre libraries with the calibredb CLI (local paths or Calibre Content server URLs).

    1.2k GitHub stars~1k tokensUpdated yesterday
    Auto-check passed
  • Rust API Test Harness

    hashgraph-online/awesome-codex-plugins

    A skill your agent uses when adding, changing, testing, or debugging Rust HTTP APIs and services, especially when Codex needs black-box integration tests, random-port app startup, real database test…

    1.2k GitHub stars~1.7k tokensUpdated yesterday
    Auto-check passed
  • Art

    hashgraph-online/awesome-codex-plugins

    Make a studio's game look like something at build time — a cover from a real frame of the game (free), painted covers, backdrops, textures and character plates from image models through the…

    1.2k GitHub stars~2.4k tokensUpdated yesterday
    Auto-check passed
  • Calle

    hashgraph-online/awesome-codex-plugins

    Use CALL-E from Codex through the calle CLI. An agent skill from hashgraph-online/awesome-codex-plugins.

    1.2k GitHub stars~2.9k tokensUpdated yesterday
    Auto-check passed
  • Game Balance Economy

    hashgraph-online/awesome-codex-plugins

    Balance game difficulty, resources, rewards, probability, progression, economies, and dominant strategies.

    1.2k GitHub stars~618 tokensUpdated yesterday
    Auto-check passed

Works with

Questions about Django Orm Query Optimization

What does Django Orm Query Optimization do?

Optimize Django ORM query loading by fixing N+1 queries, duplicate related-object queries, over-fetching, serializer/template query loops, and inappropriate selectrelated, prefetchrelated, only, or…. Django Orm Query Optimization is an agent skill from hashgraph-online/awesome-codex-plugins. Optimize Django ORM query loading by fixing N+1 queries, duplicate related-object queries, over-fetching, serializer/template query loops, and inappropriate selectrelated, prefetchrelated, only, or defer usage.

When should I use Django Orm Query Optimization?

Django Orm Query Optimization fits situations like: queryset issues too many queries; loads more model data than needed.

How do I install Django Orm Query Optimization in Claude Code?

Run `npx skills add hashgraph-online/awesome-codex-plugins --skill django-orm-query-optimization -a claude-code`. Or copy the skill folder (plugins/LVTD-LLC/skills/skills/django-orm-query-optimization in hashgraph-online/awesome-codex-plugins) into .claude/skills/django-orm-query-optimization in your project. Claude Code loads it when a task matches its description.

How do I install Django Orm Query Optimization in Codex?

Run `npx skills add hashgraph-online/awesome-codex-plugins --skill django-orm-query-optimization -a codex`. Or copy the skill folder (plugins/LVTD-LLC/skills/skills/django-orm-query-optimization in hashgraph-online/awesome-codex-plugins) into .agents/skills/django-orm-query-optimization in your project. Codex loads it when a task matches its description.

Can I use Django Orm Query Optimization in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add hashgraph-online/awesome-codex-plugins --skill django-orm-query-optimization -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/django-orm-query-optimization, .gemini/skills/django-orm-query-optimization, .github/skills/django-orm-query-optimization and .opencode/skills/django-orm-query-optimization in your project.

What does Django Orm Query Optimization need to run?

SKILL.md names no scripts, command-line tools or credentials: Django Orm Query Optimization is instructions for the agent only. Compatibility (from SKILL.md): Codex, Claude Code, and other Agent Skills-compatible clients..

Does Django Orm Query Optimization access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Django Orm Query Optimization safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Django Orm Query Optimization use?

Django Orm Query Optimization is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Django Orm Query Optimization use?

About 650 tokens (SKILL.md is roughly 2.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 595 tokens, read only when the agent opens those files.

What are the alternatives to Django Orm Query Optimization?

Skills that share tags, products or a category with Django Orm Query Optimization: Dsql (awslabs/agent-plugins, 912 stars), Profiling Slow API Endpoints (PostHog/posthog-foss, 721 stars), Silk Debug (letsrevel/revel-backend, 109 stars) and Generate Migration (getsentry/sentry, 45k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Django Orm Query Optimization?

hashgraph-online (a GitHub organization) maintains it in hashgraph-online/awesome-codex-plugins, which has 1,232 GitHub stars. The repository holds 736 skills in this directory. The repository was last updated on October 6, 2026.

Source: hashgraph-online/awesome-codex-plugins on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.