db-domain-modeling

Model business domains into PostgreSQL schemas with constraints, indexes, and RLS policies.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Translating business requirements into a well-structured database schema is error-prone and often skips critical steps like constraints, indexes, and row-level security. This Skill guides an interactive domain modeling session that turns business entities and rules into a complete, documented PostgreSQL/Supabase schema. ## Core Features & Use Cases - Guided Domain Discovery: Structured questions to identify entities, attributes, relationships, cardinality, and business rules before writing any SQL. - Schema Generation: Produces CREATE TABLE statements with UUID keys, foreign keys, CHECK constraints, junction tables for M:N relationships, and access-pattern-driven indexes. - Supabase RLS & Migrations: Generates Row Level Security policies, audit triggers, and a timestamped migration file ready for dry-run and application. - Use Case: You are building a multi-tenant SaaS and need to model organizations, users, and subscriptions. Run the session to produce a schema design document, ERD, and initial migration with tenant-isolation RLS policies. ## Quick Start Ask the agent to start a domain modeling session for your business domain and answer its questions about entities, relationships, and access patterns.

Frequently Asked Questions about db-domain-modeling

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

FAQPage Schema
How do I model a business domain into a database schema?▼

Start by identifying core entities, their attributes, and relationships through structured questions, then map each entity to a table with UUID primary keys, foreign keys, and constraints. This Skill walks through that process step by step and outputs a schema document plus a migration file.

How to design many-to-many relationships in PostgreSQL?▼

Create a junction table with foreign keys to both entities, a composite primary key on the pair, and indexes on both columns for bidirectional queries. Optional attributes like role or priority can be stored directly on the junction table.

Does this work with Supabase Row Level Security?▼

Yes, the session generates RLS policies for Supabase, including per-user isolation using auth.uid(), admin override policies via JWT role claims, and public-read/authenticated-write patterns. It also covers multi-tenant organization isolation.

How are business rules enforced in the database schema?▼

Business rules are translated into CHECK constraints, UNIQUE constraints, and triggers. Examples include preventing negative order totals, requiring titles on published posts, and blocking updates to soft-deleted records via a trigger function.

What happens when the database connection fails during execution?▼

Connection failures are handled with retry logic using exponential backoff up to three attempts. Query syntax errors return detailed messages with suggested fixes, and transaction failures roll back automatically to preserve data integrity.