All skills
prisma avatar

/prisma-cli

@b491588 official
by prismaprisma/skills66 stars
7

Prisma ORM 7 CLI reference for existing Prisma 7 applications or explicitly selected Prisma 7 workflows. Covers prisma init, generate, migrate, db, dev, studio, and mcp. For setup, connection repair, or Prisma 8, use prisma-orm-setup; not the Prisma Platform CLI.

Use this Skill: https://skilld.dev/gh/prisma/skills/prisma-cli

This session only. Nothing lands on disk.

referencesgenerate.md

≈877 tokens on demand. Your agent reads this file only when SKILL.md points to it.

prisma generate

Generates assets based on the generator blocks in your Prisma schema, most commonly Prisma Client.

Command

prisma generate [options]

Bun Runtime

If you're using Bun, run Prisma with bunx --bun so it doesn't fall back to Node.js:

bunx --bun prisma generate

What It Does

  1. Reads your schema.prisma file
  2. Generates a customized Prisma Client based on your models
  3. Outputs to the directory specified in the generator block

Options

Option Description
--schema Custom path to your Prisma schema
--config Custom path to your Prisma config file
--sql Generate typed sql module
--watch Watch the Prisma schema and rerun after a change
--generator Generator to use (may be provided multiple times)
--no-hints Hides the hint messages but still outputs errors and warnings
--require-models Do not allow generating a client without models

Examples

Basic generation

prisma generate

Watch mode (development)

prisma generate --watch

Auto-regenerates when schema.prisma changes.

Specific generator

prisma generate --generator client

Multiple generators

prisma generate --generator client --generator zod_schemas

Typed SQL generation

prisma generate --sql

Schema Configuration

generator client {
  provider = "prisma-client"
  output   = "../generated"
}

Current Generator Behavior

  • prisma-client is the standard generator
  • output is required when using prisma-client
  • prisma-client supports both ESM and CommonJS via moduleFormat
  • compilerBuild supports fast and small query compiler artifacts
  • Use TypeScript satisfies for typed query fragments with prisma-client
  • Import Prisma Client from your generated output path, for example:
import { PrismaClient } from '../generated/prisma/client'

Compiler Build Tuning

Use compilerBuild when you need to trade artifact size against the default build:

generator client {
  provider      = "prisma-client"
  output        = "../generated"
  compilerBuild = "small"
}
  • fast is the default build for most targets
  • small is useful for size-constrained targets
  • Prisma defaults vercel-edge targets to small

Common Patterns

After schema changes

prisma migrate dev --name my_migration
prisma generate

Run prisma generate whenever you need refreshed client code after schema-changing commands.

CI/CD pipeline

prisma generate

Run before building your application.

Multiple generators

generator client {
  provider = "prisma-client"
  output   = "../generated"
}

generator zod {
  provider = "zod-prisma-types"
  output   = "../generated/zod"
}
prisma generate  # Runs all generators

Output Structure

After running prisma generate, your output directory contains:

generated/
├── browser.ts
├── client.ts
├── commonInputTypes.ts
├── models/
├── enums.ts
├── models.ts
└── ...

Import the client:

import { PrismaClient, Prisma } from '../generated/prisma/client'

Import browser-safe types:

import { Prisma } from '../generated/prisma/browser'
import { Role } from '../generated/prisma/enums'
import type { UserModel } from '../generated/prisma/models/User'

Source: SKILL.md on GitHub

No alerts1d5 checks · Risk SAFE
  • Gen Agent Trust Hub1d

    This skill provides a comprehensive reference for Prisma ORM CLI commands, covering project initialization, migrations, and database management. It includes specific safety guidelines to prevent AI agents from executing destructive commands without explicit user consent. No security issues were detected.

  • Socket1d

    No alerts

  • Snyk1d

    Risk: LOW · No issues

  • Runlayer7mo

    4/18 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at b491588. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 2 days ago
metadata
{
  "author": "prisma",
  "version": "7.9.1"
}

README badge

README badge for prisma/skills/prisma-cli

Provides reference documentation and guidance for Prisma ORM CLI commands including init, generate, migrate, db operations, studio, and mcp. Use this skill for Prisma project setup, migrations, schema management, and local development workflows; do not use it for Prisma Compute app deployment.

Generated from the current SKILL.md.

Does this skill cover Prisma Compute deployment?
No. This skill covers Prisma ORM CLI commands only (init, generate, migrate, db, studio, etc.). Use the prisma-compute skill for app deploy, compute:deploy, and Compute-related commands.
What database systems does this skill support?
Prisma ORM with PostgreSQL, MySQL, SQLite, and Prisma Postgres (cloud). The skill documents provider-specific initialization flags.
Does this skill work with Bun?
Yes. The skill documents that you must use the `--bun` flag when running Prisma commands via Bun (e.g. `bunx --bun prisma generate`) so Prisma runs with the Bun runtime instead of falling back to Node.js.
Does this skill cover development workflows only, or production too?
Both. It covers development commands (prisma dev, migrate dev) and production workflows (prisma migrate deploy for CI/CD, prisma db push for schema sync).
What version of Prisma does this skill target?
Prisma 7.6.0 and current releases. It documents the current prisma.config.ts configuration format and CLI behavior.

Generated from the current SKILL.md. These answers refresh after source changes.