grey-haven-data-modeling

Design multi-tenant database schemas with SQLModel and Drizzle ORM for PostgreSQL.

29|4|Updated Aug 10, 2025
One-click install
npx skills add https://github.com/greyhaven-ai/claude-code-config --skill grey-haven-data-modeling
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: grey-haven-data-modeling
Source: https://github.com/greyhaven-ai/claude-code-config/tree/main/grey-haven-plugins/data-quality/skills/data-modeling
Command: npx skills add https://github.com/greyhaven-ai/claude-code-config --skill grey-haven-data-modeling

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill eliminates the complexity and manual effort of designing secure, scalable database schemas for multi-tenant SaaS applications, ensuring data isolation and performance from day one.

Core Features & Use Cases

  • Multi-Tenant Architecture: Automatically apply tenant isolation patterns with RLS policies and tenant_id fields.
  • ORM Integration: Generate optimized schemas for both SQLModel (Python) and Drizzle ORM (TypeScript).
  • Use Case: When building a new SaaS feature, use this Skill to design database tables with proper tenant isolation, relationships, and indexes in minutes instead of hours.

Quick Start

Design a users table for a multi-tenant application using Drizzle ORM with tenant isolation, standard timestamps, and proper indexes.

Frequently Asked Questions about grey-haven-data-modeling

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

FAQPage Schema
How do I design a multi-tenant database schema with tenant isolation?▼

Multi-tenant database design isolates customer data using tenant_id fields on all tables combined with Row-Level Security policies. This Skill automates schema generation for PostgreSQL with RLS enablement, ensuring every row is tagged with a tenant identifier and queries automatically filter by the current tenant, preventing cross-tenant data leaks.

Can I use SQLModel and Drizzle ORM together for multi-tenant applications?▼

This Skill generates optimized schemas for both SQLModel (Python/FastAPI) and Drizzle ORM (TypeScript) stacks. You can choose your language and ORM; the Skill produces tenant-aware table definitions, migrations, and RLS policies tailored to each framework's conventions and requirements.

What database features ensure multi-tenant data isolation in PostgreSQL?▼

PostgreSQL Row-Level Security policies combined with tenant_id columns enforce data isolation at the database layer. This Skill configures RLS with admin override capabilities, applies indexes on tenant_id and foreign keys for performance, and sets up standard audit fields (created_at, updated_at, deleted_at) across all tables.

How do I set up relationships and join tables in a multi-tenant schema?▼

Multi-tenant relationships require proper foreign key constraints and join tables that inherit the tenant_id context. This Skill automatically generates one-to-many and many-to-many relationship definitions with composite indexes on (tenant_id, foreign_key) to maintain isolation and query performance across related entities.

What naming conventions and standard fields should a multi-tenant table have?▼

Multi-tenant tables follow snake_case naming with mandatory fields: id (primary key), tenant_id (isolation), created_at, updated_at, and deleted_at (soft deletes). This Skill enforces these conventions across all generated schemas, ensuring consistency and enabling RLS policies to function correctly.

Do I need to manually create Row-Level Security policies after generating my schema?▼

This Skill generates both the schema structure and the RLS policy configuration required for PostgreSQL. It creates policies that automatically enforce tenant isolation based on tenant_id, with built-in admin override support, so your multi-tenant data protection is active immediately after schema deployment.