mcpbeat Sign in

Prisma Database Setup Cockroachdb Skill for Cursor

CockroachDB Setup. Reference when using this Prisma feature.

548 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-database-setup-cockroachdb

What comes with it

113 bytes besides the instruction
metadata.json

The instruction itself

9 sections, as written by the author

CockroachDB Setup

Configure Prisma with CockroachDB.

Prerequisites

  • CockroachDB cluster

1. Schema Configuration

In prisma/schema.prisma:

datasource db {
  provider = "cockroachdb"
}

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

2. Config Configuration (v7)

In prisma.config.ts:

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

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

3. Environment Variable

In .env:

DATABASE_URL="postgresql://user:password@host:26257/db?sslmode=verify-full"

Note: CockroachDB uses the PostgreSQL wire protocol, so the URL often looks like postgresql, but the provider MUST be cockroachdb in the schema to handle specific CRDB features correctly.

Driver Adapter (Prisma ORM 7 required)

Prisma ORM 7 uses the query compiler by default, so you must use a driver adapter. CockroachDB is PostgreSQL-compatible, so use the PostgreSQL adapter.

  • Install adapter and driver:
   npm install @prisma/adapter-pg pg
  • Instantiate Prisma Client with the adapter:
   import 'dotenv/config'
   import { PrismaClient } from '../generated/client'
   import { PrismaPg } from '@prisma/adapter-pg'

   const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL })
   const prisma = new PrismaClient({ adapter })

ID Generation

CockroachDB uses BigInt or UUID for IDs efficiently.

model User {
  id BigInt @id @default(autoincrement()) // Uses unique_rowid()
}

Or using string UUIDs:

model User {
  id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
}

Common Issues

Schema Introspection

Always use provider = "cockroachdb" to ensure correct type mapping during db pull.

How to use it

Copy the folder

Take prisma/prisma-database-setup-cockroachdb 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.