Database Schema Designer
Design a normalized database schema from application requirements
Design a PostgreSQL database schema for: [APP_DESCRIPTION] **Key entities:** [LIST_MAIN_OBJECTS — e.g., "users, teams, projects, tasks, comments"] **Key relationships:** [DESCRIBE_RELATIONSHIPS — e.g., "users belong to teams, projects have many tasks"] For each table provide: 1. **CREATE TABLE** statement with proper column types 2. **Primary keys** (UUID vs serial — recommend with rationale) 3. **Foreign keys** with ON DELETE behavior (CASCADE, SET NULL, RESTRICT) 4. **Indexes** for expected query patterns 5. **Constraints** (UNIQUE, CHECK, NOT NULL) Also include: - **Enum types** for status fields and categories - **Timestamps** (created_at, updated_at) with trigger for auto-update - **Soft delete** pattern if appropriate (deleted_at column) - **Row-level security** policies if multi-tenant - An **ER diagram** in Mermaid syntax Optimize for: - Read-heavy queries (assume 100:1 read:write ratio) - Efficient pagination (cursor-based, not offset) - Future extensibility without major migrations
How to Use This Prompt
- 1Copy the prompt template above
- 2Paste into claude
- 3Replace [bracketed placeholders] with your specific project details
- 4Iterate on the AI output to refine and customize the results
More Database Prompts
Related database templates from the vault
Query Result Caching Strategy
Use this prompt to query result caching strategy with AI assistance
Database Sharding Strategy Designer
PRODesign a database sharding strategy with shard key selection, routing logic, and migration plan from a single database
Database Normalization Advisor
Use this prompt to database normalization advisor with AI assistance
Full-Text Search Implementation
Implement fast full-text search using PostgreSQL without external tools
You Might Also Like
Prompts from other categories that share similar tags
Database Deadlock Resolver
Use this prompt to database deadlock resolver with AI assistance
Raw SQL to Query Builder
Use this prompt to raw sql to query builder with AI assistance
Database Query Performance Analyzer
Analyze slow database queries and generate optimized alternatives
Background Job Queue Pattern
Implement a lightweight background job queue using PostgreSQL
Keep Exploring the Vault