prisma-upgrade-v7
This skill guides agents through migrating projects from Prisma ORM v6 to v7, covering critical breaking changes including the new prisma-client generator…
Identity proven by GitHub's verified organisation badge (prisma)
- Agents
- Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode, claude.ai and API
- License
- MIT (permissive)
- Pin
- be16a87pinned Oct 9, 2026
- Context cost
- about 1,900 tokenswhen the skill loads
- GitHub stars
- 67on prisma/skills
- Scripts
- None found
What it does
“Complete migration guide from Prisma ORM v6 to v7 covering all breaking changes. Use when upgrading Prisma versions, encountering v7 errors, or migrating existing projects. Triggers on "upgrade to prisma 7", "prisma 7 migration", "prisma-client generator", "driver adapter required".”
Generated summary from the skill's own text
This skill guides agents through migrating projects from Prisma ORM v6 to v7, covering critical breaking changes including the new prisma-client generator, mandatory driver adapters for SQL databases, ESM-first module configuration, and the new prisma.config.ts setup. It provides step-by-step upgrade instructions, explains removed features like middleware and metrics, and offers troubleshooting for common migration issues.
When to use it
- Upgrading Prisma projects from v6 to v7
- Resolving import or generator errors after Prisma version updates
- Setting up driver adapters for SQL databases
- Configuring ESM or CommonJS module formats for Prisma 7
When not to
- Projects using MongoDB, which require Prisma 6.x or Prisma 8 instead
- Environments running Node.js below 20.19.0 or TypeScript below 5.4.0
Install
These commands install from the publisher's repository and need no account.
skills CLI
npx skills add prisma/skills --skill prisma-upgrade-v7Installs from the repository's default branch, which may have changed since the commit we checked.
GitHub CLI 2.90 or later
gh skill install prisma/skills prisma-upgrade-v7@be16a8740d01363d13552b317042431ee8dfc581Installs the commit we checked (be16a87).
Copy by hand
Download the folder at be16a87 and put it in .claude/skills/prisma-upgrade-v7 for Claude Code and in .agents/skills/prisma-upgrade-v7 for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode.
Copy for your agent
A prompt for any coding agent. It installs this skill from GitHub at the pinned commit, copies the files as they are, and runs nothing unless you ask.
Prompt
Install the agent skill "prisma-upgrade-v7" by Prisma. Source, pinned to commit be16a8740d01363d13552b317042431ee8dfc581: https://github.com/prisma/skills/tree/be16a8740d01363d13552b317042431ee8dfc581/prisma-upgrade-v7 1. Download that folder at exactly this commit. Do not use the default branch. 2. Copy every file unchanged, keeping the folder structure, into .claude/skills/prisma-upgrade-v7/ for Claude Code and .agents/skills/prisma-upgrade-v7/ for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode. Create the folders if they do not exist. 3. Do not edit the files, and do not run any script in the folder unless I ask you to. 4. When you are done, list the files you copied and where you put them. Listing and checks: https://www.agentnative.dev/skills/prisma/prisma-upgrade-v7
SKILL.md at the pin
---
name: prisma-upgrade-v7
description: Complete migration guide from Prisma ORM v6 to v7 covering all breaking changes. Use when upgrading Prisma versions, encountering v7 errors, or migrating existing projects. Triggers on "upgrade to prisma 7", "prisma 7 migration", "prisma-client generator", "driver adapter required".
license: MIT
metadata:
author: prisma
version: "7.6.0"
---
# Upgrade to Prisma ORM 7
Complete guide for migrating from Prisma ORM v6 to v7. This upgrade introduces significant breaking changes around the new `prisma-client` generator, driver adapters, `prisma.config.ts`, explicit environment loading, and generated client entrypoints.
## When to Apply
Reference this skill when:
- Upgrading from Prisma v6 to v7
- Updating to the `prisma-client` generator
- Setting up driver adapters
- Configuring `prisma.config.ts`
- Fixing import errors after upgrade
## Rule Categories by Priority
| Priority | Category | Impact | Prefix |
|----------|----------|--------|--------|
| 1 | Schema Migration | CRITICAL | `schema-changes` |
| 2 | Database Connectivity | CRITICAL | `driver-adapters` |
| 3 | Module System | CRITICAL | `esm-support` |
| 4 | Config and Env | HIGH | `prisma-config`, `env-variables` |
| 5 | Removed Features | HIGH | `removed-features` |
| 6 | Accelerate | HIGH | `accelerate-users` |
## Quick Reference
- `schema-changes` - generator migration, required output paths, generated entrypoints, and `Prisma.validator` replacement
- `driver-adapters` - required adapter installation for SQL providers, pool differences, and Prisma Postgres adapter choices
- `esm-support` - ESM-first setup plus CommonJS fallback with `moduleFormat = "cjs"`
- `prisma-config` - creating and using `prisma.config.ts`
- `env-variables` - explicit environment loading
- `removed-features` - removed middleware, metrics, and legacy CLI behavior
- `accelerate-users` - migration notes for Accelerate users
## Using MongoDB? This guide does not apply
Prisma 7 has no MongoDB connector. Do not apply any step in this guide to a project with
`provider = "mongodb"` — see the `prisma-mongodb-upgrade` skill for the actual decision
(stay on v6 deliberately vs migrate to Prisma 8).
## Important Notes
- **MongoDB projects should stay on Prisma 6.x or migrate to Prisma 8** - do not migrate MongoDB apps to Prisma 7's SQL client path (see `prisma-mongodb-upgrade`)
- **Node.js 20.19.0+** required
- **TypeScript 5.4.0+** required
- **Latest stable Prisma ORM version**: `7.6.0`
## Upgrade Steps Overview
1. Update packages to v7
2. Choose your module format (`esm` by default, `cjs` if needed)
3. Update TypeScript configuration
4. Update the schema generator block
5. Create `prisma.config.ts`
6. Install and configure a driver adapter for SQL providers
7. Update Prisma Client imports
8. Update client instantiation
9. Replace deprecated helper patterns like `Prisma.validator`
10. Run `prisma generate` and test
## Quick Upgrade Commands
```bash
# Update packages
npm install @prisma/client@7
npm install -D prisma@7
# Install a driver adapter (PostgreSQL or Prisma Postgres via direct TCP)
npm install @prisma/adapter-pg pg
# Install dotenv for env loading
npm install dotenv
# Regenerate client
npx prisma generate
```
## Breaking Changes Summary
| Change | v6 | v7 |
|--------|----|----|
| Module format | Implicit / mixed | ESM-first, `moduleFormat = "cjs"` supported |
| Generator provider | `prisma-client-js` | `prisma-client` is the default, while `prisma-client-js` still exists for legacy setups |
| Output path | Auto (node_modules) | Required explicit |
| Driver adapters | Optional | Required for SQL providers |
| Config file | `.env` + schema | `prisma.config.ts` |
| Env loading | Automatic | Manual (dotenv) |
| Generated entrypoints | Single package export | `client`, `browser`, `models`, `enums` entrypoints |
| Type-safe query fragments | `Prisma.validator()` | TypeScript `satisfies` |
| Middleware | `$use()` | Client Extensions |
| Metrics | Preview feature | Removed |
## Rule Files
Detailed migration guides for each breaking change:
```
references/esm-support.md - ESM and CommonJS configuration
references/schema-changes.md - Generator, output, imports, and generated entrypoints
references/driver-adapters.md - Required driver adapter setup
references/prisma-config.md - New configuration file
references/env-variables.md - Environment variable loading
references/removed-features.md - Middleware, metrics, and CLI flags
references/accelerate-users.md - Special handling for Accelerate
```
## Step-by-Step Migration
### 1. Update package.json for ESM-first projects
```json
{
"type": "module"
}
```
If you need to stay on CommonJS, keep your app as CJS and set `moduleFormat = "cjs"` in the generator block instead of forcing ESM.
### 2. Update tsconfig.json
```json
{
"compilerOptions": {
"module": "ESNext",
"moduleResolution": "bundler",
"target": "ES2023",
"strict": true,
"esModuleInterop": true
}
}
```
### 3. Update schema.prisma
```prisma
// Before (v6)
generator client {
provider = "prisma-client-js"
}
// After (v7)
generator client {
provider = "prisma-client"
output = "../generated/prisma"
// Optional if you need CommonJS:
// moduleFormat = "cjs"
}
```
### 4. Create prisma.config.ts
```typescript
import 'dotenv/config'
import { defineConfig, env } from 'prisma/config'
export default defineConfig({
schema: 'prisma/schema.prisma',
migrations: {
path: 'prisma/migrations',
},
datasource: {
url: env('DATABASE_URL'),
},
})
```
### 5. Install a driver adapter (SQL providers only)
```bash
# PostgreSQL
npm install @prisma/adapter-pg pg
# MySQL
npm install @prisma/adapter-mariadb mariadb
# SQLite
npm install @prisma/adapter-better-sqlite3 better-sqlite3
# Prisma Postgres in standard Node.js apps (recommended)
npm install @prisma/adapter-pg pg
# Prisma Postgres serverless driver (edge/serverless)
npm install @prisma/adapter-ppg @prisma/ppg
# Neon
npm install @prisma/adapter-neon
```
MongoDB does not have a SQL `@prisma/adapter-*` package in the published Prisma 7.6.0 packages. If you're upgrading a MongoDB project, stop and keep that project on the latest Prisma 6.x release instead of following the standard Prisma 7 migration path.
### 6. Update client instantiation
```typescript
// Before (v6)
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
// After (v7)
import { PrismaClient } from '../generated/prisma/client'
import { PrismaPg } from '@prisma/adapter-pg'
const adapter = new PrismaPg({
connectionString: process.env.DATABASE_URL
})
const prisma = new PrismaClient({ adapter })
```
### 7. Replace Prisma.validator with satisfies
```typescript
import { Prisma } from '../generated/prisma/client'
const userSelect = {
id: true,
email: true,
name: true,
} satisfies Prisma.UserSelect
```
### 8. Run migrations and generate
```bash
npx prisma generate
npx prisma migrate dev # if needed
```
## Troubleshooting
### "Cannot find module" errors
- Check that the generator `output` path matches your import path
- Ensure `prisma generate` ran successfully
### SSL certificate errors
- Add `ssl: { rejectUnauthorized: false }` to the adapter config if you need to preserve old behavior
- Or configure your certificates properly with `NODE_EXTRA_CA_CERTS` / OpenSSL CA settings
### Connection timeout issues
- Driver adapters use the underlying driver's defaults, which differ from v6
- Configure pool settings explicitly on the adapter if needed
## Resources
- [Official v7 Upgrade Guide](https://www.prisma.io/docs/orm/more/upgrades/to-v7)
- [Driver Adapters Documentation](https://www.prisma.io/docs/orm/core-concepts/supported-databases/database-drivers)
- [Prisma Config Reference](https://www.prisma.io/docs/orm/reference/prisma-config-reference)
## How to Use
Follow `references/schema-changes.md` and `references/driver-adapters.md` first, then apply the remaining reference files based on your project setup.
From prisma/skills at be16a87, shown as plain text under its license: MIT (permissive). The license text is in prisma-upgrade-v7/SKILL.md.
View SKILL.md on GitHub at be16a87Files
- SKILL.md8.1 KB · 03d79d99b613
- references/
- accelerate-users.md3.5 KB · fa70c8d9b0ca
- driver-adapters.md6.1 KB · 5c4b4877492e
- env-variables.md3.4 KB · 5b11d1d625be
- esm-support.md3.2 KB · 558b2cff56a3
- prisma-config.md3.4 KB · 84e372368b20
- removed-features.md4.8 KB · eb88f9dd5acf
- schema-changes.md3.6 KB · cfd913c0d58b
8 files, 36 KB in total. Each file has a sha256 in the pin's manifest; the first 12 characters are shown.
Skill folder on GitHub at be16a87More from Prisma
prisma-8
This skill helps agents work with Prisma 8, a contract-first data layer for TypeScript projects.
Contains scripts
Claude Code, Codex, Cursor +3 · about 3.5K tokens · pinned 6 days ago
adr-review
This skill reviews Architecture Decision Records (ADRs) from a fresh perspective, identifying clarity and structural issues, then rewrites them for future…
Claude Code, Codex, Cursor +4 · about 590 tokens · pinned 6 days ago
ast-visitor-pattern
This skill teaches agents to use the visitor pattern with frozen subclasses for discriminated unions that need multiple dispatch sites.
Claude Code, Codex, Cursor +4 · about 710 tokens · pinned 6 days ago
bumping-biome
Updates the biome code formatter package to a specified version using pnpm, renames configuration files to biome.jsonc format, updates schema references, and…
Claude Code, Codex, Cursor +4 · about 290 tokens · pinned 6 days ago
contrib-pr
This skill guides external contributors through opening a pull request against prisma-next by following the project's contribution guidelines.
Claude Code, Codex, Cursor +4 · about 2.2K tokens · pinned 6 days ago
create-pr
This skill creates a GitHub pull request with a Linear-ticket-prefixed title and a decision-led narrative description for the prisma-next repository.
Claude Code, Codex, Cursor +4 · about 4.3K tokens · pinned 6 days ago
Related in Backend and APIs
prisma-next-supabase
This skill enables Prisma Next to work with Supabase projects, including row-level security (RLS) policies, cross-space foreign keys to auth.users, and…
by PrismaOfficial publisher
Claude Code, Codex, Cursor +4 · about 5.3K tokens · pinned 6 days ago
prisma-composer
This skill enables the agent to work with Prisma Composer applications by locating and reading the appropriate Composer skill documentation that matches the…
by PrismaOfficial publisher
Cursor · about 230 tokens · pinned 6 days ago
backend-dev-guidelines
This skill establishes backend development patterns for Node.js/Express/TypeScript microservices, covering layered architecture with routes, controllers…
by diet103Community
Claude Code, Codex, Cursor +4 · about 1.9K tokens · pinned 6 days ago
nvflare-orient
Routes NVFLARE requests to appropriate downstream skills based on user intent and preliminary source inspection findings.
by NVIDIAOfficial publisher
Claude Code, Codex, Cursor +4 · about 600 tokens · pinned 6 days ago
cloudflare-email-service
This skill enables agents to send transactional emails and route incoming emails using Cloudflare's Email Service platform.
by CloudflareOfficial publisher
Claude Code, Codex, Cursor +4 · about 1.6K tokens · pinned 6 days ago
durable-objects
Build and debug Cloudflare Durable Objects applications for stateful coordination and persistent storage on the edge.
by CloudflareOfficial publisher
Claude Code, Codex, Cursor +4 · about 1.5K tokens · pinned 6 days ago