prisma-driver-adapter-implementation

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

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

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 specification so an adapter works correctly with PrismaClient on the first attempt. ## Core Features & Use Cases - Full interface reference: Covers SqlDriverAdapter, Transaction, SqlQueryable, and SqlMigrationAwareDriverAdapterFactory with TypeScript signatures and implementation steps. - 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 MappedError conversion for PostgreSQL, SQLite, and MySQL. - Use Case: You are building a Prisma adapter for a new database driver. Follow the step-by-step classes, apply the conversion helpers, and verify against the included checklist plus unit and E2E test strategies. ## 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 driver adapter for a custom database?

Implement SqlMigrationAwareDriverAdapterFactory with connect() and connectToShadowDb(), then build SqlDriverAdapter with queryRaw, executeRaw, executeScript, startTransaction, and dispose. Import all types from @prisma/driver-adapter-utils and follow the checklist before shipping.

How do Prisma adapter transactions commit and rollback work?

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

Does the Prisma driver adapter support nested transactions?

Yes, nested transactions use savepoints. Track transaction depth, issue BEGIN at depth one, and issue SAVEPOINT sp_N for deeper levels, decrementing depth when the transaction releases.

How should database errors be mapped in a Prisma adapter?

Wrap all driver errors in DriverAdapterError with a MappedError kind. Map database-specific codes like PostgreSQL 23505 to UniqueConstraintViolation, or use the postgres or sqlite error kinds with code and message fields.

What type conversions does a Prisma adapter need to handle?

Convert string arguments to int, float, or bigint and base64 strings to bytes on input. On output, convert bigint to string, Date to ISO 8601 strings, and JSON objects to stringified values matching ColumnTypeEnum.