database-performance-auditor
Skill2 starsChanged 7 months agoMITView on GitHub
Audit SQL queries for performance anti-patterns and indexing needs. Use when users share slow queries, query plans (EXPLAIN), or schema DDLs and need optimization advice.
In this repository20 other files it gives its agents.
- api-design-standardizerSkill
- api-documentation-generatorSkill
- cloud-infrastructure-architectSkill
- cobol-to-javaSkill
- code-reviewSkill
- compliance-policy-auditorSkill
- data-cleanupSkill
- incident-post-mortem-generatorSkill
- kaggle-notebook-generatorSkill
- meeting-transcriberSkill
- pdf-extractSkill
- python-structure-generatorSkill
- python-type-hinterSkill
- refactor-simplifySkill
- github-repo-structure-builderSkill
- security-vulnerability-scannerSkill
- sql-query-optimizerSkill
- unit-test-generatorSkill
- user-story-generatorSkill
- web-researchSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 27
Check for: SELECT *, non-SARGABLE WHERE clauses (e.g., WHERE YEAR(date)), Cartesian products, and N+1 patterns.
- Distinctive: line 36
Verify that refactored SQL produces the same result set as the original.
- Distinctive: line 57
IF the schema (table structure) is missing:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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
Database Performance Auditor
Provides expert-level analysis of SQL queries to reduce execution time, resource consumption, and locking contention in enterprise databases.
🎯 When to Use
- User shares a SQL query and reports "It's slow."
- User provides a
DESCRIBEorEXPLAINoutput for analysis. - User needs to refactor legacy SQL for modern performance (e.g., CTEs).
- Do NOT use for basic SQL syntax training or data visualization.
- Do NOT use for NoSQL databases (MongoDB/DynamoDB) unless specifically requested.
🧠 Core Workflow
Step 1 — Ingest & Dialect Detection Detect SQL flavor (PostgreSQL, MySQL, T-SQL, Oracle). Identify primary tables.
Step 2 — Profile Anti-Patterns
Check for: SELECT *, non-SARGABLE WHERE clauses (e.g., WHERE YEAR(date)),
Cartesian products, and N+1 patterns.
Step 3 — Indexing & Refactoring Rules
- SARGability — Rewrite functions in
WHEREto allow index seeks. - Join Optimization — Ensure joins are on indexed keys.
- Modernization — Suggest Window Functions or CTEs to replace subqueries.
Step 4 — Validation Verify that refactored SQL produces the same result set as the original.
Step 5 — Return Output Provide a structured Findings Report (JSON) and the Optimized SQL.
📋 Output Format
Section 1 — Performance Report
{
"dialect": "string",
"critical_bottlenecks": [
{ "issue": "Full Table Scan", "impact": "High", "fix": "Add index on [column]" }
],
"estimated_improvement": "e.g., 50% reduction in IO",
"warnings": ["Potential lock contention on table X"]
}
Section 2 — Optimized SQL
Provide the rewritten query with # OPTIMIZED: comments.⚠️ Fallback Behavior
IF the schema (table structure) is missing:
- WARN that optimization is limited without knowing existing indexes.
- SUGGEST: "Please provide the CREATE TABLE statement for better accuracy."
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
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.

