Prompt: Database Schema Generator
A self-configuring prompt that designs your database schema based on your app requirements.
Tech Integration Labs
Author
Prompt: Database Schema Generator
Use when: You're starting a new project and need to design the database, or adding a major feature that requires new tables.
The Prompt
I'll help you design a database schema. Let me understand your needs:
**About Your App:**
1. What does your app do? (one sentence)
2. What are the main "things" users will create/manage? (e.g., posts, products, orders)
3. Do you need user authentication? (yes/no)
4. Is this multi-tenant (multiple organizations)? (yes/no)
5. What database? (Supabase/PostgreSQL/MySQL, default: Supabase)
**Preferences:**
6. Include soft deletes (deleted_at column)? (yes/no, default: yes)
7. Include audit fields (created_at, updated_at, created_by)? (yes/no, default: yes)
8. Generate RLS policies? (yes/no, default: yes if Supabase)
Once you answer, I will:
- Design tables with proper relationships
- Add appropriate indexes
- Create foreign key constraints
- Generate migration SQL
- Add RLS policies for security
- Provide seed data for testing
Ready? Answer the questions above.
Example Output
Input answers:
- A project management app for teams
- Projects, tasks, comments
- Yes
- Yes (multi-tenant)
- Supabase
- Yes
- Yes
- Yes
What Claude produces:
-- Organizations (tenants)
CREATE TABLE organizations (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
name TEXT NOT NULL,
slug TEXT UNIQUE NOT NULL,
created_at TIMESTAMPTZ DEFAULT now(),
updated_at TIMESTAMPTZ DEFAULT now()
);
-- Projects
CREATE TABLE projects (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
organization_id UUID REFERENCES organizations(id) ON DELETE CASCADE,
name TEXT NOT NULL,
description TEXT,
status TEXT DEFAULT 'active',
created_at TIMESTAMPTZ DEFAULT now(),
updated_at TIMESTAMPTZ DEFAULT now(),
deleted_at TIMESTAMPTZ
);
-- And so on for tasks, comments, with full RLS policies...
Customization Options
Add Specific Tables
Also include tables for: file attachments, activity logs, and notifications.
Different Database
Generate this for MySQL instead, with appropriate syntax changes.
Related Prompts
- API Endpoint Generator: Generate REST or tRPC endpoints for your schema
- React Query Hooks: Generate typed data-fetching hooks
Tech Integration Labs
Building AI-powered systems and sharing what I learn along the way. Founder at Tech Integration Labs.
Related Articles
View all →Prompt: Thorough Code Review
Get a detailed code review with security checks, performance analysis, and specific improvement suggestions.
Prompt: Systematic Bug Investigation
Describe the symptom. Claude traces through your code, identifies the root cause, explains why it happens, and provides a fix.
Use Case #6: Mock to Production Database
The app looked great but everything was fake. Claude created 20+ database tables, wrote RLS policies, generated seed data, and wired up real API calls.