$ recombobulate _
home / tips / use-claude-to-design-and-write-a-prisma-schema
0

Use Claude to Design and Write a Prisma Schema

bagwaa @bagwaa · Mar 26, 2026 · Workflows
use-claude-to-design-and-write-a-prisma-schema

Writing a Prisma schema from scratch means remembering relation syntax, deciding where to put @relation fields, and setting up indexes correctly. Let Claude draft the schema while you focus on your domain model.

Design a Prisma schema for a multi-tenant SaaS app with:
- Organisations (name, slug, plan enum: free/pro/enterprise)
- Users with organisation membership and a role enum
- Projects belonging to organisations
- Audit logs tracking who changed what and when

Claude will generate a complete schema.prisma with proper @relation annotations, @@index declarations, enum definitions, and createdAt/updatedAt timestamps. It adds @@unique constraints where they make sense (like slug on organisations) and suggests a Role enum for membership types.

model Organisation {
  id        String   @id @default(cuid())
  name      String
  slug      String   @unique
  plan      Plan     @default(FREE)
  members   Member[]
  projects  Project[]
  createdAt DateTime @default(now())
}

After reviewing the schema, follow up with "generate the initial migration" or "write Prisma seed data for local development" to keep moving.

Claude also handles trickier patterns like self-referential relations (parent/child categories) and polymorphic-style setups using separate join tables.

Describe your domain, and Claude will give you a Prisma schema that's production-ready on the first draft.

~/recombobulate $ tip --comments --count=0

Log in to leave a comment.

~/recombobulate $ tip --related --limit=3
0
Scan Pending Changes for Security Issues with /security-review

The /security-review command scans your uncommitted changes for injection vectors, auth gaps, hardcoded secrets, and other common vulnerabilities.

bagwaa @bagwaa · 2 hours ago
0
Run Setup Scripts on Every Session with the SessionStart Hook

The SessionStart hook fires when any session begins or resumes, making it ideal for loading environment variables and running one-time setup scripts.

bagwaa @bagwaa · 2 hours ago
0
Write Property-Based Tests with fast-check and Claude

Ask Claude to write property-based tests for your functions using fast-check — it identifies the mathematical invariants in your code and generates tests that cover inputs you'd never enumerate by hand.

bagwaa @bagwaa · 2 hours ago