sql-optimizer
Skill1 starsChanged 7 days agoMITView on GitHub
Write, explain, debug, and optimize SQL queries and schemas. Use whenever the user shares SQL, asks why a query is slow, wants help with joins, window functions, CTEs, indexing, or schema design, or pastes an EXPLAIN plan.
11 other projects use a version of this.
Adopted by
Most recently taken up by
- JohnnyQ-commits/aqueduct-data-agenttheir own version, first seen Nov 29, 2026
- imtiazrayhan/agentscamp-librarytheir own version, first seen Nov 16, 2026
- jaskirat1616/grok-skillstheir own version, first seen Nov 1, 2026
- Mathews-Tom/armorytheir own version, first seen Nov 1, 2026
- milad-ahmd/agent-skillstheir own version, first seen Nov 1, 2026
- JayRHa/agent-skillstheir own version, first seen Oct 15, 2026
Used with
Projects with it also use changelog-keeper, 0-template and 8 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
- +7 more from JayRHa
Other versions11 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 11
- Mathews-Tom/armory★ 340same name
- jaskirat1616/grok-skills★ 22same name
- JayRHa/agent-skills★ 12same name
- JayRHa/AgentSkills★ 12same name
- milad-ahmd/agent-skills★ 7same name
- juanlurg/data-science-claude-skills★ 3same name
- JohnnyQ-commits/aqueduct-data-agent★ 2same name
- BleckWolf25/AIToolkit★ 1same name
- imtiazrayhan/agentscamp-library★ 1same name
- minagayid/Agents★ 1same name
1 more not listed
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 repository26 other files it gives its agents.
- adr-writerSkill
- api-design-reviewSkill
- changelog-generatorSkill
- chart-selectorSkill
- code-reviewSkill
- commit-and-pr-writerSkill
- csv-profilerSkill
- debugging-playbookSkill
- docker-best-practicesSkill
- email-drafterSkill
- executive-summarySkill
- incident-postmortemSkill
- meeting-actionsSkill
- okr-writerSkill
- plain-language-editorSkill
- prd-writerSkill
- pre-push-secret-scanSkill
- prompt-improverSkill
- readme-writerSkill
- refactoring-guideSkill
- resume-tailorSkill
- security-reviewSkill
- source-evaluatorSkill
- study-plan-builderSkill
- test-writerSkill
- my-skill-nameSkill
The file
We split this skill into the rules it gives an agent
5 rules. 0 are common, 2 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 9 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Ask which database (PostgreSQL, MySQL, SQLite, BigQuery, SQL Server...) if it changes the answer.
- Distinctive: line 13
Read the plan for: sequential scans on large tables, row estimates far from actuals, nested loops over big sets, sorts spilling to disk, …
- Very specific: line 15
Filter early and select less: avoid SELECT *, push predicates down, limit columns.
- Very specific: line 23
Use explicit JOIN ... ON, meaningful aliases, and CTEs for readability.
- Very specific: line 30
Never run or suggest destructive statements (DELETE, UPDATE, DROP, TRUNCATE) without a WHERE check, a preview SELECT, and a transaction or …
“Common” is measured: kept by at least 6 in 10 of the 9 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
Ask which database (PostgreSQL, MySQL, SQLite, BigQuery, SQL Server...) if it changes the answer. Dialect details matter.
Diagnosing slow queries
- Get the query, schema, row counts, existing indexes, and the EXPLAIN (ANALYZE) output. Do not optimize blind.
- Read the plan for: sequential scans on large tables, row estimates far from actuals, nested loops over big sets, sorts spilling to disk, repeated subplans.
- Apply fixes in this order:
- Filter early and select less: avoid
SELECT *, push predicates down, limit columns. - Index for the access pattern: match WHERE equality columns first, then range, then ORDER BY. Consider composite and covering indexes. Avoid wrapping indexed columns in functions (
WHERE date(created_at) = ...) or leading wildcards. - Rewrite: replace correlated subqueries with joins or window functions,
EXISTSinstead ofINon large sets, avoidORacross different columns (useUNION ALL), avoid implicit type casts. - Schema or data: partitioning, summary tables, archiving, correct data types.
- Filter early and select less: avoid
- State the expected effect and the trade-off (indexes slow writes and use space).
Writing queries
- Use explicit
JOIN ... ON, meaningful aliases, and CTEs for readability. - Watch NULL semantics (
= NULLnever true,NOT INwith NULLs, aggregate behavior). - Guard against join fan-out that inflates counts and sums. Verify with
COUNT(*)vsCOUNT(DISTINCT key). - Be explicit about time zones and half-open date ranges (
>= start AND < end).
Safety
- Never run or suggest destructive statements (
DELETE,UPDATE,DROP,TRUNCATE) without aWHEREcheck, a previewSELECT, and a transaction or backup note. - Parameterize queries; never build SQL by string concatenation with user input.
Output
Provide the improved query, an explanation of what changed and why, suggested indexes as CREATE INDEX statements, and how to confirm the improvement.
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.

