prisma-driver-adapter-implementation

Implements Prisma v7 driver adapters for custom database drivers with transaction and error contracts.

Updated Aug 1, 2026
One-click install
npx skills add https://github.com/jpmartirez/kilatis --skill prisma-driver-adapter-implementation-jpmartirez
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: prisma-driver-adapter-implementation
Source: https://github.com/jpmartirez/kilatis/tree/main/frontend/.windsurf/skills/prisma-driver-adapter-implementation
Command: npx skills add https://github.com/jpmartirez/kilatis --skill prisma-driver-adapter-implementation-jpmartirez

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 type conversion requirements. This Skill provides the complete specification so an adapter works correctly with PrismaClient on the first attempt. ## Core Features & Use Cases - Full Interface Reference: Defines SqlDriverAdapter, Transaction, SqlQueryable, and SqlMigrationAwareDriverAdapterFactory with TypeScript signatures and ColumnTypeEnum mappings. - Transaction Lifecycle Protocol: Explains 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 to MappedError conversion for PostgreSQL, SQLite, and MySQL. - Use Case: When building a Prisma adapter for a new database driver, follow the step-by-step classes, run the unit and E2E test patterns, and verify against the included completion checklist. ## Quick Start Ask the AI to implement a Prisma v7 driver adapter for your database driver using this skill's interface contracts and checklist.

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 exposing connect and connectToShadowDb.

How do Prisma driver adapter transactions work?

The commit and rollback methods are lifecycle hooks only and must not issue SQL, because Prisma sends COMMIT and ROLLBACK through executeRaw. startTransaction issues BEGIN at depth one and SAVEPOINT sp_N for nested transactions.

Does the Prisma driver adapter support PostgreSQL, SQLite, and MySQL?

Yes, the factory provider field supports postgres, sqlite, mysql, and sqlserver. Each database has specific notes, such as SQLite allowing only SERIALIZABLE isolation and PostgreSQL needing a reserved connection for transactions.

How should database errors be mapped in a Prisma adapter?

Catch driver errors and rethrow them as DriverAdapterError containing a MappedError. Map database-specific codes, such as PostgreSQL 23505 to UniqueConstraintViolation, or use the postgres or sqlite error kinds with code and message fields.

Why does my Prisma adapter return wrong types for bigint or date columns?

Row mapping must convert bigint values to strings, Date objects to ISO 8601 strings, and JSON objects to stringified text. Column types must also be mapped to ColumnTypeEnum values so Prisma interprets results correctly.