diff --git a/apps/docs/content/docs/cli/index.mdx b/apps/docs/content/docs/cli/index.mdx index f6ed145b7b..742dd54d60 100644 --- a/apps/docs/content/docs/cli/index.mdx +++ b/apps/docs/content/docs/cli/index.mdx @@ -102,10 +102,11 @@ Plain `db migrate` never moves a ref; `--advance-ref db` is what keeps the next ## Agent skills -Prisma packages ship [agent skills](/ai/tools/skills): instructions that teach AI coding agents the installed version's commands and APIs. [`init`](/cli/init) prepares a repository once, and [`skills sync`](/cli/skills) keeps the installed copies matching your package versions. +Prisma packages ship [agent skills](/ai/tools/skills): instructions that teach AI coding agents the installed version's commands and APIs. [`init`](/cli/init) prepares a repository once, and [`skills sync`](/cli/skills) keeps the installed copies matching your package versions. Install after `init`, so the `prisma` dev dependency it adds is in `node_modules`: ```npm npx prisma@latest init +npm install npx prisma skills sync ``` diff --git a/apps/docs/content/docs/cli/init.mdx b/apps/docs/content/docs/cli/init.mdx index 5fc9b7d573..1b507242c9 100644 --- a/apps/docs/content/docs/cli/init.mdx +++ b/apps/docs/content/docs/cli/init.mdx @@ -3,25 +3,29 @@ title: init description: Prepare a repository for Prisma development. url: /cli/init metaTitle: init | Prisma CLI -metaDescription: Learn how prisma init prepares a repository for Prisma development with a skills-sync postinstall hook and a scaffolded prisma.config.ts. +metaDescription: Learn how prisma init prepares a repository for Prisma development with a skills-sync postinstall hook, a prisma dev dependency, and a scaffolded prisma.config.ts. --- `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`](/cli/orm-init) to add the Prisma ORM config, contract, and runtime files to a project. -`init` does three things: +`init` does four things: 1. Adds a `postinstall` script to `package.json` (`prisma skills sync || exit 0`), so the [Prisma agent skills](/cli/skills) resync on every install and upgrade. -2. Scaffolds a `prisma.config.ts` recording which agents to install skills for, in the [`skills` config section](/cli/configuration#agent-skills). -3. Runs [`skills sync`](/cli/skills) once. +2. Adds `prisma` to `devDependencies` in `package.json`, pinned to the CLI's version, unless it is already listed. It does not install it. +3. Scaffolds a `prisma.config.ts` recording which agents to install skills for, in the [`skills` config section](/cli/configuration#agent-skills). +4. Runs [`skills sync`](/cli/skills) once. -It never prompts, always exits 0, and is safe to rerun: each step reports what is already done. A `prisma.config.ts` or `postinstall` script that already exists is never edited. If `package.json` already has a different `postinstall` script, `init` reports it and tells you what to append instead of chaining or replacing it. +It never prompts, always exits 0, and is safe to rerun: each step reports what is already done. 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` reports it and tells you what to append instead of chaining or replacing it. ## Usage ```npm npx prisma@latest init +npm install ``` +If `init` added `prisma`, run the install straight after, so the package is in `node_modules`. + ## Options | Option | What it does | @@ -52,6 +56,6 @@ export default definePrismaConfig({ }); ``` -The `prisma/config` import resolves from your project's `node_modules`, so add `prisma` as a dev dependency before running other commands against this file. See [Configuration](/cli/configuration). +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](/cli/configuration). -Only `init` writes the `postinstall` hook. No other command edits `package.json`; [`skills sync`](/cli/skills) itself never touches it. +Only `init` writes the `postinstall` hook. [`orm init`](/cli/orm-init) also adds `prisma` to `devDependencies`. [`skills sync`](/cli/skills) never touches `package.json`.