db-schema-audit

Audits PostgreSQL database schemas for design, performance, security, and integrity issues.

3|Updated Feb 7, 2026
One-click install
npx skills add https://github.com/gabrielnsmnto/kord-aios --skill db-schema-audit-gabrielnsmnto
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: db-schema-audit
Source: https://github.com/gabrielnsmnto/kord-aios/tree/main/src/features/builtin-skills/kord-aios/database/db-schema-audit
Command: npx skills add https://github.com/gabrielnsmnto/kord-aios --skill db-schema-audit-gabrielnsmnto

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Database schemas accumulate hidden problems over time: missing primary keys, unindexed foreign keys, absent Row Level Security, and unnamed constraints that make errors cryptic. Manually checking every table against best practices is slow and error-prone. ## Core Features & Use Cases - Design & Performance Checks: Detects tables without primary keys or timestamps, foreign keys without indexes, unused and duplicate indexes, and large tables that may need partitioning. - Security & Integrity Audit: Identifies tables without RLS enabled, RLS tables lacking policies, potential PII columns, and tables missing constraints entirely. - Scored Report Generation: Produces a timestamped Markdown audit report with an overall score, prioritized action items, and ready-to-run SQL fixes. - Use Case: Before launching a Supabase-backed application, run the audit to catch missing RLS policies and unindexed foreign keys, then apply the generated SQL fixes and re-run to verify. ## Quick Start Ask the agent to audit my Supabase database schema and generate a report of design, performance, and security issues.

Frequently Asked Questions about db-schema-audit

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

FAQPage Schema
How do I audit a PostgreSQL database schema for best practices?▼

Run SQL checks against information_schema and pg_catalog to find tables without primary keys, missing timestamps, unindexed foreign keys, and tables lacking constraints. This skill automates those queries and compiles results into a scored Markdown report.

How to find foreign keys without indexes in PostgreSQL?▼

Query information_schema.table_constraints for FOREIGN KEY constraints, then check pg_indexes for a matching index definition on each column. Unindexed foreign keys cause slow JOINs and slow ON DELETE CASCADE operations.

Does this work with Supabase Row Level Security?▼

Yes, the audit specifically checks Supabase-style RLS by querying pg_tables for rowsecurity status and pg_policies for policy coverage. It flags tables without RLS enabled and tables with RLS enabled but no policies defined.

What database connection is required to run the schema audit?▼

The audit requires a SUPABASE_DB_URL environment variable containing a valid PostgreSQL connection string and uses the psql command-line client. Connection failures are retried with exponential backoff up to three attempts.

Why does my PostgreSQL audit show unnamed constraint warnings?▼

PostgreSQL auto-generates cryptic constraint names like users_age_check when constraints are declared inline without names. Naming constraints explicitly with patterns like table_column_check produces clearer error messages and easier troubleshooting.