database-design

Automate database schema design, migrations, and query-optimization planning for PostgreSQL and MySQL.

32|5|Updated Oct 19, 2025
One-click install
npx skills add https://github.com/akaszubski/autonomous-dev --skill database-design
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-design
Source: https://github.com/akaszubski/autonomous-dev/tree/main/plugins/autonomous-dev/skills/database-design
Command: npx skills add https://github.com/akaszubski/autonomous-dev --skill database-design

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Poor database design leads to slow queries, data inconsistencies, and difficult migrations, costing valuable development time and impacting user experience. This skill provides best practices for schema design, indexing, and query optimization to build robust and performant databases.

Core Features & Use Cases

  • Schema Design: Guidance on normalization vs. denormalization, appropriate data types, and effective primary/foreign key usage.
  • Indexing Strategies: Best practices for various index types (B-Tree, Hash, GIN) and composite indexes to accelerate common queries.
  • Query Optimization: Techniques to avoid the N+1 query problem, use EXPLAIN ANALYZE effectively, and write efficient SQL.
  • Use Case: When designing a new database schema for a critical application, use this skill to ensure proper normalization, select optimal data types, and plan effective indexing for peak performance.
  • Use Case: Identify and resolve slow queries in an existing application by applying profiling techniques and optimization patterns.

Quick Start

This is a knowledge skill, auto-activated by relevant keywords.

To get guidance on database design, simply ask:

"What are the best practices for database schema normalization?" "How can I optimize a slow SQL query?"

Frequently Asked Questions about database-design

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

FAQPage Schema
How do I design a database schema that scales and maintains data integrity?

Schema design balances normalization for data consistency with denormalization for query performance. Choose appropriate data types, establish clear primary and foreign keys, and plan for growth by avoiding redundancy while considering read patterns. This foundation prevents slow queries and migration headaches later.

What's the best way to optimize slow SQL queries in production?

Query optimization uses EXPLAIN ANALYZE to identify bottlenecks, eliminates N+1 query problems, and applies indexing strategies. For PostgreSQL, MySQL, and ORMs like SQLAlchemy and Django ORM, profiling reveals where queries spend time, then targeted indexes and query rewrites restore performance.

How do I create effective database indexes without slowing down writes?

Indexing strategies—B-Tree for range queries, Hash for equality, GIN for complex types—accelerate reads on common query patterns. Composite indexes combine multiple columns efficiently. Balance index coverage against write overhead by targeting the queries that run most frequently and have the highest impact.

Can I migrate my database schema safely without downtime or data loss?

Reversible migrations apply schema changes incrementally while maintaining transactional integrity. PostgreSQL, MySQL, and ORM tools like SQLAlchemy and Django ORM support versioned migration files that roll forward and back. Plan migrations to avoid locking tables during peak usage.

Does database design differ for analytical versus transactional workloads?

Transactional databases prioritize normalization and ACID compliance to prevent conflicts and ensure consistency. Analytical databases denormalize and pre-aggregate data for fast reporting across large datasets. Design choices—data types, indexes, schema structure—differ based on whether the workload emphasizes writes or complex reads.

How do I know when denormalization is the right trade-off?

Denormalization trades data redundancy for query speed when normalized queries become bottlenecks. Common cases include storing aggregates, flattening hierarchies, or duplicating foreign key data to avoid joins. Measure with EXPLAIN ANALYZE before and after; denormalize only where profiling shows measurable gains.