home / skills / yuniorglez / gemini-elite-core / prisma-expert

prisma-expert skill

/skills/prisma-expert

This skill helps you optimize Prisma 7 queries with TypedSQL, edge-first deployment, and serverless efficiency for fast, scalable Postgres workloads.

npx playbooks add skill yuniorglez/gemini-elite-core --skill prisma-expert

Review the files below or copy the command above to add this skill to your agents.

Files (5)
SKILL.md
3.0 KB
---
name: prisma-expert
id: prisma-expert
version: 1.2.0
description: "Senior specialist in Prisma 7, Rust-free query engines, and Edge-first database architecture. Use when optimizing queries, configuring TypedSQL, or deploying to serverless/edge environments in 2026."
---

# 💎 Skill: prisma-expert

## Description
Senior specialist in Prisma 7, focused on the revolutionary TypeScript-based query engine (Rust-free) that drastically reduces cold starts and memory overhead. Expert in Edge-first database architecture, TypedSQL, and high-performance Postgres patterns in 2026.

## Core Priorities
1.  **Rust-free Engine**: Leveraging the WASM/TS engine for sub-50ms cold starts in serverless.
2.  **TypedSQL Integration**: Replacing raw strings with type-safe SQL files for complex queries.
3.  **Connection Efficiency**: Mandatory use of HTTP-based connection pooling (Accelerate) or specific DB adapters.
4.  **Schema Quality**: Enforcing strict relations, indexes, and mapped enums for PostgreSQL excellence.

## 🏆 Top 5 Gains in Prisma 7 (2026)

1.  **90% Smaller Bundle**: The removal of the Rust engine binary makes Prisma viable for even the most restricted edge runtimes.
2.  **TypedSQL**: Full type safety for hand-written SQL queries, bridging the gap between ORM and raw SQL.
3.  **Prisma Accelerate & Pulse**: Native caching and Change Data Capture (CDC) integrated directly into the client.
4.  **Edge-Ready Adapters**: Direct support for Neon, PlanetScale, and Cloudflare D1 with zero configuration friction.
5.  **Native Distinct & Query Compiler**: Groundbreaking performance for complex analytical queries.

## Table of Contents & Detailed Guides

### 1. [Query Optimization & TypedSQL](./references/1-query-optimization.md) — **CRITICAL**
- Indexing strategies and `nativeDistinct`
- TypedSQL: Safe raw queries
- Avoiding N+1 with `include` and `select`

### 2. [Serverless & Edge Deployment](./references/2-serverless-edge.md) — **CRITICAL**
- Using the Rust-free WASM engine
- Prisma Accelerate (Connection Pooling & Caching)
- Regional execution best practices

### 3. [Advanced Schema Patterns](./references/3-schema-patterns.md) — **HIGH**
- Mapped Enums and Postgres-native types
- Complex Relations (m:n, self-referencing)
- Prisma Pulse (Real-time CDC)

### 4. [Prisma Studio & Telemetry](./references/4-tools.md) — **MEDIUM**
- Advanced usage of the 2026 Prisma Studio
- Telemetry and performance monitoring
- Migration workflows (CLI 2026)

## Quick Reference: The "Do's" and "Don'ts"

| **Don't** | **Do** |
| :--- | :--- |
| `prisma.$queryRaw` (raw strings) | Use **TypedSQL** (`.sql` files) |
| Large fetches with `select *` | Use explicit `select: { ... }` |
| Direct DB connection in Serverless | Use **Prisma Accelerate** or Adapters |
| Heavy `node_modules` in Edge | Enable the **WASM/TS Engine** |
| Manual indexing in production | Trust the `Index Advisor` and DB logs |
| Ignore Prisma Pulse | Use it for real-time event-driven logic |

---
*Optimized for Prisma 7.1+ and Postgres 17+.*
*Updated: January 22, 2026 - 15:07*

Overview

This skill is a senior Prisma 7 specialist focused on the Rust-free, TypeScript/WASM query engine, Edge-first database patterns, and TypedSQL. It helps teams optimize queries, reduce cold starts, and deploy high-performance Postgres-backed services to serverless and edge runtimes in 2026. Use it to modernize schemas, enforce connection efficiency, and adopt Prisma Accelerate and Pulse.

How this skill works

The skill inspects Prisma schemas, query patterns, and deployment targets to recommend concrete changes: typed SQL migration, index and relation improvements, and adapter or pooling configuration. It analyzes query shapes for N+1 risks and suggests nativeDistinct, explicit select/include usage, and TypedSQL replacements. It also evaluates runtime packaging to enable the WASM/TS engine and recommends Accelerate or supported edge adapters for connection management.

When to use it

  • Migrating apps to serverless or edge runtimes where cold starts and bundle size matter.
  • Optimizing slow or memory-heavy Prisma queries in Postgres 17+ deployments.
  • Replacing raw query strings with type-safe TypedSQL for complex queries.
  • Configuring connection pooling, caching, or CDC with Prisma Accelerate and Pulse.
  • Designing schemas with strict relations, mapped enums, and production-grade indexes.

Best practices

  • Prefer the WASM/TS engine for edge runtimes to achieve sub-50ms cold starts.
  • Replace prisma.$queryRaw strings with TypedSQL (.sql files) for type safety and maintainability.
  • Use explicit select/include to avoid large fetches and N+1; favor nativeDistinct and query compiler features for analytics.
  • Always use HTTP-based connection pooling (Prisma Accelerate) or official edge adapters (Neon, PlanetScale, Cloudflare D1).
  • Rely on Index Advisor and runtime DB logs for indexing decisions; model mapped enums and Postgres-native types in schema.

Example use cases

  • Reduce cold start time for a serverless GraphQL API by switching to the WASM/TS engine and trimming node_modules.
  • Convert raw analytics queries to TypedSQL with full type safety and use nativeDistinct for faster group queries.
  • Migrate a backend to an edge platform using Neon + Prisma edge adapter and Prisma Accelerate for stable connections.
  • Implement real-time event handling by enabling Prisma Pulse CDC and wiring changes into serverless event consumers.
  • Refactor a legacy schema to enforce strict relations, add targeted indexes, and eliminate N+1 fetches.

FAQ

Will switching to the WASM/TS engine change query semantics?

No. The WASM/TS engine preserves Prisma query semantics; you only need to validate edge-specific limitations and remove any dependencies on the Rust binary.

When should I use TypedSQL vs. Prisma queries?

Use TypedSQL for complex, hand-written SQL that benefits from type safety and performance tuning. Use Prisma queries for standard CRUD and relations where the ORM provides maintainability and safety.