db-schema

Design and review PostgreSQL and Supabase database schemas with indexes and RLS policies.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/4asaanAI/Claude-patches --skill db-schema-4asaanai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: db-schema
Source: https://github.com/4asaanAI/Claude-patches/tree/main/framework-foundry/Claude%20Plugins/layaa-ai/skills/db-schema
Command: npx skills add https://github.com/4asaanAI/Claude-patches --skill db-schema-4asaanai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Prevents schema design mistakes, unsafe migrations, and inconsistent data models by providing clear, reviewable database schema specifications and migration guidance tailored for PostgreSQL and Supabase projects.

Core Features & Use Cases

  • Entity Modeling: List all entities with columns, types, constraints, and recommended defaults.
  • Relationship Design: Define foreign keys, one-to-many and many-to-many relations using junction tables.
  • Performance & Safety: Recommend indexes for common queries and prescribe migration-safe, additive changes.
  • Row-Level Security: Draft RLS policies to control read/write access per role or user context.
  • Real-world Use Case: Add a commenting system to an existing Supabase app by designing tables, indexes, FK constraints, and RLS while avoiding destructive changes to production data.

Quick Start

Review the Supabase PostgreSQL schema, list entities and relationships, and propose additive migration changes with indexes and RLS policies.

Frequently Asked Questions about db-schema

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

FAQPage Schema
How do I design a PostgreSQL schema for a new feature without breaking existing tables?

Database schema design for PostgreSQL involves defining entities, columns, and relationships while ensuring migration safety. You can specify additive changes, foreign keys, and indexes to safely extend existing tables without destructive modifications.

What is the best way to set up Supabase row-level security policies for my tables?

Row-level security (RLS) policies control read and write access per role or user context in Supabase. You draft these policies alongside your table definitions to ensure data access is properly restricted and validated within your database schema.

How do I model many-to-many relationships using junction tables in a database schema?

Modeling many-to-many relationships in a database schema requires defining junction tables. You establish these connections using foreign keys and specific constraints, ensuring data consistency across your PostgreSQL or Supabase entities.

Can I use this to recommend indexes for optimizing common PostgreSQL queries?

Yes, recommending indexes for common queries is a core part of this database schema process. It analyzes your entity models and query patterns to specify the appropriate indexes, enhancing performance and safety in your Supabase or PostgreSQL application.

Does this schema design approach work for adding a commenting system to an existing Supabase app?

Yes, a real-world use case is adding a commenting system to an existing Supabase app. The schema design process specifies the necessary tables, foreign key constraints, indexes, and RLS policies while avoiding destructive changes to production data.

When should I use additive migrations for PostgreSQL schema changes?

Additive migrations are recommended for PostgreSQL schema changes to prevent unsafe modifications and data loss. You should use them to ensure consistency with existing schemas, validating that all new columns, constraints, and indexes are applied safely.