# Implement Prisma Driver Adapters Correctly

Prisma driver adapters require precise transaction, type, and error contracts. This guide provides implementation patterns and verification steps for Prisma ORM v7 adapters.

## Install

```bash
npx skillstore add prisma/prisma-driver-adapter-implementation
```

## Metadata

- Status: approved
- Slug: prisma-prisma-driver-adapter-implementation
- Version: 7.6.0
- Author version: 7.6.0
- Skillstore revision: r2
- Version status: valid
- Tree hash: 81e84ba473f35148915679156ea985110dbe8bd94362084a9662dc05eea1175a
- Author: prisma
- GitHub username: prisma
- License: MIT
- Repository: https://github.com/prisma/skills/tree/1a9f427e9fe2137298abbcc1a6f372db92e8c40d/prisma-driver-adapter-implementation
- Ref: ebdfe608f5de2b66ff37ab4af12af8ac4f5e8006
- Supported tools: Claude, Codex, Claude Code
- Audit status: complete
- Agent install advisory: confirmation\_required
- Manual install advisory: allowed
- Artifact signature: available
- Audit attestation: unavailable
- Human verification: not\_verified
- Risk factors: external\_commands, env\_access
- Quality score: 38
- Quality tier: warning
- Public page: https://skillstore.pages.dev/skills/prisma-prisma-driver-adapter-implementation
- Manifest: https://skillstore.pages.dev/api/skills/prisma-prisma-driver-adapter-implementation/manifest

## Capabilities

- Defines the Prisma v7 factory, adapter, queryable, transaction, query, and result interfaces.
- Explains transaction lifecycle hooks, isolation validation, nested savepoints, and resource release.
- Provides patterns for argument conversion, row conversion, and column type inference.
- Shows database error conversion into Prisma DriverAdapterError and MappedError values.
- Supplies unit, end-to-end, and implementation checklists for adapter verification.

## Use Cases

- Build a New Adapter: Implement the required Prisma v7 contracts for a database driver and map its native types and errors.
- Upgrade an Existing Adapter: Compare an older adapter with Prisma v7 transaction, factory, query, and result requirements.
- Review Adapter Correctness: Check lifecycle behavior, type conversion, error mapping, disposal, and integration tests before release.

## Prompt Templates

### Explain the Contracts

```
Explain the Prisma v7 SqlDriverAdapter interfaces for a developer new to adapters. Include each required method and its return type.
```

### Design Query Mapping

```
Review my driver API and design queryRaw and executeRaw mappings. Preserve parameter binding and map results to SqlResultSet.
```

### Implement Transactions

```
Implement transaction support for [database]. Validate supported isolation levels, handle nested savepoints, release resources, and keep lifecycle hooks free of SQL.
```

### Audit a Complete Adapter

```
Audit this Prisma v7 adapter against the guide. Identify contract violations in transactions, type conversion, error mapping, disposal, shadow databases, and tests.
```

## Limitations

- The examples are illustrative and require adaptation to each database driver API.
- The skill does not provide a complete package, build configuration, or dependency setup.
- End-to-end verification requires a real database, generated Prisma client, and test isolation.
- The factory example must not reuse the primary URL for shadow database connections.

## Best Practices

- Bind query arguments through the driver instead of interpolating application values into SQL.
- Reserve a dedicated connection for transactions and release it through lifecycle hooks.
- Use an isolated shadow database and test every supported database behavior with PrismaClient.

## Anti Patterns

- Do not issue COMMIT or ROLLBACK SQL from transaction lifecycle hooks.
- Do not infer all database types from JavaScript values when driver metadata is available.
- Do not connect shadow database operations to the primary database URL.

## Security Audit

- Audited at: 2026-07-23T17:44:49.406\+00:00
- Summary: All 69 static alerts are false positives from Markdown, TypeScript examples, expected byte decoding, and a standard DATABASE\_URL reference. A separate high-severity data-integrity issue exists because connectToShadowDb\(\) can reuse the primary database URL.

## Stats

- Views: 0
- Downloads: 5
- Favorites: 0
- Popularity score: 0
