prisma-driver-adapter-implementation

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

Updated Feb 27, 2026
One-click install
npx skills add https://github.com/firstaxel/neon --skill prisma-driver-adapter-implementation-firstaxel
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: prisma-driver-adapter-implementation
Source: https://github.com/firstaxel/neon/tree/main/.agents/skills/prisma-driver-adapter-implementation
Command: npx skills add https://github.com/firstaxel/neon --skill prisma-driver-adapter-implementation-firstaxel

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 Reference: Defines the SqlDriverAdapterFactory, SqlDriverAdapter, Transaction, and migration-aware factory interfaces with implementation examples. - Transaction & Savepoint Protocol: Enforces one dedicated connection per transaction, lifecycle-only commit/rollback hooks, and connection-local savepoint handling. - Error & Result Mapping: Maps driver values and column metadata to Prisma types and preserves original database error codes for useful P2039 fallbacks. - Use Case: When adding a new database driver adapter for Prisma, follow the verification checklist to validate concurrent transactions, shadow database isolation, and dispose ownership before running Prisma Client integration tests. ## Quick Start Ask the AI to implement a Prisma driver adapter for your database following the transaction, savepoint, and error-mapping rules in this guide.

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. Map arguments using both value and ArgType, return column metadata in array row mode, and wrap driver failures in DriverAdapterError.

How do Prisma driver adapter transactions and savepoints work?▼

startTransaction acquires one dedicated connection, issues BEGIN, applies the isolation level, and returns a Transaction bound to that connection. commit and rollback are lifecycle cleanup hooks only, while optional createSavepoint, rollbackToSavepoint, and releaseSavepoint methods handle nested transactions.

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 use unique quoted identifiers, never point at the primary database, and be dropped during disposal or failure cleanup.

Why does Prisma throw P2039 with my custom driver adapter?▼

P2039 surfaces when an unmapped driver error reaches Prisma without structured mapping. Preserve originalCode and originalMessage in the DriverAdapterError so the fallback remains useful, and rethrow genuinely unexpected non-driver errors instead of fabricating GenericJs ids.

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

Common mistakes include sharing one connection across concurrent transactions, issuing duplicate SQL COMMIT or ROLLBACK inside lifecycle hooks, tracking savepoint depth globally on the adapter, splitting migration scripts on semicolons, and truncating 64-bit integers during result mapping.