prisma-driver-adapter-implementation

Implements Prisma ORM 7 SQL driver adapters with transaction, savepoint, and error-mapping contracts.

Updated Sep 17, 2026
One-click install
npx skills add https://github.com/team-zerolatency/cfta --skill prisma-driver-adapter-implementation-team-zerolatency
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: prisma-driver-adapter-implementation
Source: https://github.com/team-zerolatency/cfta/tree/main/packages/database/.windsurf/skills/prisma-driver-adapter-implementation
Command: npx skills add https://github.com/team-zerolatency/cfta --skill prisma-driver-adapter-implementation-team-zerolatency

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @prisma/driver-adapter-utils.

What problem does it solve? Building a Prisma SQL driver adapter is error-prone: type-compatible code can still corrupt values, leak connections, break transactions, or lose original database error details. This Skill encodes the exact Prisma ORM 7 adapter contract so implementations handle transactions, savepoints, result mapping, and error preservation correctly. ## Core Features & Use Cases - Adapter Contract Implementation: Guides implementation of SqlDriverAdapterFactory, SqlDriverAdapter, Transaction, and SqlMigrationAwareDriverAdapterFactory against the installed @prisma/driver-adapter-utils version. - Transaction & Savepoint Protocol: Enforces one dedicated connection per transaction, lifecycle-only commit/rollback hooks, and connection-local savepoint handling. - Result and Error Mapping: Covers column type mapping, argument binding, and DriverAdapterError conversion that preserves originalCode and originalMessage for useful P2039 errors. - Use Case: When adding a new database driver to Prisma, use this Skill to implement queryRaw, executeRaw, startTransaction, and shadow database support, then verify against the included checklist. ## Quick Start Ask the AI to implement a Prisma driver adapter for your database following this guide, including transaction handling and error mapping.

Frequently Asked Questions about prisma-driver-adapter-implementation

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

FAQPage Schema
How do I implement a Prisma driver adapter for a new database?▼

Implement SqlDriverAdapterFactory with a connect() method returning a SqlDriverAdapter that provides queryRaw, executeRaw, executeScript, startTransaction, and dispose. Match the exact @prisma/driver-adapter-utils version of your target Prisma release and map arguments, column types, and errors precisely.

How do Prisma driver adapter transactions and savepoints work?▼

startTransaction must acquire one dedicated connection, begin the transaction, and apply the isolation level. commit() and rollback() are lifecycle cleanup hooks that release the connection once; Prisma issues the actual SQL COMMIT/ROLLBACK via executeRaw. Savepoint methods are optional and live on the Transaction object.

Why does my Prisma adapter throw P2039 errors?▼

P2039 surfaces when an unmapped driver error reaches Prisma. Preserve originalCode and originalMessage in your DriverAdapterError conversion so P2039 carries useful diagnostics, and map known conditions like unique constraint violations to structured MappedError kinds.

Does the Prisma adapter contract support shadow databases for migrations?▼

Yes, implement SqlMigrationAwareDriverAdapterFactory with connectToShadowDb() when the provider can create an isolated shadow database. The shadow database must be uniquely named, never point at the primary database, and be dropped during disposal or failure cleanup.

What are common mistakes when writing a Prisma driver adapter?▼

Common mistakes include sharing connections across concurrent transactions, issuing duplicate SQL COMMIT/ROLLBACK inside lifecycle hooks, tracking transaction depth globally on the adapter, splitting migration scripts naively on semicolons, and losing 64-bit integer precision during result mapping.