Claude Skills
CollectionsCompareWorkflowsNominate
Sign inSign up
© 2026 Curated Agent Skills·Learn more about Agent Skills
Back to repository

prisma-schema

verified

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 GitHub

Marketplace

functional-claude

nthplusio/functional-claude

Plugin

prisma-dev

Repository
Verified Org

nthplusio/functional-claude

plugins/prisma-dev/skills/prisma-schema/SKILL.md

Last Verified

February 2, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/nthplusio/functional-claude/blob/main/plugins/prisma-dev/skills/prisma-schema/SKILL.md -a claude-code --skill prisma-schema

Installation paths:

Claude
.claude/skills/prisma-schema/
Powered by add-skill CLI

Instructions

# 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

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
4488 chars