
Database Schema Designer
Model multi-tenant SaaS data in Prisma/PostgreSQL with indexes, soft deletes, and audit-friendly tables before you write migrations.
Overview
database-schema-designer is an agent skill for the Build phase that helps solo builders draft Prisma/PostgreSQL schemas with multi-tenancy, relations, indexes, and soft-delete patterns.
Install
npx skills add https://github.com/alirezarezvani/claude-skills --skill database-schema-designerWhat is this skill?
- Full Prisma reference for a task-management SaaS with organizations, members, projects, and audit logs
- Multi-tenancy patterns with org-scoped relations, cascades, and soft-delete columns
- Snake_case column mapping via @map for PostgreSQL conventions
- Composite unique keys and @@index hints for membership and lookup paths
- Generator/datasource boilerplate wired for prisma-client-js and DATABASE_URL
- Reference walkthrough includes Organization, OrganizationMember, User, and related SaaS entities in one Prisma example
Adoption & trust: 547 installs on skills.sh; 17.5k GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
You know your SaaS features but lack a coherent relational model, tenancy boundaries, and Prisma mappings before your first migration.
Who is it for?
Solo builders shipping a multi-tenant web SaaS on PostgreSQL who want Prisma-first schema guidance before coding repositories and routes.
Skip if: Teams that already have a frozen schema and migration history, or builders who only need one-off SQL tweaks with no ORM layer.
When should I use this skill?
You are defining or revising PostgreSQL tables and Prisma models for a new or growing SaaS backend.
What do I get? / Deliverables
You get an adaptable, production-oriented Prisma schema sketch—org-scoped entities, keys, indexes, and audit fields—ready to turn into migrations and API contracts.
- Prisma schema models with relations, maps, and indexes
- Multi-tenancy and audit-field conventions documented in code
- Migration-ready entity list aligned to API boundaries
Recommended Skills
Journey fit
Schema decisions lock in API shape, tenancy, and query performance—this belongs on the Build shelf when the solo builder is shaping the backend data layer. Backend subphase is where persistence, ORM models, and relational design live; the skill’s Prisma examples target that slice of the stack.
How it compares
Use instead of unstructured “draw me tables” chat when you want tenancy, Prisma syntax, and index discipline in one pass.
Common Questions / FAQ
Who is database-schema-designer for?
Indie and solo builders on PostgreSQL/Prisma who are designing or revising the data layer for a SaaS-style product with organizations and users.
When should I use database-schema-designer?
During Build (backend) when scoping entities for a new app, adding multi-tenancy, or aligning Prisma models with API and auth requirements before migrations.
Is database-schema-designer safe to install?
It is documentation-style procedural knowledge; review the Security Audits panel on this Prism page and treat generated schemas as proposals you validate before applying to production databases.
SKILL.md
READMESKILL.md - Database Schema Designer
# database-schema-designer reference ## Full Schema Example (Task Management SaaS) ### Prisma Schema ```prisma // schema.prisma generator client { provider = "prisma-client-js" } datasource db { provider = "postgresql" url = env("DATABASE_URL") } // ── Multi-tenancy ───────────────────────────────────────────────────────────── model Organization { id String @id @default(cuid()) name String slug String @unique plan Plan @default(FREE) createdAt DateTime @default(now()) @map("created_at") updatedAt DateTime @updatedAt @map("updated_at") deletedAt DateTime? @map("deleted_at") users OrganizationMember[] projects Project[] auditLogs AuditLog[] @@map("organizations") } model OrganizationMember { id String @id @default(cuid()) organizationId String @map("organization_id") userId String @map("user_id") role OrgRole @default(MEMBER) joinedAt DateTime @default(now()) @map("joined_at") organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade) user User @relation(fields: [userId], references: [id], onDelete: Cascade) @@unique([organizationId, userId]) @@index([userId]) @@map("organization_members") } model User { id String @id @default(cuid()) email String @unique name String? avatarUrl String? @map("avatar_url") passwordHash String? @map("password_hash") emailVerifiedAt DateTime? @map("email_verified_at") lastLoginAt DateTime? @map("last_login_at") createdAt DateTime @default(now()) @map("created_at") updatedAt DateTime @updatedAt @map("updated_at") deletedAt DateTime? @map("deleted_at") memberships OrganizationMember[] ownedProjects Project[] @relation("ProjectOwner") assignedTasks TaskAssignment[] comments Comment[] auditLogs AuditLog[] @@map("users") } // ── Core entities ───────────────────────────────────────────────────────────── model Project { id String @id @default(cuid()) organizationId String @map("organization_id") ownerId String @map("owner_id") name String description String? status ProjectStatus @default(ACTIVE) settings Json @default("{}") createdAt DateTime @default(now()) @map("created_at") updatedAt DateTime @updatedAt @map("updated_at") deletedAt DateTime? @map("deleted_at") organization Organization @relation(fields: [organizationId], references: [id]) owner User @relation("ProjectOwner", fields: [ownerId], references: [id]) tasks Task[] labels Label[] @@index([organizationId]) @@index([organizationId, status]) @@index([deletedAt]) @@map("projects") } model Task { id String @id @default(cuid()) projectId String @map("project_id") title String description String? status TaskStatus @default(TODO) priority Priority @default(MEDIUM) dueDate DateTime? @map("due_date") position Float @default(0) // For drag-and-drop ordering version Int @default(1) // Optimistic locking createdById String @map("created_by_id") updatedById String @map("updated_by_id") createdAt DateTime @default(now()) @map("created_at") updatedAt DateTime @updatedAt @map("updated_at") deletedAt DateTime? @map("deleted_at") project Project @relation(fields: [projectId], references: [id]) assignments TaskAssignment[] labels TaskLabel[] comments Comment[] attachments Attachment[] @@index([projectId]) @@index([projectId, status]) @@index([projectId, deletedAt]) @@index([dueDate], where: { deletedAt: null }) // Partial index @@map("tasks") } // ── Polymorphic attachments ─────────────────────────────────────────────────── model Attachment { id S