prisma-driver-adapter-implementation

Implements Prisma ORM v7 driver adapters for custom database drivers.

Updated Jul 26, 2026
One-click install
npx skills add https://github.com/PrimotionStudio/turbo-repo-is-cool --skill prisma-driver-adapter-implementation-primotionstudio
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: prisma-driver-adapter-implementation
Source: https://github.com/PrimotionStudio/turbo-repo-is-cool/tree/main/packages/db/.agents/skills/prisma-driver-adapter-implementation
Command: npx skills add https://github.com/PrimotionStudio/turbo-repo-is-cool --skill prisma-driver-adapter-implementation-primotionstudio

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Implementing a Prisma 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 adapters behave correctly with PrismaClient. ## Core Features & Use Cases - Interface Contracts: Full definitions of SqlDriverAdapter, Transaction, SqlQueryable, and SqlMigrationAwareDriverAdapterFactory with TypeScript signatures. - Transaction Protocol: Explains that commit() and rollback() are lifecycle hooks only, with BEGIN/SAVEPOINT handling for nested transactions. - Type & Error Mapping: Conversion helpers for argument mapping, row mapping, column type inference, and MappedError translation for PostgreSQL, SQLite, and MySQL. - Use Case: You are building a driver adapter for a new database. Follow the step-by-step classes, conversion helpers, and the verification checklist, then validate with the included unit and E2E test strategies. ## Quick Start Ask the AI to implement a Prisma v7 driver adapter for your database driver following 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?

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

Does the Prisma driver adapter support different isolation levels?

Yes, startTransaction accepts an IsolationLevel, but the adapter must validate it per database. PostgreSQL supports all standard levels, SQLite only supports SERIALIZABLE, and invalid levels must throw DriverAdapterError with kind InvalidIsolationLevel.

How should database errors be mapped in a Prisma adapter?

Catch driver errors and rethrow them as DriverAdapterError wrapping 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.

What type conversions does a Prisma driver adapter require?

Arguments need string-to-int, string-to-bigint, string-to-float, and base64-to-bytes conversion. Result rows need bigint-to-string, Date-to-ISO-string, and JSON-to-string mapping, with column types reported via ColumnTypeEnum.