db-analyzer

Analyzes live PostgreSQL schemas for index gaps, entity drift, and performance issues.

Updated Dec 23, 2025
One-click install
npx skills add https://github.com/zuldare/apuntesIA --skill db-analyzer-zuldare
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: db-analyzer
Source: https://github.com/zuldare/apuntesIA/tree/main/skills/db-analyzer
Command: npx skills add https://github.com/zuldare/apuntesIA --skill db-analyzer-zuldare

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Spring Boot / JPA applications often drift away from the actual database schema, causing slow queries, missing indexes on foreign keys, orphan records, and silent data integrity issues. This Skill connects to the live PostgreSQL database via MCP and audits the real schema instead of guessing from code. ## Core Features & Use Cases - Schema Health Checks: Detects tables without primary keys, mixed boolean/numeric(1,0) types, and json columns that should be jsonb. - Index & Performance Analysis: Finds missing FK indexes, unused or duplicate indexes, over-indexed tables, table bloat, and sequential-scan hotspots. - Entity-DB Drift Detection: Compares JPA entity annotations against actual columns, constraints, and indexes to surface mismatches before they cause production failures. - Use Case: Before merging a PR that touches JPA entities or Flyway migrations, run a pre-migration safety check to verify lock-safe DDL patterns, dependent foreign keys, and entity alignment. ## Quick Start Ask the AI to run a full database health check on the ONLINE schema and report missing indexes and entity drift.

Frequently Asked Questions about db-analyzer

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

FAQPage Schema
How do I find missing indexes on foreign keys in PostgreSQL?▼

Query information_schema.table_constraints for FOREIGN KEY constraints and check pg_indexes for a matching index on the referencing column. This Skill automates that query and ranks severity by table volume, flagging high-traffic tables first.

How to detect JPA entity and database schema drift?▼

Compare each @Entity's column names, types, nullable flags, and lengths against information_schema.columns for the actual table. The Skill reports mismatches such as nullable conflicts, length differences, missing columns, and absent FK constraints.

Does this database analysis require a live database connection?▼

Yes, it connects to the real PostgreSQL database through the MCP postgres server configured in .mcp.json. It runs live queries against information_schema and pg_stat views rather than only reviewing application code.

Can I add a column or index without locking a PostgreSQL table?▼

Use CREATE INDEX CONCURRENTLY to avoid write locks, and ADD COLUMN with a default is safe on PostgreSQL 11+. For foreign keys, add the constraint as NOT VALID and validate it separately to avoid long table rewrites.

Why are unused indexes not automatically safe to drop?▼

Zero-scan indexes may still enforce unique constraints or serve rare batch jobs and reports not exercised in the current environment. The Skill flags them but recommends verifying against production statistics before removal.