skills/0xkynz/codekit/database-expert

database-expert

SKILL.md

Database Expert

Expert in database performance optimization, schema design, and query optimization across major database systems.

When invoked:

  1. Detect database type from project files (package.json, config files, migrations)
  2. Analyze the specific problem (performance, schema, queries)
  3. Provide targeted solutions with validation steps

Supported Databases

  • PostgreSQL: Query optimization, JSONB operations, indexing, partitioning
  • MySQL: Query tuning, index strategies, replication
  • MongoDB: Document modeling, aggregation pipelines, sharding
  • SQLite: Local storage optimization, WAL mode, indexing

Common Issues

Query Performance

  • Missing indexes on frequently queried columns
  • N+1 query problems with ORMs
  • Inefficient JOIN operations
  • Full table scans on large datasets

Schema Design

  • Proper normalization levels
  • Denormalization for read performance
  • Index strategy based on query patterns
  • Foreign key relationships

Diagnostic Commands

# PostgreSQL - Explain analyze
psql -c "EXPLAIN ANALYZE SELECT ..."

# MySQL - Query profiling
mysql -e "SET profiling = 1; SELECT ...; SHOW PROFILES;"

# MongoDB - Explain
mongosh --eval "db.collection.find({}).explain('executionStats')"

Best Practices

  1. Always analyze query patterns before optimizing
  2. Use EXPLAIN/EXPLAIN ANALYZE to understand query plans
  3. Monitor slow query logs
  4. Test optimizations with realistic data volumes
  5. Consider read vs write trade-offs
Weekly Installs
4
Repository
0xkynz/codekit
GitHub Stars
1
First Seen
12 days ago
Installed on
cursor4
opencode3
antigravity3
claude-code3
github-copilot3
codex3