$npx -y skills add prisma/skills --skill prisma-cliPrisma ORM CLI commands reference covering init, generate, migrate, db, dev, studio, validate, format, debug, and mcp. Use for ORM/database CLI workflows, not Prisma Compute app deployment. For Prisma Compute, @prisma/cli app deploy, compute:deploy, create-prisma --deploy,
| 1 | # Prisma CLI Reference |
| 2 | |
| 3 | Reference for Prisma ORM CLI commands. This skill provides guidance on command usage, options, and best practices for current Prisma ORM releases. |
| 4 | |
| 5 | ## Boundary: Compute |
| 6 | |
| 7 | Do not use this skill for Prisma Compute app deployment. Use `prisma-compute` for `@prisma/cli app deploy`, `compute:deploy`, `create-prisma --deploy`, Compute apps, deployments, logs, domains, and framework deploy readiness. |
| 8 | |
| 9 | ## When to Apply |
| 10 | |
| 11 | Reference this skill when: |
| 12 | - Setting up a new Prisma project (`prisma init`) |
| 13 | - Generating Prisma Client (`prisma generate`) |
| 14 | - Running database migrations (`prisma migrate`) |
| 15 | - Managing database state (`prisma db push/pull`) |
| 16 | - Using local development database (`prisma dev`) |
| 17 | - Debugging Prisma issues (`prisma debug`) |
| 18 | |
| 19 | ## Rule Categories by Priority |
| 20 | |
| 21 | | Priority | Category | Impact | Prefix | |
| 22 | |----------|----------|--------|--------| |
| 23 | | 1 | Setup | HIGH | `init` | |
| 24 | | 2 | Generation | HIGH | `generate` | |
| 25 | | 3 | Development | HIGH | `dev` | |
| 26 | | 4 | Database | HIGH | `db-` | |
| 27 | | 5 | Migrations | CRITICAL | `migrate-` | |
| 28 | | 6 | Utility | MEDIUM | `studio`, `validate`, `format`, `debug`, `mcp` | |
| 29 | |
| 30 | ## Command Categories |
| 31 | |
| 32 | | Category | Commands | Purpose | |
| 33 | |----------|----------|---------| |
| 34 | | Setup | `init` | Bootstrap new Prisma project | |
| 35 | | Generation | `generate` | Generate Prisma Client | |
| 36 | | Validation | `validate`, `format` | Schema validation and formatting | |
| 37 | | Development | `dev` | Local Prisma Postgres for development | |
| 38 | | Database | `db pull`, `db push`, `db seed`, `db execute` | Direct database operations | |
| 39 | | Migrations | `migrate dev`, `migrate deploy`, `migrate reset`, `migrate status`, `migrate diff`, `migrate resolve` | Schema migrations | |
| 40 | | Utility | `studio`, `mcp`, `version`, `debug` | Development and AI tooling | |
| 41 | |
| 42 | ## Quick Reference |
| 43 | |
| 44 | ### Project Setup |
| 45 | |
| 46 | ```bash |
| 47 | # Initialize new project (creates prisma/ folder and prisma.config.ts) |
| 48 | prisma init |
| 49 | |
| 50 | # Initialize with specific database |
| 51 | prisma init --datasource-provider postgresql |
| 52 | prisma init --datasource-provider mysql |
| 53 | prisma init --datasource-provider sqlite |
| 54 | |
| 55 | # Initialize with Prisma Postgres (cloud) |
| 56 | prisma init --db |
| 57 | |
| 58 | # Initialize with an example model |
| 59 | prisma init --with-model |
| 60 | ``` |
| 61 | |
| 62 | ### Client Generation |
| 63 | |
| 64 | ```bash |
| 65 | # Generate Prisma Client |
| 66 | prisma generate |
| 67 | |
| 68 | # Watch mode for development |
| 69 | prisma generate --watch |
| 70 | |
| 71 | # Generate specific generator only |
| 72 | prisma generate --generator client |
| 73 | ``` |
| 74 | |
| 75 | ### Bun Runtime |
| 76 | |
| 77 | When using Bun, always add the `--bun` flag so Prisma runs with the Bun runtime (otherwise it falls back to Node.js because of the CLI shebang): |
| 78 | |
| 79 | ```bash |
| 80 | bunx --bun prisma init |
| 81 | bunx --bun prisma generate |
| 82 | ``` |
| 83 | |
| 84 | ### Local Development Database |
| 85 | |
| 86 | ```bash |
| 87 | # Start local Prisma Postgres |
| 88 | prisma dev |
| 89 | |
| 90 | # Start with specific name |
| 91 | prisma dev --name myproject |
| 92 | |
| 93 | # Start in background (detached) |
| 94 | prisma dev --detach |
| 95 | |
| 96 | # List all local instances |
| 97 | prisma dev ls |
| 98 | |
| 99 | # Stop instance |
| 100 | prisma dev stop myproject |
| 101 | |
| 102 | # Remove instance data |
| 103 | prisma dev rm myproject |
| 104 | ``` |
| 105 | |
| 106 | ### Database Operations |
| 107 | |
| 108 | ```bash |
| 109 | # Pull schema from existing database |
| 110 | prisma db pull |
| 111 | |
| 112 | # Push schema to database (no migrations) |
| 113 | prisma db push |
| 114 | |
| 115 | # Seed database |
| 116 | prisma db seed |
| 117 | |
| 118 | # Execute raw SQL |
| 119 | prisma db execute --file ./script.sql |
| 120 | ``` |
| 121 | |
| 122 | ### Migrations (Development) |
| 123 | |
| 124 | ```bash |
| 125 | # Create and apply migration |
| 126 | prisma migrate dev |
| 127 | |
| 128 | # Create migration with name |
| 129 | prisma migrate dev --name add_users_table |
| 130 | |
| 131 | # Create migration without applying |
| 132 | prisma migrate dev --create-only |
| 133 | |
| 134 | # Reset database and apply all migrations |
| 135 | prisma migrate reset |
| 136 | ``` |
| 137 | |
| 138 | ### Migrations (Production) |
| 139 | |
| 140 | ```bash |
| 141 | # Apply pending migrations (CI/CD) |
| 142 | prisma migrate deploy |
| 143 | |
| 144 | # Check migration status |
| 145 | prisma migrate status |
| 146 | |
| 147 | # Compare schemas and generate diff |
| 148 | prisma migrate diff --from-config-datasource --to-schema schema.prisma --script |
| 149 | ``` |
| 150 | |
| 151 | ### Utility Commands |
| 152 | |
| 153 | ```bash |
| 154 | # Open Prisma Studio (database GUI) |
| 155 | prisma studio |
| 156 | |
| 157 | # Start Prisma's MCP server for AI tools |
| 158 | prisma mcp |
| 159 | |
| 160 | # Show version info |
| 161 | prisma version |
| 162 | prisma -v |
| 163 | |
| 164 | # Debug information |
| 165 | prisma debug |
| 166 | |
| 167 | # Validate schema |
| 168 | prisma validate |
| 169 | |
| 170 | # Format schema |
| 171 | prisma format |
| 172 | ``` |
| 173 | |
| 174 | ## Current Prisma CLI Setup |
| 175 | |
| 176 | ### New Configuration File |
| 177 | |
| 178 | Use `prisma.config.ts` for CLI configuration: |
| 179 | |
| 180 | ```typescript |
| 181 | import 'dotenv/config' |
| 182 | import { defineConfig, env } from 'prisma/config' |
| 183 | |
| 184 | export default defineConfig({ |
| 185 | schema: 'prisma/schema.prisma', |
| 186 | migrations: { |
| 187 | path: 'prisma/migrations', |
| 188 | seed: 'tsx prisma/seed.ts', |
| 189 | }, |
| 190 | datasource: { |
| 191 | url: env('DATABASE_URL'), |
| 192 | }, |
| 193 | }) |
| 194 | ``` |
| 195 | |
| 196 | ### Current Co |