Skip to main content
skill CX Codex

database-optimizer · zebbern — Claude Code skill: what it does, how to install

Analyzes query execution plans, tunes PostgreSQL and MySQL configurations, and designs indexes to help high-traffic databases achieve sub-100ms query latency.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add zebbern/claude-code-guide --skill database-optimizer -a claude-code
Open on GitHub

What database-optimizer does

This skill configures the assistant as a senior database performance engineer with 10+ years of tuning experience. The primary focus is PostgreSQL and MySQL. The agent reviews slow query logs, pg_stat_statements exports, and EXPLAIN ANALYZE plans. This flags sequential scans and missing index coverage under production workloads.

The workflow moves through diagnosis, solution design, and structured validation. When addressing specific bottlenecks, the skill loads dedicated reference guides for index strategies, schema partitioning, InnoDB tuning, and lock contention. Deliverables include specific SQL rewrites alongside database configuration tweaks.

Performance changes are strictly gated. The skill forbids modifying queries or schemas without baseline measurements, and it rejects applying multiple index updates at once. Every optimization requires validation on non-production environments first.

What it helps with

  • Analyze execution plans using EXPLAIN ANALYZE
  • Design covering indexes while minimizing write overhead
  • Resolve deadlock issues and row lock contention
  • Tune configuration parameters for PostgreSQL and MySQL
  • Plan partitioning schemes for large relational tables

Example prompts for the agent

  • Inspect this EXPLAIN ANALYZE output and pinpoint why the query performs poorly
  • Design an indexing strategy for our orders table to target sub-100ms queries
  • Recommend PostgreSQL configuration adjustments to reduce transaction lock contention

How to install database-optimizer

1Skills CLI (Vercel)

npx skills add zebbern/claude-code-guide --skill database-optimizer -a claude-code

2Manually: put the files in place

~/.claude/skills/database-optimizer/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/database-optimizer/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about database-optimizer

How do I install database-optimizer in Claude Code?

Run npx skills add zebbern/claude-code-guide --skill database-optimizer -a claude-code. This installs the skill file directly into your environment.

Which database management systems does this skill target?

The skill specifically covers PostgreSQL and MySQL. It includes focused guides for pg_stat_statements, VACUUM, InnoDB parameters, and query execution plans.

What constraints does the skill follow during tuning?

It mandates baseline performance metrics before any adjustment, requires EXPLAIN analysis, and forbids applying multiple index changes simultaneously.

Source text

SKILL.md · MIT
---
name: database-optimizer
description: 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.
license: MIT
metadata:
  author: https://github.com/Jeffallan
  version: "1.0.0"
  domain: infrastructure
  triggers: database optimization, slow query, query performance, database tuning, index optimization, execution plan, EXPLAIN ANALYZE, database performance, PostgreSQL optimization, MySQL optimization
  role: specialist
  scope: optimization
  output-format: analysis-and-code
  related-skills: devops-engineer
---

# Database Optimizer

Senior database optimizer with expertise in performance tuning, query optimization, and scalability across multiple database systems.

## Role Definition

You are a senior database performance engineer with 10+ years of experience optimizing high-traffic databases. You specialize in PostgreSQL and MySQL optimization, execution plan analysis, strategic indexing, and achieving sub-100ms query performance at scale.

## 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

1. **Analyze Performance** - Review slow queries, execution plans, system metrics
2. **Identify Bottlenecks** - Find inefficient queries, missing indexes, config issues
3. **Design Solutions** - Create index strategies, query rewrites, schema improvements
4. **Implement Changes** - Apply optimizations incrementally with monitoring
5. **Validate Results** - Measure improvements, ensure stability, document changes

## 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        |

## Constraints

### MUST DO

- Analyze EXPLAIN plans before optimizing
- Measure performance before and after changes
- Create indexes strategically (avoid over-indexing)
- Test changes in non-production first
- Document all optimization decisions
- Monitor impact on write performance
- Consider replication lag for distributed systems

### MUST NOT DO

- Apply optimizations without measurement
- Create redundant or unused indexes
- Skip execution plan analysis
- Ignore write performance impact
- Make multiple changes simultaneously
- Optimize without understanding query patterns
- Neglect statistics updates (ANALYZE/VACUUM)

## Output Templates

When optimizing database performance, provide:

1. Performance analysis with baseline metrics
2. Identified bottlenecks and root causes
3. Optimization strategy with specific changes
4. Implementation SQL/config changes
5. Validation queries to measure improvement
6. Monitoring recommendations

## Knowledge Reference

PostgreSQL (pg_stat_statements, EXPLAIN ANALYZE, indexes, VACUUM, partitioning), MySQL (slow query log, EXPLAIN, InnoDB, query cache), query optimization, index design, execution plans, configuration tuning, replication, sharding, caching strategies

© https://github.com/Jeffallan · MIT · zebbern/claude-code-guide

Similar skills

All skills for Data and databases →

database-optimizer by other authors comes first.

database-optimizer https://github.com/Jeffallan Investigates slow PostgreSQL and MySQL queries, breaks down execution plans with EXPLAIN ANALYZE, and drafts indexes without table locks. CX Codex +1 6,000installs database-optimizer davila7 A Claude skill that digs into database bottlenecks: execution plans, indexes, N+1, caching and partitioning. Useful when queries are slow and the reason isn't obvious. 286installs xlsx official anthropics Creates, reads, edits, and converts spreadsheet files. Use it when the requested deliverable is an Excel workbook or another tabular file. 187,223installs google-agents-cli-observability official Google This skill guides you through tracing and monitoring AI agents, including ADK agents. Use it when you need to inspect agent execution or monitor a deployed agent. CX Codex +1 511,300installs caveman-evidence-review JuliusBrussee A read-only skill reviews Caveman Cloud evidence on LLM spend, traces, and routing. Use it to see where a project’s model budget goes. CX Codex +1 104,500installs migration JuliusBrussee Enforces reversible, compatibility-safe transitions for schema, data, and API updates. Useful whenever data loss or rollout downtime is unacceptable. CX Codex +1 103,900installs performance-optimization addyosmani An agent skill that measures before it changes code: Core Web Vitals budgets, N+1 queries, missing indexes and slow endpoints. CX Codex +1 65,200installs supabase official supabase Guides the agent through database configuration and strict RLS policies in Supabase. CX Codex GP ChatGPT 8installs

From the same set40

dev-guide-generator Turns a technical topic into a full tutorial: prerequisites, environment setup, core steps, error troubleshooting and a closing cheatsheet. CX Codex +1 ★ 4,679repo stars deep-module-refactor Inspects your codebase for shallow modules, drafts deeper alternative interfaces with sub-agents, and files a refactor RFC directly to GitHub Issues. CX Codex +1 ★ 4,679repo stars dataset-quality-audit Audit tabular files for missing values, duplicates, outliers, and format problems. Use it to assess a dataset before analysis or reuse. CX Codex +1 ★ 4,679repo stars database-scout A read-only skill for SQLite and PostgreSQL: lists tables, inspects schemas, previews rows and renders Mermaid ER diagrams. Queries stay read-only. CX Codex +1 ★ 4,679repo stars data-viz-renderer Turn JSON data into standalone HTML/SVG infographics, from metric cards to process diagrams. Use it to build report visuals or combine metrics and charts in a dashboard. CX Codex +1 ★ 4,679repo stars cv-tailor This skill compares your resume against a job description, scores keyword coverage, and rewrites experience bullets with STAR and numbers. CX Codex +1 ★ 4,679repo stars code-vuln-audit Scans source code for hardcoded secrets, package vulnerabilities, and OWASP anti-patterns. Helpful before shipping changes or publishing repositories. CX Codex +1 ★ 4,679repo stars code-to-diagram This skill maps imports in a codebase and produces architecture diagrams, flowcharts, and file hierarchies. Use it before review, documentation, or refactoring. CX Codex +1 ★ 4,679repo stars

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor