Command Palette

Search for a command to run...

Назад к скиллам
скилл № 45489

nodejs-prisma

Use when the user asks about Prisma schema, Prisma migrate, a Prisma schema migration for a new table, Prisma relations, Prisma Client queries, $extends…

БесплатноБез исполняемых скриптов
j4flmaoот j4flmao★ 47 звёзд на GitHub

Установить nodejs-prisma в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

Prisma ORM

Purpose

Design database schemas, write performant queries, manage migrations, implement client extensions, and optimize Prisma Client for production.

Agent Protocol

Trigger

User request includes: prisma, prisma schema, prisma migrate, prisma client, prisma relation, prisma middleware, prisma query, prisma performance, prisma seed, prisma studio.

Input Context

  • Database (PostgreSQL, MySQL, SQLite, SQL Server, MongoDB)
  • Prisma version (6.x or 7.x). Prisma 7 (late 2025) moves to the Rust-free prisma-client generator, prisma.config.ts for connection config and driver adapters; check the upgrade guide before mixing examples
  • Primary keys: prefer @default(uuid(7)) (time-ordered, Prisma 5.18+) or autoincrement() over random UUIDv4 on write-heavy tables
  • Schema complexity (relations, enums, composite keys)
  • Deployment (Node.js, serverless, edge)

Output Artifact

Schema definition, query examples, migration setup, extension patterns, performance optimizations.

Response Format

Produce artifact directly. No preamble, no postamble, no explanations.

Completion Criteria

  • Schema defined with proper relations, indexes, constraints
  • Migrations generated and applied
  • Queries use select, include, and where efficiently
  • Middleware (interactive transactions, extensions) configured
  • Connection pooling for serverless or production

Max Response Length

4096 tokens

Architecture Decision Trees

Prisma vs Drizzle ORM vs TypeORM vs Knex

Criterion Prisma Drizzle ORM TypeORM Knex
Type safety Full (generated) Full (inferred) Partial None
Migration system Prisma Migrate Drizzle Kit TypeORM migrations Knex migrations
Query builder Declarative (Prisma Client) SQL-like Active Record / Data Mapper SQL builder
Relation handling Include / select Joins explicit relations / find Manual JOINs
Middleware/hooks Extensions (v5+) Middleware Subscribers Raw Knex plugins
Performance Moderate (mapped layer) High (thin wrapper) Moderate High
Bundle size Large (generated client) Tiny (tree-shakeable) Large Moderate

Decision: Full type safety + auto-complete → Prisma. Maximum performance + SQL control → Drizzle. Active Record familiarity → TypeORM.

Schema Design: Prisma vs Raw SQL

Aspect Prisma Schema Raw SQL
Source of truth schema.prisma migrations
Readability Declarative, concise Verbose
Index management @@index decorators CREATE INDEX
Enum support Native (enum keyword) CREATE TYPE
Composite keys @@id([field1, field2]) Composite PK

Decision: Prisma-first project → use schema.prisma as source of truth. Existing DB → introspect with prisma db pull.

Workflow

Step 1: Schema Definition

// prisma/schema.prisma
generator client {
  provider = "prisma-client-js" // Prisma 7: provider = "prisma-client" with an explicit output path
}

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

enum UserRole {
  ADMIN
  USER
  MODERATOR
}

model User {
  id        String   @id @default(uuid(7))
  email     String   @unique
  name      String
  role      UserRole @default(USER)
  active    Boolean  @default(true)
  profile   Profile?
  posts     Post[]
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt

  @@index([email, active])
  @@map("users")
}

model Profile {
  id      String @id @default(uuid(7))
  bio     String?
  avatar  String?
  userId  String @unique
  user    User   @relation(fields: [userId], references: [id], onDelete: Cascade)

  @@map("profiles")
}

model Post {
  id        String   @id @default(uuid(7))
  title     String
  content   String?
  published Boolean  @default(false)
  authorId  String
  author    User     @relation(fields: [authorId], references: [id], onDelete: Cascade)
  tags      Tag[]
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt

  @@index([authorId, published])
  @@map("posts")
}

model Tag {
  id    String @id @default(uuid(7))
  name  String @unique
  posts Post[]

  @@map("tags")
}

model PostTag {
  postId String
  tagId  String
  post   Post @relation(fields: [postId], references: [id], onDelete: Cascade)
  tag    Tag  @relation(fields: [tagId], references: [id], onDelete: Cascade)

  @@id([postId, tagId])
  @@map("post_tags")
}

Step 2: Query Patterns

// src/repositories/user.repository.ts
import { PrismaClient } from '@prisma/client';

const prisma = new PrismaClient();

// SELECT with specific fields
export async function findUserById(id: string) {
  return prisma.user.findUnique({
    where: { id },
    select: { id: true, name: true, email: true, role: true },
  });
}

// Include relations (N+1 safe — Prisma batches)
export async function findUserWithProfile(id: string) {
  return prisma
Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

  • references/prisma-advanced.md
  • references/prisma-deployment.md
  • references/prisma-middleware.md
  • references/prisma-relations.md
  • references/query-optimization.md
  • references/schema-migrations.md

FAQ

Что делает скилл nodejs-prisma?

Use when the user asks about Prisma schema, Prisma migrate, a Prisma schema migration for a new table, Prisma relations, Prisma Client queries, $extends client extensions or Prisma 7 upgrade. Produces Prisma schemas, migrations and queries. Not for Drizzle (use nodejs-drizzle).

Как установить скилл nodejs-prisma?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл nodejs-prisma запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить nodejs-prisma с