This skill should be used when the user asks about "prisma model", "schema.prisma", "prisma relations", "@@index", "prisma attributes", "@id", "@unique", "prisma enum", "prisma types", or mentions schema design and model definitions in Prisma.
View on GitHubplugins/prisma-dev/skills/prisma-schema/SKILL.md
February 2, 2026
Select agents to install to:
npx add-skill https://github.com/nthplusio/functional-claude/blob/main/plugins/prisma-dev/skills/prisma-schema/SKILL.md -a claude-code --skill prisma-schemaInstallation paths:
.claude/skills/prisma-schema/# Prisma Schema
Design and configure Prisma schema files with models, relations, and attributes.
## Schema File Location
Default: `prisma/schema.prisma`
Custom location via `package.json`:
```json
{
"prisma": {
"schema": "db/schema.prisma"
}
}
```
## Schema Structure
```prisma
// Datasource configuration
datasource db {
provider = "postgresql" // postgresql, mysql, sqlite, sqlserver, mongodb, cockroachdb
url = env("DATABASE_URL")
}
// Generator configuration
generator client {
provider = "prisma-client-js"
}
// Models
model User {
id Int @id @default(autoincrement())
email String @unique
name String?
posts Post[]
}
```
## Field Types
### Scalar Types
| Prisma Type | PostgreSQL | MySQL | SQLite |
|-------------|------------|-------|--------|
| String | TEXT | VARCHAR(191) | TEXT |
| Int | INTEGER | INT | INTEGER |
| BigInt | BIGINT | BIGINT | BIGINT |
| Float | DOUBLE PRECISION | DOUBLE | REAL |
| Decimal | DECIMAL(65,30) | DECIMAL(65,30) | DECIMAL |
| Boolean | BOOLEAN | BOOLEAN | INTEGER |
| DateTime | TIMESTAMP(3) | DATETIME(3) | DATETIME |
| Json | JSONB | JSON | TEXT |
| Bytes | BYTEA | LONGBLOB | BLOB |
### Optional and List Types
```prisma
model Example {
required String // Required field
optional String? // Optional field (nullable)
list String[] // Array/list (not all DBs support)
}
```
## Field Attributes
### Primary Key
```prisma
model User {
id Int @id @default(autoincrement()) // Auto-increment
uuid String @id @default(uuid()) // UUID
cuid String @id @default(cuid()) // CUID
}
```
### Composite Primary Key
```prisma
model PostTag {
postId Int
tagId Int
@@id([postId, tagId])
}
```
### Unique Constraints
```prisma
model User {
email String @unique // Single field unique
firstName String
lastName String
@@unique([firstName, lastName]) // Composite unique
}
```
### Default Values