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.
npx skills add jggomez/expert-ai-developer-skills --skill sql-query-optimizationgit clone --depth 1 https://github.com/jggomez/expert-ai-developer-skillsWrote 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.
[](https://agentmods.dev/skills/jggomez/expert-ai-developer-skills/sql-query-optimization)<a href="https://agentmods.dev/skills/jggomez/expert-ai-developer-skills/sql-query-optimization"><img src="https://agentmods.dev/badge/skills/jggomez/expert-ai-developer-skills/sql-query-optimization/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.
<a href="https://agentmods.dev/skills/jggomez/expert-ai-developer-skills/sql-query-optimization"><img src="https://agentmods.dev/badge/skills/jggomez/expert-ai-developer-skills/sql-query-optimization.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00087 | $0.01221 |
| Opus 5.5 | $0.00035 | $0.00488 |
| Sonnet 5.5 | $0.00017 | $0.00244 |
| Haiku 4.5 | $0.00009 | $0.00122 |
Grade A, and why
sql-query-optimization 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 today.
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.
How it starts
The opening of the file, as written. The whole thing — 57 lines — stays where its author put it; the contents beside it link to each section on GitHub.
SQL Query Optimization Skill
Overview
Diagnoses, profiles, and optimizes slow SQL queries across traditional relational engines (PostgreSQL, MySQL, SQL Server, SQLite, Oracle) under the rule: start from the execution plan, never from intuition. Analyzes EXPLAIN ANALYZE plans, designs selective composite indexes, rewrites non-sargable predicates and deep OFFSET pagination, and enforces concise artifact caps and fail-honest plan reporting.
When to Use
Trigger Scenarios
- Query latency spikes, timeouts, sequential scan bottlenecks, or high CPU/buffer reads on OLTP RDBMS engines.
- Analyzing
EXPLAIN (ANALYZE, BUFFERS)(Postgres) orEXPLAIN ANALYZE(MySQL/SQL Server) execution trees. - Designing composite/covering indexes, unwrapping indexed predicates, and converting
OFFSETto keyset pagination.
When NOT to Use
- Google Cloud BigQuery MPP queries: Route to
bigquery-query-optimization. - Schema migrations and DDL lock safety: Route to
database-migration-expert. - Application-layer caching: Route to
performance-scalability.
Process
Phase 1: Fail-Honest Execution Plan Diagnostics
- Obtain the Live Plan: Run
EXPLAIN (ANALYZE, BUFFERS, VERBOSE) <query>;(or read-onlyEXPLAINfor mutating statements wrapped inBEGIN; ... ROLLBACK;). - Fail-Honest Fallback (
STATIC_ANALYSIS_ONLY/BLOCKED): If DBEXPLAINfails due to missing credentials or an unreachable database, explicitly mark the outputSTATIC_ANALYSIS_ONLY/BLOCKED: Live plan not executed — <exact error>and NEVER invent row counts, buffer reads, orEXPLAIN ANALYZElatencies. - Locate Bottlenecks: Inspect unexpected
Seq Scannodes, massive estimated-vs-actual row skew (runANALYZE <table>;if stale), and disk-spilling external sorts/hashes.
Phase 2: Indexing & Query Rewriting Patterns
- Composite Index Ordering: Index
WHERE,JOIN ... ON, andORDER BYcolumns ordered equality predicates first, then range/sort columns; avoid over-indexing write-heavy tables. - Sargable Predicates: Unwrap indexed columns (
WHERE created_at >= '2026-09-01' AND created_at < '2026-09-02'instead ofWHERE DATE(created_at) = '2026-09-01'). - Keyset Pagination & Decorrelation: Replace
OFFSET 50000withWHERE id > :last_seen_id ORDER BY id ASC LIMIT 20; convert correlated subqueries into explicitJOINs; replaceSELECT *to enable Index-Only Scans.
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.
- today First seen · 57 lines · 87 tokens per session scan A cede959f09e4
sql-query-optimization is a skill published in the GitHub repository jggomez/expert-ai-developer-skills (30 stars, last pushed yesterday), licensed Apache-2.0. It adds 87 tokens to every session and 1,221 once invoked, about $0.0003 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-11-06.
sql-query-optimization compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| sql-query-optimizationjggomez/expert-ai-developer-skills | Skill | 30 | yesterday | Apache-2.0 | A | 87 | Claude Code, Codex |
| reproduce-buggoogleapis/mcp-toolbox | Skill | 17k | yesterday | Apache-2.0 | A | 130 | Claude Code, Codex |
| triage-issuesgoogleapis/mcp-toolbox | Skill | 17k | yesterday | Apache-2.0 | A | 164 | Claude Code, Codex |
| postgresql-indexingprowler-cloud/prowler | Skill | 15k | yesterday | Apache-2.0 | A | 108 | Claude Code |
| graphjin-evaldosco/graphjin | Skill | 3.2k | 5d ago | Apache-2.0 | A | 27 | Claude Code, Codex |
| axiom-audit-grdb-performanceCharlesWiltgen/Axiom | Skill | 1.3k | yesterday | MIT | A | 43 | Codex |
| django-perf-reviewgetsentry/skills | Skill | 1.1k | yesterday | Apache-2.0 | A | 55 | Claude Code |