mcpbeat Sign in

Prisma Upgrade V7 Prisma Config Skill for Cursor

Prisma Config. Reference when using this Prisma feature.

923 tokens
context cost
the whole folder, loaded on every use
2
files
instructions only
0
copies elsewhere
how many repositories repackaged it
8
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/prisma/cursor-plugin --skill prisma-upgrade-v7-prisma-config

What comes with it

111 bytes besides the instruction
metadata.json

The instruction itself

19 sections, as written by the author

Prisma Config

Prisma v7 introduces prisma.config.ts as the central configuration file for the Prisma CLI.

Location

Place prisma.config.ts at your project root (next to package.json).

Basic Configuration

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'),
  },
})

Configuration Options

schema

Path to your Prisma schema file:

schema: 'prisma/schema.prisma'

datasource.url

Database connection URL:

datasource: {
  url: env('DATABASE_URL'),
}

datasource.directUrl

Direct connection URL (bypassing connection pooler):

datasource: {
  url: env('DATABASE_URL'),
  directUrl: env('DIRECT_DATABASE_URL'),
}

datasource.shadowDatabaseUrl

Shadow database for migrations:

datasource: {
  url: env('DATABASE_URL'),
  shadowDatabaseUrl: env('SHADOW_DATABASE_URL'),
}

migrations.path

Directory for migration files:

migrations: {
  path: 'prisma/migrations',
}

migrations.seed

Seed command for prisma db seed:

migrations: {
  path: 'prisma/migrations',
  seed: 'tsx prisma/seed.ts',
}

Full Example

import 'dotenv/config'
import { defineConfig, env } from 'prisma/config'

export default defineConfig({
  // Schema location
  schema: 'prisma/schema.prisma',
  
  // Migration configuration
  migrations: {
    path: 'prisma/migrations',
    seed: 'tsx prisma/seed.ts',
  },
  
  // Database connection
  datasource: {
    url: env('DATABASE_URL'),
    directUrl: env('DIRECT_DATABASE_URL'),
    shadowDatabaseUrl: env('SHADOW_DATABASE_URL'),
  },
})

Environment Variables

The env() helper

Use env() to reference environment variables:

import { env } from 'prisma/config'

datasource: {
  url: env('DATABASE_URL'),
}

This provides type safety but does NOT load .env files automatically.

Loading .env files

Install and import dotenv:

npm install dotenv
import 'dotenv/config'  // Must be first import
import { defineConfig, env } from 'prisma/config'

Migrating from v6

Before (v6) - schema.prisma

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

After (v7) - prisma.config.ts

import 'dotenv/config'
import { defineConfig, env } from 'prisma/config'

export default defineConfig({
  schema: 'prisma/schema.prisma',
  datasource: {
    url: env('DATABASE_URL'),
    directUrl: env('DIRECT_URL'),
  },
})

And update schema.prisma:

datasource db {
  provider = "postgresql"
  // URLs now in prisma.config.ts
}

Custom Config Path

Use --config flag with CLI commands:

prisma migrate dev --config ./config/prisma.config.ts

Monorepo Configuration

import 'dotenv/config'
import { defineConfig, env } from 'prisma/config'
import path from 'path'

export default defineConfig({
  schema: path.join(__dirname, 'packages/database/prisma/schema.prisma'),
  migrations: {
    path: path.join(__dirname, 'packages/database/prisma/migrations'),
  },
  datasource: {
    url: env('DATABASE_URL'),
  },
})

How to use it

Copy the folder

Take prisma/prisma-upgrade-v7-prisma-config from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.

Install what it needs

The instructions reference npm. Without those the skill loads but fails at the first command.