prisma-driver-adapter-implementation

Implements Prisma v7 driver adapters for custom database drivers in TypeScript.

Updated Jul 9, 2026
One-click install
npx skills add https://github.com/DimonikRV/ghost-pilot-project --skill prisma-driver-adapter-implementation-dimonikrv
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: prisma-driver-adapter-implementation
Source: https://github.com/DimonikRV/ghost-pilot-project/tree/main/.agents/skills/prisma-driver-adapter-implementation
Command: npx skills add https://github.com/DimonikRV/ghost-pilot-project --skill prisma-driver-adapter-implementation-dimonikrv

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Implementing a Prisma ORM v7 driver adapter requires contract details that cannot be inferred from existing code examples, such as the transaction lifecycle protocol, error mapping rules, and column type conversions. This Skill provides the complete interface definitions, implementation steps, and verification checklist needed to build a working adapter for any database. ## Core Features & Use Cases - Full Interface Reference: Covers SqlDriverAdapter, Transaction, SqlQueryable, and SqlMigrationAwareDriverAdapterFactory with TypeScript definitions and ColumnTypeEnum values. - Transaction Protocol Guidance: Explains the critical rule that commit() and rollback() are lifecycle hooks only, with BEGIN/SAVEPOINT depth handling for nested transactions. - Conversion and Error Mapping: Provides argument mapping, row mapping, column type inference, and driver error conversion to MappedError kinds for PostgreSQL, SQLite, and MySQL. - Use Case: You are building a Prisma adapter for a new database driver. Follow the four implementation steps, apply the database-specific notes, and validate against the checklist with unit and E2E tests using PrismaClient. ## Quick Start Ask the AI to implement a Prisma v7 driver adapter for your database driver following the interface contracts and checklist 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 v7 driver adapter for a custom database?▼

Implement four layers: a SqlQueryable base class with queryRaw and executeRaw, a Transaction class with commit and rollback hooks, a SqlDriverAdapter adding executeScript and startTransaction, and a SqlMigrationAwareDriverAdapterFactory with connect and connectToShadowDb methods.

How do Prisma driver adapter transactions handle commit and rollback?▼

The commit() and rollback() methods are lifecycle hooks only and must not issue SQL. Prisma sends COMMIT and ROLLBACK statements via executeRaw on the transaction object, so these methods should only release the connection or resources.

Does the Prisma driver adapter support nested transactions?▼

Yes, nested transactions use savepoints. Track transaction depth in the adapter: depth one issues BEGIN with an optional isolation level, while deeper levels issue SAVEPOINT sp_N statements.

How do I map database errors in a Prisma driver adapter?▼

Wrap all driver errors in DriverAdapterError with a MappedError kind. Map database-specific codes like PostgreSQL 23505 to UniqueConstraintViolation, or use the postgres and sqlite kinds with raw codes, falling back to GenericJs.

What type conversions does a Prisma driver adapter require?▼

Convert string arguments to int, float, or bigint based on ArgType, and base64 strings to bytes. On output, convert bigint to string, Date to ISO 8601 strings, and JSON objects to stringified form for Prisma compatibility.