init
Prepare a repository for Prisma development.
init prepares the current directory for Prisma development. It runs locally and calls no platform API. It does not scaffold the ORM: use orm init to add the Prisma ORM config, contract, and runtime files to a project.
In a project's own directory, init makes the changes below. In a package of a monorepo whose root already has a prisma.config.ts, it only writes prisma.config.ts; see In a monorepo package.
- Adds a
postinstallscript topackage.json(prisma skills sync || exit 0), so the Prisma agent skills resync on every install and upgrade. - Adds
prismatodevDependenciesinpackage.json, pinned to the CLI's version, unless it is already listed. It does not install it. - Scaffolds a
prisma.config.tsrecording which agents to install skills for, in theskillsconfig section. - Runs
skills synconce.
It never prompts and is safe to rerun: each step reports what is already done. A step that cannot run, such as one that needs a package.json the directory does not have, prints a warning with an INIT.* code, and init still exits 0. init exits 2 in two cases: an option is invalid, such as --skills naming an agent the CLI does not know (CLI.INVALID_ARGUMENTS), or a prisma.config.ts already exists and cannot be used. A Prisma ORM 7 config, which has no definePrismaConfig, fails that way, with CLI.CONFIG_MISSING_MARKER. A prisma.config.ts, postinstall script, or prisma entry that already exists is never edited. If package.json already has a different postinstall script, init leaves package.json alone: it reports the script, tells you what to append, and does not add prisma to devDependencies either, so add that yourself.
Usage
npx prisma@latest init
npm installIf init added prisma, run the install straight after, so the package is in node_modules.
In a monorepo package
When a prisma.config.ts in a parent directory already applies to the current directory, as in a package inside a monorepo whose root has the config, init only writes the prisma.config.ts scaffold. A parent config applies only inside a Git repository, because the CLI looks for it from the current directory up to the directory that holds .git. Outside a Git repository, init makes every change in the package. In a monorepo package it skips the postinstall hook, the prisma dev dependency, and the skills sync, because those belong at the repository root, and it prints a line for each step it skipped. To run a skipped step in this directory anyway, pass --postinstall for the hook and the dev dependency, or --skills with your agents for the sync:
npx prisma@latest init --postinstall --skills=claude,cursorOptions
| Option | What it does |
|---|---|
--skills <agents> | Agents to install skills for, comma-separated: claude, cursor, agents, devin. Pass none to record that no agent skills are wanted. Default: all of them. |
--postinstall/--no-postinstall | Add the skills-sync postinstall hook and the prisma dev dependency. --no-postinstall skips both. Default: on, except in a monorepo package (see In a monorepo package). |
Examples
npx prisma@latest init
npx prisma@latest init --skills=claude,cursor
npx prisma@latest init --skills=none
npx prisma@latest init --no-postinstallThe scaffolded config
init writes a minimal prisma.config.ts when none exists:
import { definePrismaConfig } from "prisma/config";
export default definePrismaConfig({
skills: {
agents: ["claude", "cursor", "agents", "devin"],
},
});The prisma/config import resolves from your project's node_modules. Until prisma is installed, commands that read this file stop at CLI.CONFIG_UNREADABLE. See Configuration.
Only init writes the postinstall hook. orm init also adds prisma to devDependencies. skills sync never touches package.json.
Updated