agency-database-optimizer

Analyze PostgreSQL schemas and queries to recommend indexes and migrations.

Updated Feb 11, 2026
One-click install
npx skills add https://github.com/augustoheiss/LogicDefense --skill agency-database-optimizer-augustoheiss
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: agency-database-optimizer
Source: https://github.com/augustoheiss/LogicDefense/tree/main/.gemini/skills/agency-database-optimizer
Command: npx skills add https://github.com/augustoheiss/LogicDefense --skill agency-database-optimizer-augustoheiss

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Databases suffer from slow queries, inefficient schemas, N+1 patterns, and fragile migrations that cause downtime or resource spikes; this Skill diagnoses and eliminates those performance bottlenecks so systems remain reliable under load.

Core Features & Use Cases

  • Schema & Index Design: Recommend normalization/denormalization trade-offs, B-tree, GiST, GIN, partial and composite indexes for common query patterns.
  • Query Plan Diagnosis: Interpret EXPLAIN ANALYZE output, detect sequential scans, bad row estimates, and provide rewritten queries or plan-friendly hints.
  • Operational Patterns: Advise on connection pooling (PgBouncer, Supabase pooler), safe reversible migrations, and strategies for serverless or PlanetScale environments.
  • Use Case: Turn a slow feed or join-heavy endpoint into a performant query by adding targeted indexes, avoiding N+1s, and proposing safe migration steps.

Quick Start

Analyze this slow PostgreSQL query and schema and provide EXPLAIN ANALYZE-driven index recommendations, a rewritten query, and safe migration steps.

Frequently Asked Questions about agency-database-optimizer

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

FAQPage Schema
How do I interpret EXPLAIN ANALYZE output to fix slow PostgreSQL queries?

To interpret EXPLAIN ANALYZE output, you detect sequential scans and bad row estimates to diagnose bottlenecks. This Skill analyzes the execution plan, identifies performance issues, and recommends rewritten queries or plan-friendly hints to reduce latency.

When do I need partial or composite indexes for my database schema?

You need partial or composite indexes when common query patterns cause sequential scans. This Skill recommends B-tree, GiST, GIN, partial, and composite indexes based on your specific workload to eliminate slow lookups and reduce resource usage.

Can I use this to plan safe and reversible database migrations?

Yes, you can plan safe and reversible database migrations. This Skill proposes reversible migration steps designed to prevent downtime and resource spikes when modifying schemas on PostgreSQL, MySQL, Supabase, or PlanetScale environments.

Does this Skill work with Supabase and PlanetScale connection pooling?

Yes, this Skill works with Supabase and PlanetScale connection pooling. It advises on PgBouncer and Supabase pooler configurations, outlining operational best practices and specific strategies for serverless or PlanetScale environments.

What is the best way to resolve N+1 query patterns in a slow feed endpoint?

The best way to resolve N+1 query patterns is by adding targeted indexes and rewriting the join logic. This Skill diagnoses N+1 bottlenecks, proposes schema adjustments, and generates efficient queries to turn slow feed endpoints into performant operations.