prisma-driver-adapter-implementation

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

2|Updated Aug 11, 2026
One-click install
npx skills add https://github.com/MahdiaMayati/spotlight --skill prisma-driver-adapter-implementation-mahdiamayati
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: prisma-driver-adapter-implementation
Source: https://github.com/MahdiaMayati/spotlight/tree/main/spotlight-backend/.windsurf/skills/prisma-driver-adapter-implementation
Command: npx skills add https://github.com/MahdiaMayati/spotlight --skill prisma-driver-adapter-implementation-mahdiamayati

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 for implementing adapters against @prisma/driver-adapter-utils. ## Core Features & Use Cases - Contract Implementation: Guides implementation of SqlDriverAdapterFactory, SqlDriverAdapter, and Transaction interfaces, including query/execute methods and result mapping to ColumnTypeEnum. - Transaction & Savepoint Protocol: Enforces one dedicated connection per transaction, lifecycle-only commit/rollback hooks, and connection-local savepoint methods instead of adapter-global depth tracking. - Error Mapping: Preserves originalCode and originalMessage in DriverAdapterError so unmapped errors surface as useful P2039 failures. - Use Case: You are adding a new database driver to Prisma 7. Use this Skill to implement the adapter, wire up nested transactions via savepoints, map driver errors, and validate shadow-database behavior for Migrate. ## Quick Start Ask the AI to implement a Prisma 7 SQL driver adapter for your database driver following the transaction, savepoint, and error-mapping contract 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 a connect() method returning a SqlDriverAdapter that provides queryRaw, executeRaw, executeScript, and startTransaction. Match the exact @prisma/driver-adapter-utils version of your target Prisma release and follow the result and error mapping rules.

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 or 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 driver failures in DriverAdapterError and always preserve originalCode and originalMessage so the fallback error remains diagnosable instead of fabricating a GenericJs id.

Should commit() issue a SQL COMMIT in a Prisma adapter?▼

No. Prisma coordinates the SQL COMMIT and ROLLBACK through executeRaw. The transaction's commit() and rollback() methods are lifecycle hooks that must only detach listeners and release the dedicated connection exactly once.

When should I implement connectToShadowDb in a Prisma adapter?▼

Implement SqlMigrationAwareDriverAdapterFactory only when you can create an isolated shadow database, connect to it, and drop it during disposal or failure cleanup. Never point the shadow adapter at the primary database, and use quoted, cryptographically unique identifiers.