npx skills add ...
npx skills add prisma/prisma-next --skill prisma-next-build
npx skills add prisma/prisma-next --skill 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.
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.
vite.config.ts or @vitejs/* deps) and the contract is being consumed at runtime — proactively offer the plugin.db.ts and middleware → prisma-next-runtime.prisma-next-feedback.contract emit, on a schedule the bundler knows about. It is not a runtime concern — at runtime, the application reads contract.json / contract.d.ts the same way whether the plugin emitted them or a script did. The plugin saves you the manual command during development.^7.0.0 || ^8.0.0. Vite 6 is not on the support matrix.executeContractEmit is 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.ts renamed before contract.json) and the per-output FIFO queue live in @prisma-next/cli/control-api.vite dev only. For vite build / production, run prisma-next contract emit from a prebuild script.(Or npm install --save-dev, yarn add -D, bun add -d — use what the project's package manager is.)
vite.config.tsThe 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.
Set logLevel: 'debug' only while troubleshooting; default 'info' in committed config so the dev server isn't noisy.
vite dev.[prisma-next] emitted contract.d.ts + contract.json.prisma/schema.psl (e.g. add a field to a model).If the plugin warns about config-only watching, see Common Pitfalls.
The plugin does not run during vite build. For CI and production deploys, run prisma-next contract emit as a prebuild step:
pnpm build then runs prebuild automatically before build.
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.
See examples/react-router-demo for the canonical configuration plus a smoke test that proves the dev loop.
schema.psl instead of prisma-next.config.ts. The argument is the config path. The plugin reads the config to find the contract source.contract.source.inputs from the loader. The fallback watches only prisma-next.config.ts itself, 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.vite build to re-emit. It doesn't. Add a prebuild script.prisma-next-debug for resolution (PSL syntax, missing namespace, conflicting extensions).pnpm install so the lockfile picks up the new range. A stale lockfile keeps the old plugin and produces confusing version mismatch warnings.@prisma-next/next-plugin-* exists. Workaround: run prisma-next contract emit from a prebuild script in package.json and run it manually during development when the contract changes. Many Next.js projects also run a dev-time tsx --watch against 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 the prisma-next-feedback skill.executeContractEmit surface 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. The vite-plugin-contract-emit source 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 the prisma-next-feedback skill.vite build integration. The plugin runs in vite dev only. Workaround: a prebuild script that runs prisma-next contract emit. If you want the plugin to also run during vite build, file a feature request via the prisma-next-feedback skill.prisma-next-feedback skill.prisma-next.config.ts (not the contract source).pnpm ls vite).vite dev log shows the initial emit on server start.prebuild script (or equivalent) runs prisma-next contract emit for CI / production builds.vite build expectation that the plugin will run.prisma-next-feedback if they want first-party support.@prisma-next/next-plugin-contract-emit package or any other bundler-specific plugin that doesn't exist.plugins: [
prismaVitePlugin('prisma-next.config.ts', {
debounceMs: 150, // delay before re-emitting (default 150)
logLevel: 'info', // 'silent' | 'info' | 'debug' (default 'info')
}),
],// package.json
{
"scripts": {
"prebuild": "prisma-next contract emit",
"build": "vite build"
}
}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'),
],
});