database-optimizer
Skill0 starsChanged 11 months agoMITView on GitHub
Optimizes database queries and improves performance across PostgreSQL and MySQL systems. Use when investigating slow queries, analyzing execution plans, or optimizing database performance. Invoke for index design, query rewrites, configuration tuning, partitioning strategies, lock contention resolution.
25 other projects use a version of this, 9 of them edited.
Adopted by
Most recently taken up by
- santiago-migoni/claude-skillsword for word, first seen Nov 8, 2026
- AxlZero21/Skillsword for word, first seen Nov 8, 2026
- codeApe-7/ai-agent-workflowGroupedited, first seen Nov 1, 2026
- zebbern/claude-code-guideedited, first seen Oct 30, 2026
- hu465/claude-skills-word for word, first seen Oct 25, 2026
- saksham-techlabs/ai-builder-skills-packtheir own version, first seen Oct 25, 2026
Other versions25 projects use a version of this.
Word for word · 4
- Jeffallan/claude-skills★ 12k100% same
- AxlZero21/Skills★ 1100% same
- hu465/claude-skills-★ 0100% same
- santiago-migoni/claude-skills★ 0100% same
Edited · 9
- zebbern/claude-code-guide★ 4.7k54% same
- codeApe-7/ai-agent-workflowGroup★ 1899% same
- PIXARTSeu/Synapse★ 999% same
- HK-hub/AgentSkills★ 699% same
- megastep/codex-skills★ 445% same
- zacklecon/claude-skills★ 354% same
- james-paul25/claude-skill★ 099% same
- trodix/claude-skills★ 095% same
- usmanmubarak1/ClaudeSkilledAgents★ 050% same
Wrote their own version · 12
- jshsakura/awesome-opencode-skills★ 30same name
- belokonm/claude-supercode-skills★ 11same name
- xfstudio/skills★ 9same name
- iwritec0de/app-dev★ 3same name
- ai4brands-design/claude-skills★ 2same name
- bcastelino/agent-skills-kit★ 2same name
- Ghosteken/agent-harness★ 2same name
- lschGSL/claude_code_template★ 1same name
- mmondora/claude-skills★ 1same name
- lodetomasi/claude-code-skills-tools★ 0same name
2 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 repository67 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- angular-architectSkill
- api-designerSkill
- architecture-designerSkill
- atlassian-mcpSkill
- chaos-engineerSkill
- cli-developerSkill
- cloud-architectSkill
- code-documenterSkill
- code-reviewerSkill
- cpp-proSkill
- csharp-developerSkill
- debugging-wizardSkill
- devops-engineerSkill
- django-expertSkill
- django-storages-s3Skill
- dotnet-core-expertSkill
- embedded-systemsSkill
- fastapi-expertSkill
- feature-forgeSkill
- fine-tuning-expertSkill
- flutter-expertSkill
- fullstack-guardianSkill
- game-developerSkill
- golang-proSkill
- graphql-architectSkill
- java-architectSkill
- javascript-proSkill
- kotlin-specialistSkill
- kubernetes-specialistSkill
- laravel-specialistSkill
- legacy-modernizerSkill
- mcp-developerSkill
- microservices-architectSkill
- ml-pipelineSkill
- monitoring-expertSkill
- nestjs-expertSkill
- nextjs-developerSkill
- pandas-proSkill
- php-proSkill
- playwright-expertSkill
- postgres-proSkill
- prompt-engineerSkill
- python-proSkill
- rag-architectSkill
- rails-expertSkill
- react-expertSkill
- react-native-expertSkill
- rust-engineerSkill
- salesforce-developerSkill
- secure-code-guardianSkill
- security-reviewerSkill
- shopify-expertSkill
- spark-engineerSkill
- spec-minerSkill
- spring-boot-engineerSkill
- sql-proSkill
- sre-engineerSkill
- swift-expertSkill
- terraform-engineerSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
6 rules. 0 are common, 4 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 19 edited versions we read keep these.
4
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
- Very specific: line 128
Create indexes with CONCURRENTLY (PostgreSQL) to avoid table locks
- Distinctive: line 129
Test in non-production; roll back if write performance or replication lag worsens
- Distinctive: line 130
Document all optimization decisions with before/after metrics
- Very specific: line 131
Run ANALYZE after bulk data changes to refresh statistics
- Distinctive: line 135
Create redundant or unused indexes
- Distinctive: line 142
When optimizing database performance, provide:
“Common” is measured: kept by at least 6 in 10 of the 19 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
Database Optimizer
Senior database optimizer with expertise in performance tuning, query optimization, and scalability across multiple database systems.
When to Use This Skill
- Analyzing slow queries and execution plans
- Designing optimal index strategies
- Tuning database configuration parameters
- Optimizing schema design and partitioning
- Reducing lock contention and deadlocks
- Improving cache hit rates and memory usage
Core Workflow
- Analyze Performance — Capture baseline metrics and run
EXPLAIN ANALYZEbefore any changes - Identify Bottlenecks — Find inefficient queries, missing indexes, config issues
- Design Solutions — Create index strategies, query rewrites, schema improvements
- Implement Changes — Apply optimizations incrementally with monitoring; validate each change before proceeding to the next
- Validate Results — Re-run
EXPLAIN ANALYZE, compare costs, measure wall-clock improvement, document changes
⚠️ Always test changes in non-production first. Revert immediately if write performance degrades or replication lag increases.
Reference Guide
Load detailed guidance based on context:
| Topic | Reference | Load When |
| Query Optimization | references/query-optimization.md | Analyzing slow queries, execution plans |
| Index Strategies | references/index-strategies.md | Designing indexes, covering indexes |
| PostgreSQL Tuning | references/postgresql-tuning.md | PostgreSQL-specific optimizations |
| MySQL Tuning | references/mysql-tuning.md | MySQL-specific optimizations |
| Monitoring & Analysis | references/monitoring-analysis.md | Performance metrics, diagnostics |
Common Operations & Examples
Identify Top Slow Queries (PostgreSQL)
-- Requires pg_stat_statements extension
SELECT query,
calls,
round(total_exec_time::numeric, 2) AS total_ms,
round(mean_exec_time::numeric, 2) AS mean_ms,
round(stddev_exec_time::numeric, 2) AS stddev_ms,
rows
FROM pg_stat_statements
ORDER BY mean_exec_time DESC
LIMIT 20;Capture an Execution Plan
-- Use BUFFERS to expose cache hit vs. disk read ratio
EXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT)
SELECT o.id, c.name
FROM orders o
JOIN customers c ON c.id = o.customer_id
WHERE o.status = 'pending'
AND o.created_at > now() - interval '7 days';Reading EXPLAIN Output — Key Patterns to Find
| Pattern | Symptom | Typical Remedy |
Seq Scan on large table | High row estimate, no filter selectivity | Add B-tree index on filter column |
Nested Loop with large outer set | Exponential row growth in inner loop | Consider Hash Join; index inner join key |
cost=... rows=1 but actual rows=50000 | Stale statistics | Run ANALYZE <table>; |
Buffers: hit=10 read=90000 | Low buffer cache hit rate | Increase shared_buffers; add covering index |
Sort Method: external merge | Sort spilling to disk | Increase work_mem for the session |
Create a Covering Index
-- Covers the filter AND the projected columns, eliminating a heap fetch
CREATE INDEX CONCURRENTLY idx_orders_status_created_covering
ON orders (status, created_at)
INCLUDE (customer_id, total_amount);Validate Improvement
-- Before optimization: save plan & timing
EXPLAIN (ANALYZE, BUFFERS) <query>; -- note "Execution Time: X ms"
-- After optimization: compare
EXPLAIN (ANALYZE, BUFFERS) <query>; -- target meaningful reduction in cost & time
-- Confirm index is actually used
SELECT indexname, idx_scan, idx_tup_read, idx_tup_fetch
FROM pg_stat_user_indexes
WHERE relname = 'orders';MySQL: Find Slow Queries
-- Inspect slow query log candidates
SELECT * FROM performance_schema.events_statements_summary_by_digest
ORDER BY SUM_TIMER_WAIT DESC
LIMIT 20;
-- Execution plan
EXPLAIN FORMAT=JSON
SELECT * FROM orders WHERE status = 'pending' AND created_at > NOW() - INTERVAL 7 DAY;Constraints
MUST DO
- Capture
EXPLAIN (ANALYZE, BUFFERS)output before optimizing — this is the baseline - Measure performance before and after every change
- Create indexes with
CONCURRENTLY(PostgreSQL) to avoid table locks - Test in non-production; roll back if write performance or replication lag worsens
- Document all optimization decisions with before/after metrics
- Run
ANALYZEafter bulk data changes to refresh statistics
MUST NOT DO
- Apply optimizations without a measured baseline
- Create redundant or unused indexes
- Make multiple changes simultaneously (impossible to attribute impact)
- Ignore write amplification caused by new indexes
- Neglect
VACUUM/ statistics maintenance
Output Templates
When optimizing database performance, provide:
- Performance analysis with baseline metrics (query time, cost, buffer hit ratio)
- Identified bottlenecks and root causes (with EXPLAIN evidence)
- Optimization strategy with specific changes
- Implementation SQL / config changes
- Validation queries to measure improvement
- Monitoring recommendations
Maintained by @jeffallan, Principal Consultant at Synergetic Solutions
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.

