Skip to content
AI Skills Central

Type to search Agent Skills, workflows, tutorials, tools and the glossary.

Agent Skill

Prisma 6 to 7 upgrade (Prisma)

Moves a SQL project from Prisma ORM 6 to 7: the prisma-client generator, a required driver adapter, prisma.config.ts, explicit .env loading and removed APIs.

name: prisma-upgrade-v7By PrismaChecked
View source on GitHub
Bookmark

Bookmarks are kept in your free account, so you can find this page again on any device.

Sign in to bookmark

Install

Commands are pinned to commit a6f1929, the version we read, wherever the install method supports it.

npx skills

Terminal
npx skills add prisma/skills@a6f192959cf43b08aa330fe1ffca090267215812 --skill prisma-upgrade-v7 -a claude-code

Copies the skill into .claude/skills/ in this project, pinned to the reviewed commit.

What it does

It walks the agent through Prisma’s breaking changes from version 6 to 7 in a fixed order of priority: the schema’s generator block first, then database connectivity, the module system, configuration and environment variables, removed features and, last, Accelerate. In practice that means switching provider = "prisma-client-js" to prisma-client with an explicit output path, adding a prisma.config.ts, installing a driver adapter for your database (@prisma/adapter-pg for PostgreSQL, @prisma/adapter-mariadb for MySQL, @prisma/adapter-better-sqlite3 for SQLite and others), importing the client from the generated folder instead of @prisma/client, loading .env yourself with dotenv, and replacing Prisma.validator() with TypeScript’s satisfies.

The seven reference files carry the detail the SKILL.md only lists: ESM versus CommonJS (moduleFormat = "cjs" keeps a CommonJS app working), pool and SSL settings that now come from the driver rather than Prisma, the removed environment variables and CLI flags, and how to keep prisma:// Accelerate URLs away from driver adapters.

When to use it

A TypeScript or JavaScript app on Prisma ORM 6 with PostgreSQL, MySQL, SQLite, SQL Server or CockroachDB that you want on Prisma 7. The upgrade touches config, imports and runtime behaviour at once, and models trained on Prisma 6 docs will happily write new PrismaClient() with no adapter, or expect migrate dev to run your seed script. The skill catches those, and its troubleshooting section covers the two surprises teams report most: connection timeouts because the driver’s pool defaults differ from Prisma 6’s, and certificate errors because SSL is now the driver’s job. Pair it with our dependency upgrade workflow, which keeps the change on a branch and makes the agent prove the tests still pass.

When to skip it

MongoDB projects: Prisma 7 has no MongoDB connector, and the skill says so at the top; the same repository’s prisma-mongodb-upgrade skill covers that decision. Skip it too if you are going to Prisma 8 rather than stopping at 7. Prisma’s own v7 upgrade guide says a PostgreSQL app on Prisma 6 does not have to pass through 7, and the repository has a separate prisma-postgres-upgrade skill for going straight to 8. On 25 November 2026 Prisma 8 was still a release candidate on npm.

Two dated details to correct as you go. The SKILL.md says the latest stable release is 7.6.0 (its metadata.version); npm listed 7.10.1, released on 15 October 2026, as the newest 7.x on 25 November 2026, so let the agent install prisma@7 and check what it resolved. And the “Official v7 Upgrade Guide” link in its Resources section returned a 404 when we checked; the guide now lives at the address above.

Try it

Upgrade this Express API from Prisma 6.19 to Prisma 7. We use PostgreSQL
on RDS with a self-signed certificate, the app is CommonJS, and our CI
runs prisma migrate deploy then npm test. Keep the old pool size of 10.

What it can touch

Bundles scripts
No
Pre-approved tools
None declared
Needs
A Prisma ORM 6 project on a SQL database (not MongoDB); Node.js 20.19.0 or later and TypeScript 5.4.0 or later
Client-specific fields
None, spec fields only

Its instructions steer what your agent does, and it may have changed since the commit we read. How to check a skill.

Instructions only: no scripts and no allowed-tools. Following them, the agent edits package.json, tsconfig.json, schema.prisma and every file that imports the client, creates prisma.config.ts, installs packages with your package manager and runs prisma generate. If it runs prisma migrate dev or migrate reset, that changes the database it points at, so give it a development database. One troubleshooting tip sets ssl: { rejectUnauthorized: false } on the adapter to match old behaviour; that turns off certificate checking, so ask for a proper CA setup (the other option it offers) in production. metadata carries author and version, so nothing is non-portable.

At commit a6f1929 the SKILL.md is 259 lines long. Alongside it:

  • references/ (7 entries): schema-changes.md (generator, output paths, generated entrypoints), driver-adapters.md (one setup per database, pool and SSL settings, a singleton pattern), esm-support.md, prisma-config.md, env-variables.md (including the twelve removed PRISMA_* variables), removed-features.md (middleware, metrics, CLI flags, automatic generate and seed) and accelerate-users.md.

Alternatives

Prisma ORM setup from the same repository handles new projects and connection problems, and sends major upgrades to skills like this one. For Postgres apps that are moving to Prisma 8, use the repository’s prisma-postgres-upgrade skill, not listed in our directory yet. If the upgrade is part of a wider framework migration, the framework migration recipe shows how to write your own skill for the steps that are specific to your codebase.

SKILL.md

The file exactly as published at the reviewed commit, reproduced under its MIT licence.

prisma-upgrade-v7/SKILL.md
---
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.
  • Prisma ORM setup (Prisma)

    Prisma's skill for setting up Prisma ORM in a new or existing app, defaulting new projects to Prisma 8 and keeping Prisma 6 and 7 apps on their version.

    Checked at a6f1929

  • Postgres best practices (Supabase)

    Supabase's Postgres rules for schema, indexes, RLS, migrations, connections and slow queries. Works for Postgres anywhere, not just Supabase.

    Checked at c9be0e9

  • ClickHouse best practices

    ClickHouse's own review rules: checks schemas, queries and inserts against 36 rule files, cites each rule, and caps every query an agent runs on your data.

    Checked at 1008fd7