prisma-driver-adapter-implementation

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

2|Updated Feb 22, 2026
One-click install
npx skills add https://github.com/UdayPandey01/Healix --skill prisma-driver-adapter-implementation-udaypandey01
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: prisma-driver-adapter-implementation
Source: https://github.com/UdayPandey01/Healix/tree/main/core/.agents/skills/prisma-driver-adapter-implementation
Command: npx skills add https://github.com/UdayPandey01/Healix --skill prisma-driver-adapter-implementation-udaypandey01

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Building a Prisma SQL driver adapter is a protocol-boundary task where type-compatible code can still corrupt values, leak connections, or break transactions. This Skill provides the exact contract, priority rules, and verification checklist needed to implement adapters that behave correctly under Prisma ORM 7. ## Core Features & Use Cases - Contract Implementation: Guides implementation of SqlDriverAdapterFactory, SqlDriverAdapter, Transaction, and migration-aware shadow database factories. - Transaction & Savepoint Protocol: Enforces one dedicated connection per transaction, lifecycle-only commit/rollback hooks, and connection-local savepoint handling. - Error & Result Mapping: Preserves original database error codes for useful P2039 fallbacks and maps column types, arguments, and result metadata without silent corruption. - Use Case: When adding a new database driver to Prisma or debugging P2039 errors, transaction leaks, or shadow-database failures in an existing adapter, follow this guide to implement and verify the adapter against the installed @prisma/driver-adapter-utils version. ## Quick Start Ask the AI to implement a Prisma SQL driver adapter for your database driver following the prisma-driver-adapter-implementation guide, including transaction 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 SQL driver adapter?

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 installed by your target Prisma release, since the protocol boundary is version-sensitive.

How do Prisma driver adapter transactions and savepoints work?

startTransaction must acquire one dedicated connection, issue BEGIN, apply the isolation level, and return a Transaction bound to that connection. commit() and rollback() are lifecycle cleanup hooks only; Prisma issues the SQL COMMIT/ROLLBACK via executeRaw, and savepoints are optional methods on the Transaction object.

Why does my Prisma adapter throw P2039 errors?

P2039 surfaces when an unmapped driver error reaches Prisma. Wrap recognized driver failures in DriverAdapterError and always preserve originalCode and originalMessage, even when falling back to the provider-specific raw error variant, so P2039 remains debuggable.

Does a Prisma driver adapter need shadow database support?

Only if you implement SqlMigrationAwareDriverAdapterFactory for Prisma Migrate. connectToShadowDb() must create an isolated shadow database with a cryptographically unique name, connect to it, and drop it during disposal or failure cleanup—never point it at the primary database.

What are common mistakes when writing a Prisma driver adapter?

Common mistakes include sharing one connection across parallel transactions, issuing duplicate SQL COMMIT/ROLLBACK inside lifecycle hooks, tracking transaction depth globally on the adapter, splitting migration scripts naively on semicolons, and disposing caller-owned connection pools.