/ts-backend-dev:prisma-schemafrom ts-backend-dev
Creates Prisma schema for new entities using multi-schema defaults, soft deletes, UUID primary keys, snake_case mapping, and cross-schema relations.
Ships in ts-backend-dev. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Create/modify schema for: $ARGUMENTS
Always define schemas in the datasource block. This enables organizing models into logical namespaces and is supported by PostgreSQL, CockroachDB, and SQL Server.
generator client {
provider = "prisma-client"
output = "./generated"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
schemas = ["base", "billing", "inventory"]
}
Every model and enum must declare its schema with @@schema("name"). Pick the schema that matches the model's domain. If only one schema is needed, use a single entry like schemas = ["public"].
model EntityName {
id String @id @default(uuid())
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
deletedAt DateTime? @map("deleted_at")
// Business fields
status EntityStatus @default(ACTIVE)
name String
amount Decimal @db.Decimal(36, 18)
// Relations
accountId String @map("account_id")
account Account @relation(fields: [accountId], references: [id])
// Indexes
@@index([accountId])
@@index([status])
@@index([createdAt])
// Table and schema mapping
@@map("entity_names")
@@schema("base")
}
enum EntityStatus {
ACTIVE
INACTIVE
DELETED
@@schema("base")
}
Models in different schemas can reference each other. Both schemas must be listed in schemas.
// schema: "base"
model User {
id Int @id
orders Order[]
@@schema("base")
}
// schema: "billing"
model Order {
id Int @id
user User @relation(fields: [userId], references: [id])
userId Int
@@schema("billing")
}
When two schemas have tables with the same name, use unique model names and @@map to disambiguate:
model BaseConfig {
id Int @id
@@map("Config")
@@schema("base")
}
model UserConfig {
id Int @id
@@map("Config")
@@schema("users")
}
InvoicePayment)accountId)@map("account_id")@@map("invoice_payments")"billing", "inventory", "auth")id String @id @default(uuid())
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
deletedAt DateTime? @map("deleted_at") // Soft delete
amount Decimal @db.Decimal(36, 18) // High precision
Use Decimal for any financial value. Float is not acceptable for money.
// One-to-Many
accountId String @map("account_id")
account Account @relation(fields: [accountId], references: [id])
// Many-to-Many (use explicit join table for control)
@@index([accountId]) // Foreign keys
@@index([status, createdAt]) // Common query patterns
@@unique([accountId, nonce]) // Business uniqueness constraints
Add indexes based on actual query patterns, not speculative.
prisma validateprisma formatprisma generateprisma migrate dev --name add_entity_nameDetect the package manager from the repo (lockfile or packageManager in package.json) and prefix commands accordingly (npx, pnpm exec, yarn exec, bunx, or direct if globally installed).
Moving a model from one schema to another drops the table in the source schema and recreates it in the target. Back up data before applying such migrations.
schemas array defined in datasource block@@schema("...")What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
npx claudepluginhub widnyana/eyay-toolkits --plugin ts-backend-dev3 skills in this plugin
/ts-db-perfOptimize TypeScript code that interacts with databases. Use this skill when the user wants to fix N+1 queries, add caching, improve transaction safety, prevent race conditions, simplify async flows, or generally speed up a TypeScript backend. Triggers on phrases like "optimize", "slow query", "N+1", "race condition", "caching", "performance", "bottleneck", or when the user points at TypeScript code that reads or writes to a database and asks for improvements.
/ts-reviewReview TypeScript code for quality, security, and correctness. Use this skill when the user asks for a code review, wants feedback on a PR or diff, or says "review this". Covers architecture, security, error handling, database patterns, type safety, and code quality. Produces categorized findings: critical issues, improvements, suggestions, and positive notes. Also triggers on phrases like "check this code", "what do you think of this", or "any issues with".