Terminal.skills
Skills/prisma
>

prisma

You are an expert in Prisma, the TypeScript ORM with a declarative schema, auto-generated type-safe client, migrations, and studio GUI. You help developers model databases with Prisma Schema Language, generate a fully typed client that catches query errors at compile time, run zero-downtime migrations, and integrate with Postgres, MySQL, SQLite, MongoDB, CockroachDB, and PlanetScale.

#orm#database#typescript#postgres#mysql#sqlite#schema#migrations
terminal-skillsv1.0.0
Works with:claude-codeopenai-codexgemini-clicursor
Source

Usage

$
✓ Installed prisma v1.0.0

Getting Started

  1. Install the skill using the command above
  2. Open your AI coding agent (Claude Code, Codex, Gemini CLI, or Cursor)
  3. Reference the skill in your prompt
  4. The AI will use the skill's capabilities automatically

Example Prompts

  • "Review the open pull requests and summarize what needs attention"
  • "Generate a changelog from the last 20 commits on the main branch"

Information

Version
1.0.0
Author
terminal-skills
Category
Backend Development
License
Apache-2.0

Use Cases

Build a Type-Safe API with Redis Caching
Build a Type-Safe Full-Stack API with tRPC
Build a Full-Stack Next.js SaaS Application
Build Multi-Tenant SaaS with Row-Level Isolation
Build an Event-Sourced Fintech Ledger with CQRS
Build Usage-Based Billing for an AI SaaS Product
Build a White-Label SaaS Platform with Tenant Theming
Migrate a Monolith to Microservices Without Downtime
Ship an Offline-First Progressive Web App
Build an AI-Powered Customer Onboarding Flow
Build a Data Mesh with Self-Serve Analytics
Build a Developer Portal with API Marketplace
Launch a Full-Stack SaaS MVP in a Weekend
Build an Affiliate Program from Scratch
Build an AI Customer Feedback Analyzer
Build an AI-Powered Form Builder
Build an AI-Powered Quiz Generator
Build an AI Resume Screener
Build an AI Search Engine with Hybrid Retrieval
Build an AI Support Chatbot with Human Handoff
Build an Appointment Booking System Like Calendly
Build AI Lead Scoring for B2B SaaS
Build a Community Forum Platform with Threads, Reactions, and Reputation
Build a Contract Management System
Build a Video Course Platform with Chapters, Quizzes, and Progress Tracking
Build Customer Journey Analytics
Build a Customer Win-Back Campaign
Build a Developer Experience Dashboard with DORA Metrics
Build a Monetized Niche Directory Website
Build an E-Signature Document Signing Workflow
Build an Email Sequence Automation System
Build a Continuous Employee Feedback System
Build an Event Ticketing Platform — Create Events, Sell Tickets, Check In Attendees
Build an Expense Reporting and Approval Workflow for Teams
Automate Employee Onboarding
Build an Inventory Management System with Low-Stock Alerts and Supplier Orders
Build a Niche Job Board SaaS
Build an Internal Knowledge Base with AI-Powered Search
Build a Linktree Alternative — Link-in-Bio with Analytics and Custom Domains
Build an LMS for Employee Training with Assessments and Compliance Tracking
Build a Verified Marketplace Review System
Build a Multi-Tenant Admin Panel
Build an OKR Tracking System
Build Outbound Sales Automation
Build a Personalized Email Campaign with AI
Build a Public Changelog and Roadmap for Your SaaS
Build a Project Management Tool That Doesn't Suck
Build a Real-Time Multiplayer Game Backend with Rooms and Leaderboards
Build a Revenue Dashboard with Stripe Data
Build an Instant SaaS Demo Environment
Build a SaaS Onboarding Checklist That Drives Activation
Build a Lightweight Sales CRM from Scratch
Build a Self-Serve Analytics Embed for Your SaaS
Build Social Login with Multiple Providers
Build a Subscription Analytics Dashboard (Your Own Baremetrics)
Build a Time Tracking System with Invoicing
Build a Wall of Love — Automated Testimonials Page
Build a Video Streaming Platform
Build a Viral Referral Program with Reward Tiers
Build a Waitlist and Launch Page with Viral Referral
Build a White-Label SaaS Platform
Build Automated Testing for LLM Outputs
Build a GDPR Cookie Consent System
Build a Growth Hacking Automation Toolkit
Build an Interactive Coding Tutorial Platform
Build a Live Streaming Platform
Build a Multilingual AI Chatbot
Build a Podcast Hosting Platform
Build a Q&A Knowledge Platform
Build an AI Personal Finance Advisor Bot
Build a Bug Bounty Submission Portal
Build a Crypto Payment Gateway
Build a DeFi Yield Dashboard
Build a HIPAA-Compliant Patient Portal
Build a Real Estate Listing Platform
Build an AI Stock Screener
Build a Personal AI Assistant App
Build a High-Throughput AI Batch Processing Pipeline
Build an AI-Powered CRM
Build a Self-Hosted Airtable Alternative
Build a Backlink Monitoring and Alert System
Build a Real-Time Document Collaboration Platform
Build an Email Deliverability Monitoring Tool
Build an Engineering Metrics Platform
Build a Niche Freelance Marketplace
Build a Keyword Rank Tracker
Build a Unified Social Media Analytics Dashboard
Build Vector Search from Scratch with pgvector
Build a Self-Hosted Zapier Alternative
Build a Crypto Portfolio Tracker with P&L and Tax Reporting
Build a Customer Data Platform (CDP)
Build a Customer Success Platform
Build a Feature Announcement and Release Notes System
Build an Anki-Alternative Flashcard App with AI Card Generation
Build a Habit Tracking App with Streaks and Insights
Build a Health and Fitness Tracking App
Build an Embeddable Live Chat Widget
Build a Status Page with Real-Time Incident Communication
Build a Language Learning App with Spaced Repetition and AI Conversation
Build a Guided Meditation App with AI-Personalized Sessions
Build a Personal Finance Tracker with Budgets and AI Insights
Build a Recipe Manager and AI Meal Planner
Build a High-Converting Trial-to-Paid Conversion Flow
Build a Usage-Based Pricing Engine

Documentation

You are an expert in Prisma, the TypeScript ORM with a declarative schema, auto-generated type-safe client, migrations, and studio GUI. You help developers model databases with Prisma Schema Language, generate a fully typed client that catches query errors at compile time, run zero-downtime migrations, and integrate with Postgres, MySQL, SQLite, MongoDB, CockroachDB, and PlanetScale.

Core Capabilities

Schema

prisma
// prisma/schema.prisma
generator client {
  provider = "prisma-client-js"
}

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

model User {
  id        String   @id @default(cuid())
  email     String   @unique
  name      String
  role      Role     @default(USER)
  posts     Post[]
  profile   Profile?
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt

  @@index([email])
  @@map("users")
}

model Post {
  id          String     @id @default(cuid())
  title       String
  content     String?
  published   Boolean    @default(false)
  author      User       @relation(fields: [authorId], references: [id])
  authorId    String
  categories  Category[]
  createdAt   DateTime   @default(now())
  
  @@index([authorId])
  @@index([published, createdAt])
}

model Profile {
  id     String @id @default(cuid())
  bio    String?
  avatar String?
  user   User   @relation(fields: [userId], references: [id])
  userId String @unique
}

model Category {
  id    String @id @default(cuid())
  name  String @unique
  posts Post[]
}

enum Role {
  USER
  ADMIN
  MODERATOR
}

Queries

typescript
import { PrismaClient } from "@prisma/client";

const prisma = new PrismaClient();

// Create with relations
const user = await prisma.user.create({
  data: {
    name: "Alice",
    email: "alice@example.com",
    profile: { create: { bio: "Developer" } },
    posts: {
      create: [
        { title: "First Post", content: "Hello world", published: true },
        { title: "Draft", content: "Work in progress" },
      ],
    },
  },
  include: { posts: true, profile: true },
});

// Complex queries — fully typed
const publishedPosts = await prisma.post.findMany({
  where: {
    published: true,
    author: { role: "ADMIN" },
    createdAt: { gte: new Date("2026-01-01") },
  },
  include: {
    author: { select: { name: true, email: true } },
    categories: true,
  },
  orderBy: { createdAt: "desc" },
  take: 20,
  skip: 0,
});

// Aggregate
const stats = await prisma.post.aggregate({
  _count: true,
  _avg: { createdAt: true },
  where: { published: true },
});

// Transaction
const [updatedPost, newNotification] = await prisma.$transaction([
  prisma.post.update({ where: { id: "..." }, data: { published: true } }),
  prisma.notification.create({ data: { userId: "...", message: "Post published!" } }),
]);

// Raw SQL when needed
const result = await prisma.$queryRaw`
  SELECT u.name, COUNT(p.id) as post_count
  FROM users u LEFT JOIN posts p ON p."authorId" = u.id
  GROUP BY u.name ORDER BY post_count DESC LIMIT 10
`;

Migrations

bash
npx prisma migrate dev --name add-categories    # Create + apply migration
npx prisma migrate deploy                       # Apply in production
npx prisma db push                              # Push schema without migration (prototyping)
npx prisma studio                               # GUI for browsing data
npx prisma generate                             # Regenerate client after schema change

Installation

bash
npm install prisma @prisma/client
npx prisma init                            # Creates schema.prisma + .env

Best Practices

  1. Type-safe queries — Every query is fully typed; wrong field names or types caught at compile time
  2. Relations — Define in schema with @relation; query with include or select for eager loading
  3. Migrations — Use prisma migrate dev in development; migrate deploy in CI/production
  4. Indexes — Add @@index for fields you filter/sort by; Prisma warns about missing indexes
  5. Select vs Include — Use select to pick specific fields (smaller payloads); include for full relations
  6. Transactions — Use $transaction for atomic multi-table operations; auto-rollback on failure
  7. Connection pooling — Use prisma-accelerate or pgbouncer for serverless; Lambda needs pooling
  8. Prisma Studionpx prisma studio for visual data browser; great for debugging and manual edits