prisma-driver-adapter-implementation

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

Updated Aug 19, 2026
One-click install
npx skills add https://github.com/nethangabrielb/tasks-app-practical-exam --skill prisma-driver-adapter-implementation-nethangabrielb
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: prisma-driver-adapter-implementation
Source: https://github.com/nethangabrielb/tasks-app-practical-exam/tree/main/packages/database/.agents/skills/prisma-driver-adapter-implementation
Command: npx skills add https://github.com/nethangabrielb/tasks-app-practical-exam --skill prisma-driver-adapter-implementation-nethangabrielb

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Building a Prisma driver adapter is error-prone: type-compatible code can still corrupt values, leak connections, or break transactions. This Skill provides the exact contract rules, transaction lifecycle protocol, and error-mapping requirements needed to implement a correct SQL driver adapter for Prisma ORM 7. ## Core Features & Use Cases - Contract Reference: Defines the SqlDriverAdapterFactory, SqlDriverAdapter, and Transaction interfaces with priority-ranked implementation rules. - Transaction Protocol: Specifies dedicated-connection-per-transaction semantics, commit/rollback lifecycle hooks, and optional savepoint methods for nested transactions. - Error & Result Mapping: Covers column type mapping, argument binding, and DriverAdapterError conversion that preserves original database error codes for useful P2039 fallbacks. - Use Case: You are writing a custom adapter for a new database driver. Use this Skill to implement startTransaction, map result sets to ColumnTypeEnum, wrap driver errors correctly, and verify behavior against the included checklist. ## Quick Start Ask the AI to implement a Prisma 7 driver adapter for your database driver following the transaction 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 custom database?▼

Implement SqlDriverAdapterFactory with a connect() method returning a SqlDriverAdapter that provides queryRaw, executeRaw, executeScript, and startTransaction. Map arguments using both value and ArgType, return column metadata in array row mode, and wrap driver errors in DriverAdapterError.

How do Prisma driver adapter transactions work?▼

startTransaction must acquire one dedicated connection, issue BEGIN, apply the isolation level, and return a Transaction bound to that connection. The commit() and rollback() methods are lifecycle hooks that release the connection exactly once; Prisma issues the actual SQL COMMIT or ROLLBACK through executeRaw.

Does the Prisma adapter contract support nested transactions and savepoints?▼

Yes, through optional createSavepoint, rollbackToSavepoint, and releaseSavepoint methods on the Transaction object. Implement them only where the provider supports savepoints, validate identifiers, and never track nesting depth on the shared adapter.

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 the fallback remains useful, and map known conditions like unique constraint violations to structured MappedError kinds.

What is a shadow database in Prisma driver adapters?▼

A shadow database is an isolated database used by Prisma Migrate to validate migrations. Adapters implementing SqlMigrationAwareDriverAdapterFactory must create it with a unique quoted name, connect to it, and drop it during disposal or failure cleanup, never pointing it at the primary database.