.claude/skills/prisma-patterns/SKILL.md
Prisma ORM patterns including schema design, JSONB fields, pgvector integration, and migration workflow for YHIN
npx skillsauth add LilMikey-CN/YHIN prisma-patternsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
uuid for primary keys via @default(dbgenerated("gen_random_uuid()"))createdAt and updatedAtstatus enum, never actually DELETE rowsResources can be anything (skills, physical items, info, connections). Use JSONB for the parts that vary:
model Resource {
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
userId String @db.Uuid
type ResourceType // HAVE or WANT
title String
description String
category String? // AI-extracted or user-selected
tags String[] // flexible tags
metadata Json @default("{}") // JSONB: location, duration, quantity, etc.
embedding Unsupported("vector(1536)")? // pgvector
status ResourceStatus @default(ACTIVE)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User @relation(fields: [userId], references: [id])
// ...
}
The metadata JSONB field holds variable attributes:
{
"location": "Melbourne, AU",
"availability": "weekends",
"estimatedHours": 3,
"experienceLevel": "intermediate"
}
Add the extension in a migration:
CREATE EXTENSION IF NOT EXISTS vector;
Use Unsupported("vector(1536)") in Prisma since it doesn't natively support vector types.
Query vectors with raw SQL via prisma.$queryRaw.
schema.prismanpx prisma validatenpx prisma migrate dev --name descriptive-nameprisma/migrations/Always maintain prisma/seed.ts with realistic test data.
Run with npx prisma db seed.
Include at least 20 users with varied resources for testing match quality.
documentation
One-time setup that gathers design context for your project and saves it to your AI config file. Run once to establish persistent design guidelines.
tools
Next.js 15 App Router patterns, server/client components, layouts, and routing conventions for YHIN
development
Core matching algorithm using pgvector semantic similarity. Finds "I have, they need" and "I need, they have" connections between users.
testing
Internationalization workflow using next-intl for Chinese/English bilingual support. Read this before adding any user-facing text.