prisma-driver-adapter-implementation

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

Updated Aug 18, 2026
One-click install
npx skills add https://github.com/Shofikul-Isl4m/trading-app --skill prisma-driver-adapter-implementation-shofikul-isl4m
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: prisma-driver-adapter-implementation
Source: https://github.com/Shofikul-Isl4m/trading-app/tree/main/packages/db/.agents/skills/prisma-driver-adapter-implementation
Command: npx skills add https://github.com/Shofikul-Isl4m/trading-app --skill prisma-driver-adapter-implementation-shofikul-isl4m

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 provides the exact contract, priority rules, and verification checklist needed to implement adapters that behave correctly with Prisma ORM 7. ## Core Features & Use Cases - Contract Implementation: Guides implementation of SqlDriverAdapterFactory, SqlDriverAdapter, Transaction, and optional savepoint hooks against the installed @prisma/driver-adapter-utils version. - Transaction & Error Protocols: Enforces one dedicated connection per transaction, lifecycle-only commit/rollback hooks, connection-local savepoints, and DriverAdapterError mapping that preserves originalCode and originalMessage for useful P2039 errors. - Use Case: You are adding a new database driver to Prisma. Use this Skill to map query arguments and column types correctly, implement shadow database support for Migrate, and verify concurrent transactions commit and release exactly once. ## Quick Start Ask the AI to implement a Prisma SQL driver adapter for your database driver following the transaction, savepoint, and error mapping rules in this Skill.

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 connect(), then SqlDriverAdapter with queryRaw, executeRaw, executeScript, startTransaction, and dispose. Map arguments using both value and ArgType, return column names, types, and rows in stable order, 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; Prisma issues the SQL COMMIT or ROLLBACK via executeRaw, and savepoints are optional methods on the Transaction object.

Does the Prisma driver adapter support nested transactions?

Yes, through optional createSavepoint, rollbackToSavepoint, and releaseSavepoint methods on the Transaction object, implemented only where the provider supports them. Savepoint state must live on the transaction connection, never as adapter-global depth, because parallel transactions make global counters incorrect.

Why does my Prisma adapter throw P2039 errors?

P2039 surfaces when an unmapped driver error reaches Prisma. Preserve originalCode and originalMessage in your DriverAdapterError so P2039 carries useful details, map known conditions like unique violations to structured MappedError kinds, and rethrow genuinely unexpected non-driver errors.

What is a shadow database in Prisma driver adapters?

A shadow database is an isolated database created by connectToShadowDb() on SqlMigrationAwareDriverAdapterFactory so Migrate can validate migrations safely. It must use cryptographically unique quoted names, never point at the primary database, and be dropped during disposal or failure cleanup.