database-optimization

Guide relational database schema design, indexing, migrations, and query analysis.

1|Updated Dec 14, 2025
One-click install
npx skills add https://github.com/komluk/scaffolding.template --skill database-optimization-komluk
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-optimization
Source: https://github.com/komluk/scaffolding.template/tree/main/stacks/_common/.claude/skills/database-optimization
Command: npx skills add https://github.com/komluk/scaffolding.template --skill database-optimization-komluk

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses common database performance bottlenecks and ensures data integrity through best practices in schema design, indexing, migration safety, and query analysis.

Core Features & Use Cases

  • Schema Design: Guidance on normalization (1NF, 2NF, 3NF) and denormalization for different data types.
  • Indexing Strategy: Recommendations on index types (B-Tree, Hash, GIN) and their appropriate use cases, including when to index and when not to.
  • Migration Safety: Checklist and guidelines for safe database schema changes to prevent data loss or downtime.
  • Query Analysis: Identification of common query issues like missing indexes, N+1 problems, and over-fetching, with solutions.
  • Use Case: Improve slow-running application queries by analyzing their execution plans, adding appropriate indexes, and optimizing table structures.

Quick Start

Analyze the performance of the users table and suggest index improvements.

Frequently Asked Questions about database-optimization

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I optimize slow database queries and analyze execution plans?

Database schema migration safety requires following a strict checklist to prevent data loss or downtime during changes. Safe migration practices ensure data integrity is maintained while applying structural updates to relational databases.

When should I use different index types like B-Tree, Hash, or GIN?

Index type selection depends on your data and query patterns: B-Tree handles standard range queries, Hash manages exact match lookups, and GIN indexes complex data types. Knowing when to index prevents unnecessary overhead.

How do I design a relational database schema using normalization principles?

Async SQLAlchemy setup requires following specific model conventions and patterns to manage database connections non-blocking. This approach ensures reliable concurrent data access in modern asynchronous application architectures.

What is the best way to handle safe database schema migrations with Alembic?

Safe database schema migrations with Alembic require following best practice guidelines to prevent downtime and data loss. Implementing a strict migration checklist ensures relational database integrity during structural updates.