prisma
БесплатноБез исполняемых скриптовНе проверенPrisma ORM is a TypeScript database toolkit with a declarative schema, a generated type-safe client, and a migration system for PostgreSQL, MySQL/MariaDB…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
Prisma — TypeScript ORM
Overview
Prisma ORM turns a schema.prisma file into a typed query client and SQL migrations. This skill targets the Prisma 7 line (7.10.1 was the last stable 7.x when checked on 2026-10-24). On that date the npm latest tag already pointed to the 8.0.0 release candidate, so a plain npm install prisma installs a release candidate: pin prisma@7 / @prisma/client@7 (the docs use prisma@prev for the CLI) unless you want Prisma 8.
What changed in Prisma 7, and what trips up code written for 6 or earlier:
- The connection URL no longer lives in
schema.prisma. Thedatasourceblock has onlyprovider; the URL goes inprisma.config.ts. PrismaClientneeds a driver adapter (@prisma/adapter-pg,adapter-mariadb,adapter-better-sqlite3, and so on).new PrismaClient()with no adapter throws.- The default generator is
prisma-clientandoutputis required. The client is plain TypeScript in your source tree, not innode_modules.prisma-client-jsis the old generator. .envis no longer loaded for you; importdotenv/configor set variables yourself. The project must be ESM ("type": "module").prisma migrate devdoes not rungenerateany more; runnpx prisma generateyourself.
Instructions
1. Install (PostgreSQL shown)
npm install --save-dev prisma@7 tsx typescript
npm install @prisma/client@7 @prisma/adapter-pg@7 pg dotenv
npx prisma init --datasource-provider postgresql
Other adapters: MySQL/MariaDB @prisma/adapter-mariadb + mariadb; SQLite @prisma/adapter-better-sqlite3 + better-sqlite3. init creates prisma/schema.prisma, a config file and .env. In 7.10.1 the config file is named prisma7.config.ts; delete it and create prisma.config.ts as in step 2, or keep it and use the same content.
2. Config and schema
// prisma.config.ts
import "dotenv/config";
import { defineConfig, env } from "prisma/config";
export default defineConfig({
schema: "prisma/schema.prisma",
migrations: { path: "prisma/migrations", seed: "tsx prisma/seed.ts" },
datasource: { url: env("DATABASE_URL") },
});
// prisma/schema.prisma
generator client {
provider = "prisma-client"
output = "../src/generated/prisma"
}
datasource db {
provider = "postgresql"
}
model User {
id String @id @default(cuid())
email String @unique
name String
role Role @default(USER)
posts Post[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@map("users")
}
model Post {
id String @id @default(cuid())
title String
published Boolean @default(false)
author User @relation(fields: [authorId], references: [id])
authorId String
createdAt DateTime @default(now())
@@index([authorId])
@@index([published, createdAt])
}
enum Role {
USER
ADMIN
}
Add src/generated/ to .gitignore if you generate in CI, or commit it; both work.
3. Migrate and generate
npx prisma migrate dev --name add-posts # create + apply a migration in development
npx prisma generate # rebuild the client after every schema change
npx prisma migrate deploy # apply committed migrations in CI/production
npx prisma migrate status # which migrations are applied
npx prisma db push # prototype without migration files
npx prisma db seed # runs migrations.seed from prisma.config.ts
npx prisma studio # data browser
4. Client setup (one instance per process)
// src/db.ts
import { PrismaClient } from "./generated/prisma/client";
import { PrismaPg } from "@prisma/adapter-pg";
const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL! });
export const prisma = new PrismaClient({ adapter });
Model and enum types come from ./generated/prisma/models and ./generated/prisma/enums; browser-safe enums from ./generated/prisma/browser.
5. Queries
import { prisma } from "./db";
const author = await prisma.user.create({
data: {
name: "Maria Lopez",
email: "[email protected]",
posts: { create: [{ title: "Release notes 2.4", published: true }] },
},
include: { posts: true },
});
const page = await prisma.post.findMany({
where: { published: true, author: { role: "ADMIN" } },
select: { id: true, title: true, author: { select: { name: true } } },
orderBy: { createdAt: "desc" },
take: 20,
skip: 0,
});
const counts = await prisma.post.aggregate({ _count: true, where: { published: true } });
// Independent writes in one transaction
const [published, total] = await prisma.$transaction([
prisma.post.update({ where: { id: page[0].id }, data: { published: false } }),
prisma.post.count(),
]);
// Interactive transaction
await prisma.$transaction(async (tx) => {
const user = await tx.user.findUniqueOrThrow({ where: { email: "[email protected]" } });
Установить prisma в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл prisma?
Prisma ORM is a TypeScript database toolkit with a declarative schema, a generated type-safe client, and a migration system for PostgreSQL, MySQL/MariaDB, SQLite, SQL Server, CockroachDB and MongoDB. Use when someone asks to "set up Prisma", "write a Prisma schema", "run a Prisma migration", "query with Prisma Client", "fix Prisma 7 adapter errors", or "upgrade from prisma-client-js".
Как установить скилл prisma?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл prisma запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic