一键导入
database-model
Create Prisma schema models with relations and indexes. Use when designing database schemas, adding models, or defining entity relationships.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Create Prisma schema models with relations and indexes. Use when designing database schemas, adding models, or defining entity relationships.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Create robust, error-proof Prisma seed scripts with comprehensive error handling and validation.
Create Next.js 16 API Route Handlers. Use when building REST endpoints (GET, POST, PUT, DELETE), implementing CRUD operations, or creating authenticated APIs with Zod validation.
Create React/Next.js 16 components. Use when building pages, client/server components, forms with useActionState, or UI with shadcn/ui. ALWAYS activate with frontend-design together.
Unit tests with Jest + React Testing Library. CRITICAL - Uses Jest (NOT Vitest).
Write integration tests with Jest for API routes and database operations. Use when testing backend logic, API endpoints, or data layer.
Review code for quality, security, performance, and best practices. Use when reviewing changes before commit, auditing code for issues, or suggesting improvements.
| name | database-model |
| description | Create Prisma schema models with relations and indexes. Use when designing database schemas, adding models, or defining entity relationships. |
// prisma/schema.prisma - NEVER change these blocks
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
Import: import { prisma } from '@/lib/prisma' (already exists)
model Product {
id String @id @default(uuid())
name String
price Float // Use Float for UI (returns number directly)
isActive Boolean @default(true)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
category Category @relation(fields: [categoryId], references: [id], onDelete: Cascade)
categoryId String
@@index([categoryId])
@@index([name])
}
Rules:
@id @default(uuid())createdAt, updatedAt@@index on foreign keys| Type | Returns | Use Case |
|---|---|---|
Int | number | Counts, whole numbers |
Float | number | Prices (recommended) |
Decimal | Prisma.Decimal | Financial (needs conversion) |
model Category {
id String @id @default(uuid())
name String @unique
products Product[]
}
model Product {
id String @id @default(uuid())
category Category @relation(fields: [categoryId], references: [id], onDelete: Cascade)
categoryId String
@@index([categoryId])
}
model User {
id String @id @default(uuid())
profile Profile?
}
model Profile {
id String @id @default(uuid())
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
userId String @unique // @unique = one-to-one
}
model Post {
id String @id @default(uuid())
tags Tag[] // Prisma handles junction table
}
model Tag {
id String @id @default(uuid())
name String @unique
posts Post[]
}
User, Account, Session already exist in boilerplate. Just add relations:
model User {
// ... existing fields
posts Post[] // Add your relations
}
DO NOT run db push manually. Runs automatically in validation phase.