database-optimizer
Optimizes database queries and improves performance across PostgreSQL and MySQL systems.
Skill by https://github.com/Jeffallan
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/jeffallan-database-optimizer
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: design, backend
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/database-optimizer
What's inside
- Skill name
database-optimizer- Description
- 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.
- License
- MIT
- Metadata
- role: specialist · scope: optimization · author: https://github.com/Jeffallan · domain: infrastructure · company: https://synergetic.solutions · version: 1.1.1 · triggers: database optimization, slow query, query performance, database tuning, index optimization, execution plan, EXPLAIN ANALYZE, database performance, PostgreSQL optimization, MySQL optimization · output-format: analysis-and-code · related-skills: devops-engineer, postgres-pro, graphql-architect
- Instructions
- 138 lines in SKILL.md · view on GitHub
Files (6)
- SKILL.md
- index-strategies.md · references/
- monitoring-analysis.md · references/
- mysql-tuning.md · references/
- postgresql-tuning.md · references/
- query-optimization.md · references/
SKILL.md (first lines)
# 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
1. **Analyze Performance** — Capture baseline metrics and run `EXPLAIN ANALYZE` before any changes
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; validate each change before proceeding to the next
5. **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)
```sql
-- 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
```sql
-- 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
```sql
-- 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
```sql
-- 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
```sql
-- 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 `ANALYZE` after bulk data changes to refresh statistics
### MUST NOT DO
- Apply optimizations without a measured baseline
- Create redundant or unused indexesFrom Jeffallan/claude-skills, MIT.
More from Jeffallan/claude-skills
- 0.862score
django-storages-s3
https://github.com/awais786
Use when configuring Django to store static and media files on AWS S3 with django-storages.
SkillAFreshness: A★ 12KClaude Code +9 - 0.697score
code-documenter
https://github.com/Jeffallan
Generates, formats, and validates technical documentation — including docstrings, OpenAPI/Swagger specs, JSDoc annotations, doc portals, and user guides.
SkillAFreshness: A★ 12KClaude Code +9 - 0.697score
api-designer
https://github.com/Jeffallan
Use when designing REST or GraphQL APIs, creating OpenAPI specifications, or planning API architecture.
SkillAFreshness: A★ 12KClaude Code +9 - 0.697score
spec-miner
https://github.com/Jeffallan
Reverse-engineering specialist that extracts specifications from existing codebases.
SkillAFreshness: A★ 12KClaude Code +9 - 0.697score
cpp-pro
https://github.com/Jeffallan
Writes, optimizes, and debugs C++ applications using modern C++20/23 features, template metaprogramming, and high-performance systems techniques.
SkillAFreshness: A★ 12KClaude Code +9 - 0.697score
angular-architect
https://github.com/Jeffallan
Generates Angular 17+ standalone components, configures advanced routing with lazy loading and guards, implements NgRx state management, applies RxJS…
SkillAFreshness: A★ 12KClaude Code +9 - 0.697score
fullstack-guardian
https://github.com/Jeffallan
Builds security-focused full-stack web applications by implementing integrated frontend and backend components with layered security at every level.
SkillAFreshness: A★ 12KClaude Code +9 - 0.697score
architecture-designer
https://github.com/Jeffallan
Use when designing new high-level system architecture, reviewing existing designs, or making architectural decisions.
SkillAFreshness: A★ 12KClaude Code +9 - 0.697score
atlassian-mcp
https://github.com/Jeffallan
Integrates with Atlassian products to manage project tracking and documentation via MCP protocol.
SkillAFreshness: A★ 12KClaude Code +9 - 0.697score
chaos-engineer
https://github.com/Jeffallan
Designs chaos experiments, creates failure injection frameworks, and facilitates game day exercises for distributed systems — producing runbooks, experiment…
SkillAFreshness: A★ 12KClaude Code +9 - 0.697score
cli-developer
https://github.com/Jeffallan
Use when building CLI tools, implementing argument parsing, or adding interactive prompts.
SkillAFreshness: A★ 12KClaude Code +9 - 0.697score
cloud-architect
https://github.com/Jeffallan
Designs cloud architectures, creates migration plans, generates cost optimization recommendations, and produces disaster recovery strategies across AWS…
SkillAFreshness: A★ 12KClaude Code +9
Compare and alternatives
Featured in
Signals
- Stars
- 12,039
- Forks
- 1,151
- Open issues
- 32
- Last commit (this folder)
- Oct 3, 2026 (24 days ago)
- Last release
- Oct 16, 2026 (11 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- Version
- 1.1.1
- License
- MIT
- Repository
- github.com/Jeffallan/claude-skills
- Website
- jarvisaios.vercel.app
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
Same skill elsewhere
Copies of this SKILL.md published by others; search shows only one of them.
- 0.290score
database-optimizer
https://github.com/Jeffallan
Optimizes database queries and improves performance across PostgreSQL and MySQL systems.
SkillBFreshness: B★ 11Claude Code +9 - 0.233score
database-optimizer
https://github.com/Jeffallan
Optimizes database queries and improves performance across PostgreSQL and MySQL systems.
SkillCFreshness: CClaude Code +9 - 0.212score
database-optimizer
https://github.com/Jeffallan
Optimizes database queries and improves performance across PostgreSQL and MySQL systems.
SkillDFreshness: D★ 1Claude Code +9
More from https://github.com/Jeffallan
- 0.697score
angular-architect
https://github.com/Jeffallan
Generates Angular 17+ standalone components, configures advanced routing with lazy loading and guards, implements NgRx state management, applies RxJS…
SkillAFreshness: A★ 12KClaude Code +9 - 0.697score
spec-miner
https://github.com/Jeffallan
Reverse-engineering specialist that extracts specifications from existing codebases.
SkillAFreshness: A★ 12KClaude Code +9 - 0.697score
cpp-pro
https://github.com/Jeffallan
Writes, optimizes, and debugs C++ applications using modern C++20/23 features, template metaprogramming, and high-performance systems techniques.
SkillAFreshness: A★ 12KClaude Code +9 - 0.697score
code-documenter
https://github.com/Jeffallan
Generates, formats, and validates technical documentation — including docstrings, OpenAPI/Swagger specs, JSDoc annotations, doc portals, and user guides.
SkillAFreshness: A★ 12KClaude Code +9 - 0.697score
fullstack-guardian
https://github.com/Jeffallan
Builds security-focused full-stack web applications by implementing integrated frontend and backend components with layered security at every level.
SkillAFreshness: A★ 12KClaude Code +9 - 0.697score
api-designer
https://github.com/Jeffallan
Use when designing REST or GraphQL APIs, creating OpenAPI specifications, or planning API architecture.
SkillAFreshness: A★ 12KClaude Code +9
Cite this page
database-optimizer skill. Agent Mart. https://agentmart.dev/skills/jeffallan-database-optimizer (last updated 2026-10-24)