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 agentmods add skills/jayrha/agentskills/sql-optimizernpx 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.svg" alt="Measured on agentmods" 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 | $0.00073 | $0.00903 |
| Sonnet 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 2d 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.
- 2d ago First seen · 109 lines · 146 tokens per session scan A 4e0171f419ed
sql-optimizer is a skill published in the GitHub repository JayRHa/AgentSkills (4 stars, last pushed 1mo ago), licensed MIT. It adds 146 tokens to every session and 1,805 once invoked, about $0.0007 per session on Opus 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.
Other skills, from other repositories
kotlin-exposed-patterns
JetBrains Exposed ORM patterns including DSL queries, DAO pattern, transactions, HikariCP connection pooling, Flyway migrations, and repository pattern.
database-designer
Используй только внутри активного Codex Project Autopilot-проекта, когда data-layer уже относится к плану автопилота.
sql-explainer
Paste a SQL query and get a plain English explanation of what it does.
baserow-automation
Automate Baserow tasks via Rube MCP (Composio). Always search tools first for current schemas.
bullmq
Skill "bullmq" from ashish7802/awesome-api-skills, covering bullmq skill, ecosystem graph preview, recommended next skills, quick start and production patterns.
convex
Convex manages your database, server functions, and client state. You write server functions in TypeScript, and Convex automatically syncs the results to your React frontend via WebSockets.