---
name: prisma
description: Build type-safe TypeScript and Node.js apps with Prisma ORM and Prisma Postgres. Covers the core Prisma CLI workflow (init, migrate, generate, studio), connecting to a Prisma Postgres database, and the remote Prisma MCP server for managing databases from AI tools.
license: Apache-2.0
compatibility: ">=0.1.0"
metadata:
  homepage: https://www.prisma.io
  documentation: https://www.prisma.io/docs
  vendor: Prisma
  version: "1.0.0"
allowed-tools:
  - Bash
  - Read
  - Edit
  - Write
---

# Prisma

Prisma is agent infrastructure for TypeScript and Node.js. This skill covers two
products:

- **Prisma ORM** — a type-safe ORM for Node.js and TypeScript with schema
  modeling, automated migrations, and an intuitive query API. It supports
  PostgreSQL, MySQL, SQL Server, SQLite, MongoDB, and CockroachDB.
- **Prisma Postgres** — a fully managed PostgreSQL database that scales to zero
  and integrates with Prisma ORM and Prisma Studio.

> Prisma changes frequently. Before implementing Prisma features, check the
> changelog at https://www.prisma.io/changelog.md and the current documentation. Do not rely
> solely on training data for Prisma APIs, configuration, or conventions — these
> can change between versions.

## Core workflow (Prisma CLI)

Run the Prisma CLI with `npx prisma`. The typical workflow for a new project:

1. **Set up a TypeScript project with ESM.** Initialize the project, install
   dependencies, and enable ESM before scaffolding Prisma:

   ```bash
   npm init -y
   npm install typescript tsx @types/node --save-dev
   npx tsc --init
   npm install prisma @types/pg --save-dev
   npm install @prisma/client @prisma/adapter-pg pg dotenv
   ```

   Set `"module": "ESNext"` (along with `"moduleResolution": "bundler"`,
   `"target": "ES2023"`, `"strict": true`, `"esModuleInterop": true`, and
   `"ignoreDeprecations": "6.0"`) in `tsconfig.json`, and add
   `"type": "module"` to `package.json`.

2. **Initialize Prisma ORM.** Creates the `prisma/` directory with a
   `schema.prisma` file, a `.env` file, and a `prisma.config.ts` file:

   ```bash
   npx prisma init --output ../generated/prisma
   ```

3. **Create a Prisma Postgres database.** Ask the user for approval before
   provisioning a hosted Prisma Postgres database — `npx create-db` creates a
   cloud resource. After approval, run it and copy the `postgres://...`
   connection string into `DATABASE_URL` in your `.env` file:

   ```bash
   npx create-db
   ```

4. **Create and apply a migration** after defining models in
   `prisma/schema.prisma`. This creates the database tables based on your schema:

   ```bash
   npx prisma migrate dev --name init
   ```

5. **Generate Prisma Client** for type-safe database access:

   ```bash
   npx prisma generate
   ```

6. **Explore your data** in Prisma Studio, a visual database editor:

   ```bash
   npx prisma studio
   ```

### Example schema

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

datasource db {
  provider = "postgresql"
}

model User {
  id    Int     @id @default(autoincrement())
  email String  @unique
  name  String?
  posts Post[]
}

model Post {
  id        Int     @id @default(autoincrement())
  title     String
  content   String?
  published Boolean @default(false)
  author    User    @relation(fields: [authorId], references: [id])
  authorId  Int
}
```

## Remote MCP server

Prisma runs a remote Model-Context-Protocol (MCP) server that lets AI tools
manage Prisma Postgres databases over HTTP transport. It authenticates with
Prisma Console on first use so your AI tool can access the workspace you choose.

Endpoint: `https://mcp.prisma.io/mcp`

Standard MCP configuration:

```json
{
  "mcpServers": {
    "Prisma": {
      "url": "https://mcp.prisma.io/mcp"
    }
  }
}
```

The server exposes tools for creating and listing databases, connection strings,
and backups; restoring backups; running SQL queries; introspecting schemas; and
`search_prisma_documentation`, which answers Prisma questions grounded in the
official docs with citations. Once connected, you can prompt your agent to
"List the Prisma tools" for the latest supported tools.

## Where to read the docs

- Docs index (machine-readable): https://www.prisma.io/docs/llms.txt
- Full docs corpus: https://www.prisma.io/docs/llms-full.txt
- Any docs page as markdown: append `.md` to the URL (e.g. https://www.prisma.io/docs/getting-started.md)
- Changelog (machine-readable): https://www.prisma.io/changelog.md
