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 khalilbenaz/claude-skills-collection --skill database-query-optimizergit clone --depth 1 https://github.com/khalilbenaz/claude-skills-collectionWrote 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/khalilbenaz/claude-skills-collection/database-query-optimizer)<a href="https://agentmods.dev/skills/khalilbenaz/claude-skills-collection/database-query-optimizer"><img src="https://agentmods.dev/badge/skills/khalilbenaz/claude-skills-collection/database-query-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.
<a href="https://agentmods.dev/skills/khalilbenaz/claude-skills-collection/database-query-optimizer"><img src="https://agentmods.dev/badge/skills/khalilbenaz/claude-skills-collection/database-query-optimizer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector pass
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.00099 | $0.02006 |
| Opus 5.5 | $0.00040 | $0.00802 |
| Sonnet 5.5 | $0.00020 | $0.00401 |
| Haiku 4.5 | $0.00010 | $0.00201 |
Grade A, and why
database-query-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 2mo 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.
How it starts
The opening of the file, as written. The whole thing — 207 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Database Query Optimizer
Étape 1 — Collecte d'informations
Demande systématiquement (ne suppose rien) :
- SGBD et version : PostgreSQL 16, MySQL 8, SQL Server 2022, MongoDB 7, SQLite…
- Requête complète (pas un résumé, le SQL brut)
- Schéma : colonnes, types, index existants (
\d tablePG,SHOW CREATE TABLEMySQL) - Volume : lignes dans les tables concernées (ordre de grandeur suffit)
- Temps mesuré : durée actuelle, cible souhaitée, outil de mesure
- Contexte d'exécution : fréquence, OLTP vs OLAP, connexions concurrentes
Étape 2 — Diagnostic avec EXPLAIN
PostgreSQL / MySQL / SQLite
-- PostgreSQL : plan + exécution réelle
EXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT) <requête>;
-- MySQL
EXPLAIN FORMAT=JSON <requête>;
SHOW STATUS LIKE 'Last_Query_Cost';
-- SQL Server
SET STATISTICS IO, TIME ON;
<requête>;
-- ou via SSMS : Query > Include Actual Execution Plan
Signaux d'alarme dans le plan
| Signal | Signification | Priorité |
|---|---|---|
Seq Scan sur grande table |
Pas d'index utilisable | Critique |
Hash Join + rows estimés très faux |
Statistiques obsolètes | Élevée |
Nested Loop × millions de rows |
Potentiel N+1 ou jointure cartésienne | Critique |
Sort sans Index Scan |
Manque d'index sur ORDER BY | Modérée |
cost=... très élevé vs actual rows faibles |
Mauvaise estimation selectivité | Élevée |
rows=1 partout mais slow |
Problème réseau / lock / cache miss | Variable |
Mettre à jour les statistiques
-- PostgreSQL
ANALYZE table_name;
-- MySQL
ANALYZE TABLE table_name;
-- SQL Server
UPDATE STATISTICS table_name;
Étape 3 — Optimisations concrètes
3.1 Index manquants
-- Créer un index couvrant (covering index) : évite un table lookup
CREATE INDEX CONCURRENTLY idx_orders_user_status
ON orders (user_id, status)
INCLUDE (created_at, total_amount); -- PostgreSQL 11+
-- Index partiel : si requête filtre toujours sur une valeur
CREATE INDEX idx_orders_pending
ON orders (created_at)
WHERE status = 'pending';
-- Index composite : ordre des colonnes = sélectivité décroissante
-- Bon : (user_id, status) -- user_id très sélectif
-- Mauvais : (status, user_id) -- status peu sélectif en tête
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.
- 2mo ago First seen · 207 lines · 99 tokens per session scan A f7491377e958
database-query-optimizer is a skill published in the GitHub repository khalilbenaz/claude-skills-collection (27 stars, last pushed 3mo ago), licensed MIT. It adds 99 tokens to every session and 2,006 once invoked, about $0.0004 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-09-03.
database-query-optimizer compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| database-query-optimizerkhalilbenaz/claude-skills-collection | Skill | 27 | 3mo ago | MIT | A | 99 | Claude Code, Codex |
| frappe-errors-databaseImpertio-Studio/Frappe_Claude_Skill_Package | Skill | 212 | 2mo ago | none | A | 142 | Claude Code, Codex |
| sql-optimization-patternswshobson/agents | Skill | 43k | yesterday | MIT | A | 44 | Claude Code |
| muse_dbasgeirtj/system_prompts_leaks | Skill | 74k | 2d ago | CC0-1.0 | A | 0 | Claude Code, Codex |
| optimizeFlorianBruniaux/claude-code-ultimate-guide | Skill | 7.6k | yesterday | CC-BY-SA-4.0 | A | 15 | Claude Code |
| database-patternssoftspark/ai-toolkit | Skill | 180 | 13d ago | Apache-2.0 | A | 55 | Claude Code |
| debugsoftspark/ai-toolkit | Skill | 180 | 13d ago | Apache-2.0 | A | 34 | Claude Code |