sql-optimizer
Skill5 starsChanged 14 days agoMITView on GitHub
Explains slow SQL queries in plain English, reads EXPLAIN plans, and suggests concrete rewrites and indexes for PostgreSQL, MySQL, and SQLite, including ORM-generated N+1 problems. Use when the user shares a slow query, an EXPLAIN output, asks why a query is slow, or wants index recommendations.
8 other projects use a version of this.
Adopted by
Most recently taken up by
- jaskirat1616/grok-skillstheir own version, first seen Nov 1, 2026
- Mathews-Tom/armorytheir own version, first seen Nov 1, 2026
- JayRHa/agent-skillstheir own version, first seen Oct 15, 2026
- minagayid/Agentstheir own version, first seen Jul 5, 2026
- BleckWolf25/AIToolkittheir own version, first seen Jul 4, 2026
- Viprasol-Tech/sql-optimizertheir own version, first seen Jun 14, 2026
Used with
Projects with it also use changelog-keeper, 0-template and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
JayRHaSkillchangelog-keeper
Maintains a CHANGELOG.md in the Keep a Changelog format with Semantic Versioning, grouping user-facing entries under Added/Changed/Deprecated/Removed/Fixed/Security and cutting dated releases from an Unreleased section. Use this skill when the user asks to "update the changelog", "add a changelog entry", "cut a release", "bump the version", "what changed since the last release", or to create/clean up a CHANGELOG.md or release notes.
Also in 4 projects that use this
JayRHaSkill0-template
Template for creating a new Agent Skill. Copy this folder, rename it to your skill's kebab-case name, and fill in every section. Use this as the starting point whenever you author a new skill for the AgentSkills library.
Also in 3 projects that use this
xmqywxSkillmeeting-summarizer
Transform meeting transcripts into structured summaries with action items, decisions, follow-ups, and efficiency analysis. Works with any meeting format.
Also in 3 projects that use this
MehdibargachSkillokr-writer
Turn business goals into structured OKRs with measurable Key Results, linked initiatives, alignment check, and anti-goals. Takes a strategic priority and outputs ready-to-use OKRs.
Also in 3 projects that use this
pbc-osSkillsecrets-manager
Set up and configure cloud secrets management for your AI agent. Guides users through platform selection (GCP, AWS, Azure, 1Password, Doppler, HashiCorp Vault), account setup, CLI configuration, and secure credential storage.
Also in 3 projects that use this
- +7 more from JayRHa
Other versions8 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 8
- Mathews-Tom/armory★ 340same name
- jaskirat1616/grok-skills★ 22same name
- JayRHa/agent-skills★ 12same name
- JayRHa/AgentSkills★ 12same name
- juanlurg/data-science-claude-skills★ 3same name
- BleckWolf25/AIToolkit★ 1same name
- minagayid/Agents★ 1same name
- Viprasol-Tech/sql-optimizer★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository56 other files it gives its agents.
- docs/llms.txtllms.txt
- a11y-fixerSkill
- ad-copy-generatorSkill
- agent-guardrailsSkill
- agent-memory-keeperSkill
- ai-slop-detectorSkill
- api-to-sdkSkill
- app-store-optimizerSkill
- architecture-doctorSkill
- brand-voice-guideSkill
- bug-detectiveSkill
- changelog-from-gitSkill
- codebase-explainerSkill
- codebase-time-machineSkill
- commit-craftSkill
- competitor-spySkill
- content-repurposerSkill
- cost-cutterSkill
- demo-recorderSkill
- dependency-doctorSkill
- dockerize-anythingSkill
- durable-agent-workflowsSkill
- e2e-flow-testerSkill
- email-campaign-writerSkill
- env-secrets-guardSkill
- gh-actions-auditorSkill
- hook-generatorSkill
- incident-commanderSkill
- influencer-outreachSkill
- instagram-growth-managerSkill
- landing-page-roasterSkill
- launch-post-writerSkill
- meeting-notes-to-ticketsSkill
- merge-conflict-resolverSkill
- migration-wizardSkill
- plan-grillerSkill
- prompt-injection-scannerSkill
- pr-reviewer-proSkill
- readme-glow-upSkill
- roast-my-githubSkill
- screenshot-to-componentSkill
- seo-blog-writerSkill
- skill-creator-proSkill
- skill-finderSkill
- skills-doctorSkill
- social-analytics-reporterSkill
- social-media-calendarSkill
- social-media-managerSkill
- startup-idea-validatorSkill
- tdd-loopSkill
- terse-modeSkill
- test-gap-hunterSkill
- tiktok-viral-creatorSkill
- ui-tasteSkill
- youtube-script-writerSkill
- youtube-seo-optimizerSkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 1 is distinctive, and 2 are very specific to this project.
0
Common
Most of the 8 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 38
Prefer query rewrites before adding indexes.
- Very specific: line 39
Consider partial indexes (WHERE deleted_at IS NULL), covering indexes (INCLUDE) and expression indexes.
- Very specific: line 41
Use CONCURRENTLY (Postgres) or online DDL for production tables, and ship index changes as a migration in the project's migration tool.
“Common” is measured: kept by at least 6 in 10 of the 8 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
SQL Optimizer
Turn "this query takes 8 seconds" into a measured fix.
1. Understand
- Identify the engine and version, then explain in plain English what the query returns.
- Gather the schema: the tables, the indexes (
\d tablein Postgres,SHOW INDEX FROM tin MySQL) and rough row counts. - Get the real plan. Ask before running anything against production:
- Postgres:
EXPLAIN (ANALYZE, BUFFERS) <query>. Note that ANALYZE executes the query, so wrap writes inBEGIN; ... ROLLBACK;. - MySQL:
EXPLAIN ANALYZE <query>(8.0.18+) orEXPLAIN FORMAT=JSON. - SQLite:
EXPLAIN QUERY PLAN <query>.
- Postgres:
2. Diagnose. Common culprits:
- Seq scan or full table scan on a large table with a selective filter → missing index.
- Functions or casts on indexed columns (
WHERE lower(email) = ...,WHERE created_at::date = ...) → not sargable. - Leading wildcard
LIKE '%x',ORacross different columns, orNOT INwith NULLs. - Large estimate-vs-actual row mismatches → stale statistics (
ANALYZE). SELECT *on wide tables, unnecessaryDISTINCT, orORDER BYwith no supporting index plusLIMIT.- Deep
OFFSETpagination → use keyset pagination. - Correlated subqueries → use JOIN or
EXISTS; also look for an N+1 pattern in ORM code (loops that issue queries).
3. Recommend
For each fix give: the change, why it helps, the expected plan change and the trade-offs.
-- Composite index: equality columns first, then range/sort columns
CREATE INDEX CONCURRENTLY idx_orders_user_created ON orders (user_id, created_at DESC);- Prefer query rewrites before adding indexes. Every index slows down writes and uses storage.
- Consider partial indexes (
WHERE deleted_at IS NULL), covering indexes (INCLUDE) and expression indexes. - For ORMs, show the fix in the ORM's own syntax: eager loading (
include,select_related,preload) and selecting only the needed columns. - Use
CONCURRENTLY(Postgres) or online DDL for production tables, and ship index changes as a migration in the project's migration tool.
4. Verify
Compare the plan and timing before and after the change. Never claim a speedup you didn't measure; label unmeasured numbers as estimates.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

