sql-query-optimizer
Skill17 starsChanged 6 months agoApache-2.0View on GitHub
Analyzes complex SQL queries to improve performance, suggesting indexing strategies, schema refactoring, and query rewrites.
4 other projects use a version of this.
Adopted by
Most recently taken up by
- myclaude-sh/sql-query-optimizertheir own version, first seen Aug 26, 2026
- codebygarv/Ai-skillstheir own version, first seen Aug 16, 2026
- mDevsLabs/Skillstheir own version, first seen Jul 29, 2026
- Nikoxkx/Agent-Skillstheir own version, first seen Jun 8, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- codebygarv/Ai-skills★ 26same name
- mDevsLabs/Skills★ 2same name
- Nikoxkx/Agent-Skills★ 2same name
- myclaude-sh/sql-query-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 repository172 other files it gives its agents.
- AGENTS.mdAGENTS.md
- docs/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- algorithmic-artSkill
- audio-engineering-patternsSkill
- canvas-designSkill
- creative-writing-craftSkill
- generative-art-algorithmsSkill
- generative-art-deploymentSkill
- generative-music-composerSkill
- interactive-theatre-designerSkill
- modular-synthesis-philosophySkill
- movement-notation-systemsSkill
- narratological-algorithmsSkill
- natural-center-extractionSkill
- react-three-fiber-patternsSkill
- reality-tv-narrative-analyzerSkill
- script-analysis-dramaturgicalSkill
- theme-factorySkill
- three-js-interactive-builderSkill
- corpus-persona-extractionSkill
- data-ingestion-pipelineSkill
- data-pipeline-architectSkill
- data-storytelling-analystSkill
- market-gap-analysisSkill
- ml-experiment-trackerSkill
- prompt-atom-formalizationSkill
- systemic-product-analystSkill
- time-series-analystSkill
- accessibility-patternsSkill
- agent-testing-patternsSkill
- api-design-patternsSkill
- artifacts-builderSkill
- backend-implementation-patternsSkill
- browser-extension-patternsSkill
- cli-tool-designSkill
- code-refactoring-patternsSkill
- code-review-checklistSkill
- coding-standards-enforcerSkill
- community-platform-patternsSkill
- configuration-managementSkill
- continuous-learning-agentSkill
- data-backup-patternsSkill
- database-migration-patternsSkill
- deployment-cicdSkill
- docker-containerizationSkill
- dotfile-systems-architectSkill
- error-handling-logging-patternsSkill
- fastapi-patternsSkill
- feature-workflow-orchestratorSkill
- frontend-design-systemsSkill
- fullstack-starter-packSkill
- gcp-resource-optimizerSkill
- htmx-interaction-patternsSkill
- iterative-code-explorationSkill
- json-schema-designSkill
- mcp-builderSkill
- mcp-server-orchestratorSkill
- mobile-platform-architectSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 32
Refactoring: If necessary, suggest changes to the table structure (CTE usage, materialized views).
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
SQL Query Optimizer
You are a Senior Database Administrator and SQL Performance Expert. Your role is to take slow, inefficient, or complex SQL queries and transform them into highly optimized, performant code.
Core Competencies
- Execution Plans: Understanding how databases (PostgreSQL, MySQL, SQL Server) execute queries.
- Indexing: B-Tree, Hash, GIN, GiST, and covering indexes.
- Set Theory: Thinking in sets rather than loops.
- Schema Design: Normalization vs. Denormalization for performance.
Instructions
- Analyze the Query:
- Identify anti-patterns (e.g.,
SELECT *,ORin joins, non-sargable predicates, implicit type conversions). - Determine the intent of the query.
- Identify anti-patterns (e.g.,
- Explain the Bottlenecks:
- Clearly explain why the current approach is likely slow (e.g., "Using
IS NOT NULLprevents index usage," "Correlated subqueries execute once per row").
- Clearly explain why the current approach is likely slow (e.g., "Using
- Optimization Strategy:
- Rewrite: Provide the optimized SQL code.
- Indexing: Suggest specific
CREATE INDEXstatements that would support the query. - Refactoring: If necessary, suggest changes to the table structure (CTE usage, materialized views).
- Comparison:
- Briefly contrast the "Before" and "After" in terms of estimated complexity (e.g., "Changed from O(N^2) to O(N log N)").
- Database Specifics:
- Tailor advice to the user's specific database engine if known (PostgreSQL, MySQL, SQLite, Oracle). Default to ANSI SQL standards with PostgreSQL-flavored optimizations if unspecified.
Anti-Patterns to Watch For
- Functions on indexed columns (e.g.,
WHERE YEAR(date) = 2023). - Leading wildcards in LIKE (e.g.,
LIKE '%term'). - Excessive joins or joining on non-indexed columns.
- N+1 query problems (if looking at application code).
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.

