database-prisma

Validate Prisma schemas and generate reviewed migration SQL for Supabase/PostgreSQL.

3|Updated Aug 3, 2025
One-click install
npx skills add https://github.com/CleanExpo/Synthex --skill database-prisma-cleanexpo
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-prisma
Source: https://github.com/CleanExpo/Synthex/tree/main/.claude/skills/database-prisma
Command: npx skills add https://github.com/CleanExpo/Synthex --skill database-prisma-cleanexpo

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Prevents unsafe schema changes, accidental destructive migrations, and inefficient queries by providing a validated, reviewable workflow for Prisma schema updates and migrations against a Supabase/PostgreSQL backend.

Core Features & Use Cases

  • Schema validation and safety: Inspect Prisma models for relationship, type, and index consistency before generating migrations.
  • Migration generation and review: Produce migration SQL, detect destructive operations, and require explicit confirmation and backups before applying.
  • Query optimisation and integrity checks: Identify N+1 patterns, suggest includes/selects and missing indexes, and validate foreign key/cascade behaviour.
  • Use Case: When adding a new field to ScheduledPost, generate a migration, review SQL for drops or type changes, run it locally against a Supabase dev instance, and regenerate the Prisma client.

Quick Start

Run a migration-create operation named add-slug to validate the schema, generate the migration SQL for review, and update the Prisma client.

Frequently Asked Questions about database-prisma

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I safely run Prisma migrations on a Supabase PostgreSQL database?

To safely run Prisma migrations on a Supabase PostgreSQL database, validate schema relationships first, generate migration SQL for review, and require explicit confirmation and backups before applying any destructive operations.

How do I prevent destructive SQL operations when updating my Prisma schema?

Preventing destructive SQL operations during Prisma schema updates involves inspecting models for consistency, generating reviewable migration SQL, and enforcing explicit confirmation and backup policies before executing any database changes.

How can I identify and fix N+1 query patterns in Prisma?

Identify and fix N+1 query patterns in Prisma by analyzing your queries to suggest appropriate includes or selects, validating missing indexes, and checking foreign key cascade behavior to optimize database performance.

Does Prisma validate foreign key and cascade behavior automatically before migrations?

Prisma schema validation checks foreign key and cascade behavior alongside relationship and type consistency before generating migrations, ensuring your PostgreSQL schema remains intact during updates.

What is the best way to add a new field to an existing Prisma model without losing data?

The best way to add a new field to an existing Prisma model without losing data is to generate the migration SQL for review, run it against a local Supabase dev instance, and regenerate the Prisma client afterward.

Why do I need to review generated migration SQL before applying it to PostgreSQL?

Reviewing generated migration SQL before applying it to PostgreSQL is necessary to detect destructive operations like table drops or type changes, ensuring you can safely enforce backups and explicit confirmations.