
prisma-next-build
Wire Prisma Next into the project's build system with the right build-tool plugin — Vite today via @prisma-next/vite-plugin-contract-emit (Vite 7 / 8); Next.js / Webpack / esbuild / Rollup / Turbopack are named as gaps rather than fabricated. Always offers the Vite plugin proactively when the project is using Vite. Use for vite plugin, vite-plugin, vite.config.ts, prismaVitePlugin, contract emit on save, HMR, hot reload contract, dev server, Next.js plugin, next plugin, withPrismaNext, webpack plugin, esbuild plugin, rollup plugin, build integration, dev server plugin, vite 7, vite 8.
- Installs
- 2.1K
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/prisma/prisma-next --skill prisma-next-build- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads prisma-next-build automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Prisma Next — Build-System Integration
Edit your data contract. Prisma handles the rest.
This skill covers Prisma Next's build-tool plugins — the dev-server / build-system integrations that re-emit contract artifacts automatically as the user edits the contract source. Today that's @prisma-next/vite-plugin-contract-emit for Vite 7 and Vite 8. Next.js, Webpack, esbuild, Rollup, and Turbopack plugins are documented under What Prisma Next doesn't do yet with the workaround.
If the project is using Vite and consuming the contract, install the plugin. There's no good reason not to — manual prisma-next contract emit during dev is friction the plugin eliminates. The agent should proactively offer the plugin whenever it sees a vite.config.ts in the project; the user doesn't need to ask.
When to Use
- The project is using Vite (the agent sees a
vite.config.tsor@vitejs/*deps) and the contract is being consumed at runtime — proactively offer the plugin. - User asks how to wire Prisma Next into their Vite project.
- User asks about Next.js integration, Webpack integration, or any other bundler — the answer is "not yet, here's the workaround" and the skill walks them through it.
- User mentions: vite plugin, vite-plugin, vite.config.ts, prismaVitePlugin, contract emit on save, HMR, hot reload contract, dev server, vite 7, vite 8.
- User mentions Next.js / Webpack / esbuild / Rollup / Turbopack in the context of Prisma Next integration — the gap-listing path fires.
When Not to Use
- User wants to wire
db.tsand middleware →prisma-next-runtime. - User wants to file a feature request for an unbuilt bundler plugin →
prisma-next-feedback.
Key Concepts
- The plugin's job is
contract emit, on a schedule the bundler knows about. It is not a runtime concern — at runtime, the application readscontract.json/contract.d.tsthe same way whether the plugin emitted them or a script did. The plugin saves you the manual command during development. - Vite 7 and Vite 8 only. Peer range
^7.0.0 || ^8.0.0. Vite 6 is not on the support matrix. executeContractEmitis the canonical publish path. Custom plugins for other bundlers must also call it — never re-implement the load → emit → publish dance. The atomic-rename invariant (contract.d.tsrenamed beforecontract.json) and the per-output FIFO queue live in@prisma-next/cli/control-api.- No build-time / production emission. The Vite plugin runs in
vite devonly. Forvite build/ production, runprisma-next contract emitfrom aprebuildscript.
Workflow — Vite (the supported path)
1. Install the plugin
pnpm add -D @prisma-next/vite-plugin-contract-emit
(Or npm install --save-dev, yarn add -D, bun add -d — use what the project's package manager is.)
2. Wire vite.config.ts
// vite.config.ts
import { defineConfig } from 'vite';
import { prismaVitePlugin } from '@prisma-next/vite-plugin-contract-emit';
export default defineConfig({
plugins: [prismaVitePlugin('prisma-next.config.ts')],
});
The argument is the path to prisma-next.config.ts relative to Vite root. Not the path to schema.psl or contract.ts — the plugin reads the config to discover the contract source.
3. Configure (optional)
plugins: [
prismaVitePlugin('prisma-next.config.ts', {
debounceMs: 150, // delay before re-emitting (default 150)
logLevel: 'info', // 'silent' | 'info' | 'debug' (default 'info')
}),
],
Set logLevel: 'debug' only while troubleshooting; default 'info' in committed config so the dev server isn't noisy.
4. Verify the dev loop
- Start
vite dev. - Watch for the success log:
[prisma-next] emitted contract.d.ts + contract.json. - Edit
prisma/schema.psl(e.g. add a field to a model). - Within ~150ms (the debounce), watch for a re-emit log line.
- Type-check your application code that uses the new field — should pass without restarting the dev server.
If the plugin warns about config-only watching, see Common Pitfalls.
5. CI / production builds
The plugin does not run during vite build. For CI and production deploys, run prisma-next contract emit as a prebuild step:
// package.json
{
"scripts": {
"prebuild": "prisma-next contract emit",
"build": "vite build"
}
}
pnpm build then runs prebuild automatically before build.
Workflow — React Router v7 Framework Mode
The Vite plugin is compatible with @react-router/dev/vite. Both plugins are listed in vite.config.ts; there's no ordering constraint between them today, and the Prisma Next plugin's re-emit fires alongside React Router's own SSR re-load.
import { reactRouter } from '@react-router/dev/vite';
import { prismaVitePlugin } from '@prisma-next/vite-plugin-contract-emit';
export default defineConfig({
plugins: [
reactRouter(),
prismaVitePlugin('prisma-next.config.ts'),
],
});
See examples/react-router-demo for the canonical configuration plus a smoke test that proves the dev loop.
Common Pitfalls
- Pointing the plugin at
schema.pslinstead ofprisma-next.config.ts. The argument is the config path. The plugin reads the config to find the contract source. - Vite 6 or earlier. Not supported. Upgrade Vite to 7 or 8.
- The plugin warns: "watching only the config; loader resolved inputs unavailable." The plugin couldn't resolve
contract.source.inputsfrom the loader. The fallback watches onlyprisma-next.config.tsitself, so contract edits won't re-emit. Causes: the config file throws during loading; the contract source path resolves outside the Vite root. Fix the config error first, then check that the contract source path in the config is relative to (or inside) the Vite root. - Expecting
vite buildto re-emit. It doesn't. Add aprebuildscript. - Emit errors during dev: the plugin surfaces them via Vite's error overlay. Read the overlay; the underlying cause is a contract authoring problem — chain to
prisma-next-debugfor resolution (PSL syntax, missing namespace, conflicting extensions). - Re-installing dependencies without the plugin's peer-range move. When PN bumps the plugin's peer range, you must re-run
pnpm installso the lockfile picks up the new range. A stale lockfile keeps the old plugin and produces confusing version mismatch warnings.
What Prisma Next doesn't do yet
- Next.js plugin. No first-party
@prisma-next/next-plugin-*exists. Workaround: runprisma-next contract emitfrom aprebuildscript inpackage.jsonand run it manually during development when the contract changes. Many Next.js projects also run a dev-timetsx --watchagainst a small script that calls the CLI on contract-source change. If you want a first-party Next.js plugin, file a feature request via theprisma-next-feedbackskill. - Webpack, esbuild, Rollup, Turbopack plugins. None exist yet as first-party. Workaround: the canonical
executeContractEmitsurface lives in@prisma-next/cli/control-api— a small per-bundler plugin can call it from the bundler's prebuild hook, but PN doesn't ship one for you. Thevite-plugin-contract-emitsource is the reference implementation if you want to write one yourself. If you want a first-party plugin for your bundler, file a feature request via theprisma-next-feedbackskill. vite buildintegration. The plugin runs invite devonly. Workaround: aprebuildscript that runsprisma-next contract emit. If you want the plugin to also run duringvite build, file a feature request via theprisma-next-feedbackskill.- Vite 6 or earlier. Not on the support matrix. Workaround: upgrade Vite to 7 or 8. If you have a hard reason to stay on Vite 6, file a feature request via the
prisma-next-feedbackskill.
Reference Files
- The plugin's own README: https://github.com/prisma/prisma-next/blob/main/packages/1-framework/3-tooling/vite-plugin-contract-emit/README.md — support matrix, full API surface, architecture diagram, the canonical publish path warning for custom plugin authors.
- ADR 008 (Dev Auto-Emit, CI Explicit Emit) — the rationale for splitting dev-time auto-emit from the explicit CI / build step.
- ADR 032 (Dev Auto-Emit Integration) — the plugin's integration contract with the CLI control API.
Checklist
- Plugin pointed at
prisma-next.config.ts(not the contract source). - Vite version 7 or 8 (
pnpm ls vite). -
vite devlog shows the initial emit on server start. - Editing the contract source triggers a re-emit log line.
-
prebuildscript (or equivalent) runsprisma-next contract emitfor CI / production builds. - No
vite buildexpectation that the plugin will run. - For non-Vite bundlers: surfaced the What PN doesn't do yet entry and routed the user to
prisma-next-feedbackif they want first-party support. - Did NOT confabulate a
@prisma-next/next-plugin-contract-emitpackage or any other bundler-specific plugin that doesn't exist.
FAQ
What does the prisma-next-build skill do?
Wire Prisma Next into the project's build system with the right build-tool plugin — Vite today via @prisma-next/vite-plugin-contract-emit (Vite 7 / 8); Next.js / Webpack / esbuild / Rollup / Turbopack are named as gaps rather than fabricated. Always offers the Vite plugin proactively when the project is using Vite. Use for vite plugin, vite-plugin, vite.config.ts, prismaVitePlugin, contract emit on save, HMR, hot reload contract, dev server, Next.js plugin, next plugin, withPrismaNext, webpack plugin, esbuild plugin, rollup plugin, build integration, dev server plugin, vite 7, vite 8.
How do I install prisma-next-build?
Run npx skills add https://github.com/prisma/prisma-next --skill prisma-next-build in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/prisma-next-build/ (personal) or .claude/skills/prisma-next-build/ (project).
Which AI agents can use prisma-next-build?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is prisma-next-build safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains prisma-next-build?
It is published by prisma in prisma/prisma-next, and it is an official skill from the maker of the technology it covers. It has 2,051 recorded installs.
More from prisma/prisma-next
prisma-next
prisma/prisma-next
Route a vague Prisma Next prompt to the right specific skill. Use for "help me with Prisma Next", "what is Prisma Next", "explain Prisma Next", "I'm new to PN", "where do I start", "what can I do with Prisma Next", "what can I do next with Prisma", "just ran createprisma", "tour of Prisma Next", "Prisma Next overview", and comparison questions like "Prisma Next vs Prisma 7", "PN vs Drizzle", "PN vs Kysely", "PN vs TypeORM". Do NOT use when the prompt clearly matches a workflow skill — adoption / quickstart / first-touch orientation / brownfield introspection, schema / contract editing, migration authoring (db update / migration plan / migrate), migration review on deploy / concurrent migrations, queries / db.orm / db.sql / TypedSQL, Supabase / RLS / role binding, runtime / db.ts / middleware wiring, build / Vite plugin / Next.js plugin, debug / structured error envelopes / PN- error codes, or feedback / bug report / feature request — load that sibling skill directly.
prisma-next-migrations
prisma/prisma-next
Author Prisma Next migrations — choose db update vs migration plan, edit the framework-rendered migration.ts (replace placeholder sentinels with dataTransform closures), recover from MIGRATION.HASHMISMATCH or PN-MIG-2001 unfilled placeholder. Use for prisma migrate dev, prisma migrate deploy, prisma db push, db update, db update --dry-run, migration plan, migrate, migration new, migration show, db verify, db sign, data migration, this.dataTransform, dataTransform, placeholder, generated migration.ts, edit migration.ts, MIGRATION.HASHMISMATCH, schema drift.
prisma-next-queries
prisma/prisma-next
Write Prisma Next queries for Postgres, SQLite, or Mongo — pick a lane (Postgres/SQLite db.orm. + db.sql. ; Mongo db.orm. + db.query.from(...) pipeline builder), filter / project / sort / paginate, eager-load with .include(...), Postgres/SQLite db.transaction(...), Postgres/SQLite ORM .aggregate(...), Mongo aggregations via query builder, namespace-aware accessors (db.orm. . , db.sql. . ). Triggers: query, where, match, select, project, orderBy, take, skip, include, lookup, first, all, count, aggregate, group, create, update, delete, upsert, returning, transaction, db.close, script teardown, variant, polymorphism, drizzle-style, kysely-style. Notes: .all() is a Thenable (just await it), iterators are single-use (RUNTIME.ITERATORCONSUMED), Postgres count is number while sum/avg/min/max are number null, ranges use chained .where() or and(...) (no .between(...)).
prisma-next-migration-review
prisma/prisma-next
Review what Prisma Next migrations will run on merge or deploy, render the migration graph, resolve concurrent / diamond-convergence conflicts, and configure environment refs for CI. Use for "what migrations are going to run", "what runs on deploy", merge conflict, diamond convergence, concurrent migrations, migration status, ref management, staging, production, MIGRATION.DIVERGED, MIGRATION.NOMARKER, MIGRATION.MARKERNOTINHISTORY, prisma migrate status, prisma migrate diff, prisma migrate resolve.
prisma-next-debug
prisma/prisma-next
Read a Prisma Next structured error envelope and route to the right recovery — code, domain, severity, why, fix, meta. Use for error, exception, my emit failed, my query won't typecheck, my query crashed, my migration won't apply, MIGRATION.HASHMISMATCH, BUDGET.ROWSEXCEEDED, BUDGET.TIMEEXCEEDED, RUNTIME.ABORTED, PLAN.HASHMISMATCH, CONTRACT.MARKERMISSING, PN-RUN-3001, PN-RUN-3002, PN-RUN-3030, PN-MIG-2001, PN-CLI-4011, PN-SCHEMA-0001, drift, capability missing, planner conflict, prisma studio, EXPLAIN, query log, db.end, db.close, script won't exit, hangs, close connection, pool.end, client is closed.
prisma-next-runtime
prisma/prisma-next
Wire the Prisma Next runtime — db.ts setup using postgres (...) from @prisma-next/postgres/runtime, sqlite (...) from @prisma-next/sqlite/runtime, or mongo (...) from @prisma-next/mongo/runtime; middleware composition (telemetry from @prisma-next/middleware-telemetry; lints and budgets), DATABASEURL config, per-environment branching, switching between Postgres, SQLite, and Mongo façades. Use for db.ts, postgres(), sqlite(), mongo(), middleware, telemetry, lints, budgets, DATABASEURL, .env, connection pool, poolOptions, dev vs prod config, transactions, db.transaction, read replicas, multi-database, script won't exit, hangs, close connection, db.end, db.close, pool.end, [Symbol.asyncDispose], await using.
Popular data & databases skills
supabase-postgres-best-practices
supabase/agent-skills
Postgres best practices maintained by Supabase, for Postgres running anywhere. Load this skill BEFORE writing or changing anything that lives in a Postgres database: creating or altering tables and columns (including choosing column types), schema design, migrations and declarative schema files, RLS policies and the tests that verify them, indexes, triggers, database functions, queues and scheduled jobs (pgcron, pgmq), vector/semantic search (pgvector), and restoring dumps (pgrestore) or importing data. Also load it when diagnosing slow queries, high CPU, timeouts, EXPLAIN plans, connection exhaustion, locking, bloat, or rows visible to the wrong user or tenant. This is not just a performance guide — schema, migration, security, and SQL authoring tasks need these rules too, even for a one-column change or a single query.
prisma-client-api
prisma/skills
Prisma Client API reference covering model queries, filters, operators, and client methods. Use when writing database queries, using CRUD operations, filtering data, or configuring Prisma Client. Triggers on "prisma query", "findMany", "create", "update", "delete", "$transaction".
prisma-database-setup
prisma/skills
Deprecated compatibility name for prisma-orm-setup. Use only when a user or existing integration explicitly invokes prisma-database-setup; otherwise select prisma-orm-setup.
prisma-cli
prisma/skills
Prisma ORM 7 CLI reference for existing Prisma 7 applications or explicitly selected Prisma 7 workflows. Covers prisma init, generate, migrate, db, dev, studio, and mcp. For setup, connection repair, or Prisma 8, use prisma-orm-setup; not the Prisma Platform CLI.
prisma-postgres
prisma/skills
Deprecated compatibility name for prisma-postgres-setup. Use only when a user or existing integration explicitly invokes prisma-postgres; otherwise select prisma-postgres-setup.
prisma-driver-adapter-implementation
prisma/skills
Required reference for Prisma ORM 7 SQL driver adapter work. Use when implementing or modifying adapters, adding database drivers, or touching SqlDriverAdapter, Transaction, savepoint, result mapping, or DriverAdapterError behavior. Covers current transaction lifecycle, optional savepoint hooks, original database-error preservation, and verification.