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 JayRHa/AgentSkills --skill sql-optimizergit clone --depth 1 https://github.com/JayRHa/AgentSkillsWrote 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/jayrha/agentskills/sql-optimizer)<a href="https://agentmods.dev/skills/jayrha/agentskills/sql-optimizer"><img src="https://agentmods.dev/badge/skills/jayrha/agentskills/sql-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/jayrha/agentskills/sql-optimizer"><img src="https://agentmods.dev/badge/skills/jayrha/agentskills/sql-optimizer.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.00146 | $0.01805 |
| Opus 5.5 | $0.00058 | $0.00722 |
| Sonnet 5.5 | $0.00029 | $0.00361 |
| Haiku 4.5 | $0.00015 | $0.00180 |
Grade A, and why
sql-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 3mo 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 — 109 lines — stays where its author put it; the contents beside it link to each section on GitHub.
SQL Optimizer
Overview
This skill turns "this query is slow" into a concrete, evidence-driven fix. It reads execution plans, identifies the dominant cost, proposes the smallest effective change (index, rewrite, schema, or config), and verifies the improvement with before/after measurements.
Keywords: slow query, EXPLAIN, EXPLAIN ANALYZE, query plan, seq scan, full table scan, index, covering index, composite index, query rewrite, sargable, N+1, timeout, high cost, cardinality, statistics, ANALYZE, query tuning, database performance, PostgreSQL, MySQL, SQL Server, Oracle, SQLite.
Golden rule: measure, change one thing, measure again. Never guess. Never add an index without reading the plan first.
Process
Follow these steps in order. Do not skip step 1 or 2.
-
Gather context. Identify: the engine + version, the exact query (with real-ish parameters, not placeholders), table row counts, existing indexes, and how the query is run (ORM? prepared statement? batch?). If any are missing, ask or inspect the schema. See
references/dialect-cheatsheet.mdfor how to collect each per engine. -
Capture the real plan. Run the engine's analyze form to get actual timing and row counts, not just estimates:
- PostgreSQL:
EXPLAIN (ANALYZE, BUFFERS, VERBOSE, FORMAT TEXT) <query>; - MySQL 8+/MariaDB:
EXPLAIN ANALYZE <query>;(orEXPLAIN FORMAT=JSON) - SQL Server:
SET STATISTICS IO, TIME ON;+ Actual Execution Plan - Oracle:
EXPLAIN PLAN FOR ...; SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY);thenDBMS_XPLAN.DISPLAY_CURSOR(FORMAT=>'ALLSTATS LAST') - SQLite:
EXPLAIN QUERY PLAN <query>;Wrap writes (UPDATE/DELETE) in a transaction you roll back, or test on a SELECT-shaped copy.
- PostgreSQL:
-
Find the dominant cost. Read the plan bottom-up / inner-most-first. Locate the node with the largest
actual time×loops(PostgreSQL) or highest cost/rows. Compare estimated vs actual rows — a large mismatch (>10x) means stale statistics or a bad predicate estimate. Use the diagnosis table inreferences/plan-reading.md.
What ships with it
7 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
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.
- 3mo ago First seen · 109 lines · 146 tokens per session scan A 4e0171f419ed
sql-optimizer is a skill published in the GitHub repository JayRHa/AgentSkills (12 stars, last pushed 4mo ago), licensed MIT. It adds 146 tokens to every session and 1,805 once invoked, about $0.0006 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.
sql-optimizer compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| sql-optimizerJayRHa/AgentSkills | Skill | 12 | 4mo ago | MIT | A | 146 | Claude Code, Codex |
| sql-explainermergisi/awesome-openclaw-agents | Skill | 4.1k | 1mo ago | MIT | A | 20 | Claude Code, Codex |
| postgres-prozacklecon/claude-skills | Skill | 3 | 1mo ago | MIT | A | 41 | Claude Code, Codex |
| sql-prozacklecon/claude-skills | Skill | 3 | 1mo ago | MIT | A | 37 | Claude Code, Codex |
| database-optimizerzacklecon/claude-skills | Skill | 3 | 1mo ago | MIT | A | 39 | Claude Code, Codex |
| postgresql-table-designwshobson/agents | Skill | 43k | 3d ago | MIT | A | 37 | Claude Code |
| rag-pineconedavila7/claude-code-templates | Skill | 35k | today | MIT | A | 65 | Claude Code, Codex |