with one click
fix-db
Fix Prisma schema compilation errors
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Fix Prisma schema compilation errors
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
| name | fix-db |
| description | Fix Prisma schema compilation errors |
| allowed-tools | Read, Edit, Write, Bash, Grep, Glob |
Fix Prisma schema compilation errors according to code conventions.
NEVER use:
enum types (use String with TypeScript union types instead)Fix compilation errors in Prisma schema files to ensure npm run build:prisma passes.
┌─────────────────────────────────────┐
│ Step 1: Run Build │
│ npm run build:prisma │
└───────────────┬─────────────────────┘
│
▼
┌─────────────────────────────────────┐
│ Step 2: Parse Errors │
│ - Syntax errors │
│ - Relation errors │
│ - Type errors │
└───────────────┬─────────────────────┘
│
▼
┌─────────────────────────────────────┐
│ Step 3: Fix by Convention │
│ Apply code conventions │
└───────────────┬─────────────────────┘
│
▼
┌─────────────────────────────────────┐
│ Step 4: Re-run Build │
│ Loop until 0 errors │
└─────────────────────────────────────┘
npm run build:prisma 2>&1
Capture all error output.
Common error types:
Error parsing attribute: Syntax error in decoratorError validating field: Invalid field typeError validating relation: Missing or invalid relation// Standard
id String @id @db.Uuid
created_at DateTime @db.Timestamptz
updated_at DateTime @db.Timestamptz
deleted_at DateTime? @db.Timestamptz
{parent}_id String @db.Uuid
{parent} {prefix}_{parents} @relation(fields: [{parent}_id], references: [id], onDelete: Cascade)
// DO NOT use Prisma enum
status String // "active" | "inactive" defined in TypeScript
// WRONG - Never do this
// enum Status { ACTIVE INACTIVE }
parent_id String? @db.Uuid
parent {Model}? @relation("recursive", fields: [parent_id], references: [id], onDelete: Cascade)
children {Model}[] @relation("recursive")
@@index([{parent}_id, status])
@@index([name(ops: raw("gin_trgm_ops"))], type: Gin)
npm run build:prisma
Repeat Steps 2-4 until no errors.
| Error Pattern | Fix |
|---|---|
| Missing relation | Add @relation with fields and references |
| Invalid type | Use correct Prisma types (String, Int, DateTime, etc.) |
| Duplicate model | Remove duplicate or rename |
| Missing @@map | Add table name mapping |
| Enum error | Replace with String type |
npm run build:prisma completes with no errorsImplement new feature with self-testing loop until 100% pass
Fix Interface and Controller compilation errors
Fix Provider, Collector, Transformer compilation errors
Fix Test compilation errors
Validate Prisma schema against requirements specification (read-only)
Validate Controllers and DTOs against requirements (read-only)