Agent Skill
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.
Bookmark
Bookmarks are kept in your free account, so you can find this page again on any device.
Sign in to bookmarkInstall
Commands are pinned to commit a6f1929, the version we read, wherever the install method supports it.
npx skills
npx skills add prisma/skills@a6f192959cf43b08aa330fe1ffca090267215812 --skill prisma-orm-setup -a claude-codeCopies the skill into .claude/skills/ in this project, pinned to the reviewed commit.
npx skills
npx skills add prisma/skills@a6f192959cf43b08aa330fe1ffca090267215812 --skill prisma-orm-setup -a codexInstalls to .agents/skills/, which Codex scans from the working directory up to the repo root.
npx skills
npx skills add prisma/skills@a6f192959cf43b08aa330fe1ffca090267215812 --skill prisma-orm-setup -a cursorInstalls to .agents/skills/, one of the folders Cursor reads skills from.
gh skill
gh skill install prisma/skills prisma-orm-setup --pin a6f192959cf43b08aa330fe1ffca090267215812 --agent github-copilotNeeds GitHub CLI 2.90.0 or later. Use --scope user to install for every repository.
npx skills
npx skills add prisma/skills@a6f192959cf43b08aa330fe1ffca090267215812 --skill prisma-orm-setupPinned to the commit we reviewed. The CLI asks which agents to install for; add -g to install for your user instead of this project.
What it does
Prisma’s skill for getting Prisma ORM into an application, or fixing the database connection of one that already has it. It starts by detecting where the project stands from the package manifest, lockfile, Prisma config, schema and imports, and warns that the CLI version alone does not tell you the app’s ORM version. New applications go to Prisma ORM 8: the agent resolves and pins a published release, runs prisma orm init with the right target, and then loads the version-specific guidance that ships inside the installed Prisma 8 package. Existing Prisma 6 and 7 apps stay on their version, with reference files per provider (PostgreSQL, MySQL, SQLite, SQL Server, CockroachDB, Prisma Postgres, and MongoDB on Prisma 6). Major upgrades are handled as a separate task, and the last step connects and verifies.
When to use it
Adding Prisma to a new TypeScript project, connecting an existing Prisma app to a new database, or debugging connection errors. It is most useful because Prisma’s setup changed across versions 6, 7 and 8, and models trained on older docs mix them up.
When to skip it
Upgrading between major versions: the skill sends that to separate upgrade skills in the same repository, such as Prisma 6 to 7 upgrade. Projects on Drizzle, Kysely or raw SQL do not need it.
Try it
Add Prisma ORM to this Next.js app with our Neon PostgreSQL database. Pin
the version, keep the connection string in .env, create a User model, run
the first migration against the dev branch and show me a query that works.
What it can touch
- Bundles scripts
- No
- Pre-approved tools
- None declared
- Needs
- Node.js project; A database connection string
- 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.
Your package manager (installing Prisma packages), Prisma config and schema files, and your database: migrations change schema, so point it at a development database. It is careful about not provisioning an unrelated database during setup. No scripts, no allowed-tools.
At commit a6f1929 the SKILL.md is 82 lines long. Alongside it:
references/(8 entries)
Alternatives
Neon Postgres and Supabase for the database side, and Supabase Postgres best practices for schema and query design on any Postgres.
SKILL.md
The file exactly as published at the reviewed commit, reproduced under its MIT licence.
---
name: prisma-orm-setup
description: Set up Prisma ORM in an application, connect its database, or troubleshoot the connection of an existing Prisma 6, 7, or 8 app. Defaults new applications to Prisma ORM 8 and loads the package-owned prisma-8 skill; keeps existing Prisma 6/7 apps on their version with provider references for PostgreSQL, MySQL, SQLite, SQL Server, CockroachDB, MongoDB, and Prisma Postgres.
license: MIT
metadata:
author: prisma
version: "1.0.0"
---
# Prisma ORM setup
This skill owns ORM version selection for setup and connection work. Preserve the application's ORM version and intended database. A connection repair does not require a major upgrade.
New applications default to **Prisma ORM 8**. Detailed Prisma 8 configuration, queries, migrations, and runtime code belong to the versioned [prisma-8 skill](https://github.com/prisma/orm/tree/main/skills/prisma-8) shipped with the ORM package.
## 1. Detect the starting point
Read the package manifest, lockfile, Prisma configuration, schema, and application imports. Identify the ORM version, database provider, and runtime. The CLI version alone does not identify the application's version: a Prisma 8 CLI can coexist with a legacy client, so inspect `@prisma/client`, `@prisma/prisma7`, and the schema and configuration.
| Starting point | Path |
| ------------------------------------------------------- | -------------------------------------------------------- |
| Prisma 8 application | Step 4, without reinitializing |
| New application without a version choice | Step 3 |
| Prisma 6 or 7 application, or an explicit earlier major | [Step 5](#5-set-up-or-repair-an-earlier-version) |
For a new application, check the selected Prisma 8 release's [provider support](https://www.prisma.io/docs/orm/supported-databases) and runtime requirements before installing. If the provider is unsupported, explain the limitation and offer an explicitly selected earlier version. Keep the requested database; do not silently fall back or invent a supported target.
Use an existing database when supplied. Load `prisma-postgres-setup` only when Prisma Postgres is needed and no connection has been selected yet; return here once connected.
## 2. Handle requested major upgrades separately
When the user requests a major upgrade, load a workflow that supports the source version and provider. For PostgreSQL 6 or 7 to 8 in one pass, use [prisma-postgres-upgrade](../prisma-postgres-upgrade/SKILL.md); for PostgreSQL 7-to-8 one route at a time, use the [route-by-route guide](https://www.prisma.io/docs/guides/upgrade-prisma-orm/postgresql-incremental); for MongoDB 6-to-8, use [prisma-mongodb-upgrade](../prisma-mongodb-upgrade/SKILL.md). Other providers need an explicitly supported migration path. `prisma-upgrade-v7` covers **6 to 7**; the package-owned `prisma-8` upgrade reference covers updates within 8.
## 3. Bootstrap a new Prisma 8 application
Check the selected release's [runtime requirements](https://www.prisma.io/docs/orm/release-status) and [initialization guide](https://www.prisma.io/docs/cli/orm-init). Resolve and pin a published Prisma CLI **8** release, including its prerelease suffix if needed; verify its version before initialization. Do not rely on a floating `latest` remaining version 8.
Use the project's package manager to run the installed CLI. For PostgreSQL and Prisma schema language authoring:
```bash
prisma orm init --yes --target postgres --authoring psl
```
Use the supported target for the selected provider. Preserve existing application files and connection configuration; do not let setup provision an unrelated database. Verify that the resolved ORM package is version 8 before proceeding.
## 4. Load the installed Prisma 8 guidance
Run the installed CLI through the project's package manager:
```bash
prisma skills sync
```
Then **read** the synced `prisma-8/SKILL.md`, for example `.agents/skills/prisma-8/SKILL.md`, and follow its preconditions and selected references. Syncing alone does not load the instructions. If the package-owned guidance cannot be loaded, report the blocker. Continue with step 6.
## 5. Set up or repair an earlier version
For a new setup that explicitly selects an earlier version, pin packages to that major and use its runtime requirements. Keep the CLI, client, and SQL adapter releases compatible. Existing dependencies need not change for a connection repair.
- **Prisma 7 SQL:** use the provider reference below and [client setup](references/v7-client-setup.md).
- **Prisma 6 MongoDB:** use [MongoDB setup](references/v6-mongodb.md). SQL driver adapters do not apply.
- **Prisma 6 SQL:** preserve its generator, schema URL, and client initialization. Use the provider's connection details below and the [Prisma 6 documentation](https://www.prisma.io/docs/orm/v6); do not copy the Prisma 7 configuration or adapter examples into it.
| Database | Reference |
| -------------------------------- | --------------------------------------------------------- |
| PostgreSQL | [PostgreSQL](references/v7-postgresql.md) |
| MySQL / MariaDB / PlanetScale | [MySQL](references/v7-mysql.md) |
| SQLite / Turso | [SQLite](references/v7-sqlite.md) |
| Microsoft SQL Server / Azure SQL | [SQL Server](references/v7-sqlserver.md) |
| CockroachDB | [CockroachDB](references/v7-cockroachdb.md) |
| MongoDB / Atlas on Prisma 6 | [MongoDB](references/v6-mongodb.md) |
| Prisma Postgres with Prisma 7 | [Prisma Postgres](references/v7-prisma-postgres.md) |
The Prisma 7 SQL examples were verified with Prisma 7.10.0; the MongoDB examples with Prisma 6.19.3.
## 6. Connect and verify
The CLI and the application can load different environment files. Load the intended environment for each without printing secrets, and keep credentials in ignored environment files or the host's secret configuration. For SQL adapters, make the adapter's runtime options address the same database as the CLI connection URL.
For an existing app, preserve schema, migrations, and generator configuration unless the requested work requires changes. Diagnose the connection before running schema-changing commands.
Run the project's relevant checks and a read-only query through the application's client against the intended database. Report the ORM version, the loaded `prisma-8` skill version where applicable, and the query result. Package installation or a successful skill sync alone is not a completed setup.Related skills
Neon Postgres
Neon's guide to connections, pooled vs direct, migrations, branching per PR, autoscaling, scale-to-zero, egress and search on Neon Postgres.
Supabase (Supabase)
Supabase's main skill: check the changelog before coding, use the CLI or MCP server, make schema changes safely and debug auth, RLS and functions.
Postgres best practices (Supabase)
Supabase's Postgres rules for schema, indexes, RLS, migrations, connections and slow queries. Works for Postgres anywhere, not just Supabase.