Настройка Prisma ORM

Выбирает версию Prisma ORM для настройки или починки подключения: приложения на 6 и 7 оставляет как есть, новые начинает на Prisma 8 и проверяет связь запросом на чтение. Для случаев, когда Prisma добавляют в проект или приложение не видит свою базу.

Базы данных и SQLПак: Скиллы Prisma82 строкиprisma-orm-setup
Автор
Источник
prisma/skills/prisma-orm-setup @ a6f1929
Лицензия
MIT · Copyright (c) 2025 Prisma

Об этом скилле

Что делает

Скилл выбирает мажорную версию Prisma ORM для настройки или починки подключения и подключает базу. Сначала агент читает манифест пакетов, lock-файл, схему, prisma.config.ts и импорты: по версии CLI не понять, какой клиент у приложения, — CLI Prisma 8 может стоять рядом со старым клиентом. Приложение на Prisma 6 или 7 остаётся на своей версии: сломанное подключение — не повод обновляться.

Новое приложение получает Prisma 8. Скилл фиксирует опубликованный релиз CLI 8.x, а не latest, запускает prisma orm init и prisma skills sync, затем читает скилл prisma-8 из пакета ORM — подробные правила для Prisma 8 лежат там.

Для Prisma 7 в references/ по странице на базу: PostgreSQL, MySQL/MariaDB/PlanetScale, SQLite/Turso, SQL Server/Azure SQL, CockroachDB и Prisma Postgres, у каждой свой драйвер-адаптер (@prisma/adapter-pg, @prisma/adapter-mariadb и другие), плюс v7-client-setup.md о генерации и создании клиента. v6-mongodb.md — про MongoDB на Prisma 6. Примеры проверены на Prisma 7.10.0 и 6.19.3.

Работа считается сделанной, только когда запрос на чтение через клиент самого приложения вернул данные из нужной базы. Секреты остаются в игнорируемых env-файлах и в вывод не попадают.

Когда включать и когда не надо

Чтобы добавить Prisma в проект, подключить новую базу или понять, почему приложение не достучалось до своей.

Мажорные обновления скилл не делает: переход с 6 на 7 — к скиллу Переход на Prisma ORM 7, на Prisma 8 — к prisma-postgres-upgrade для PostgreSQL или prisma-mongodb-upgrade для MongoDB. Эти два, как и prisma-postgres-setup, — скиллы Prisma, которых в нашем каталоге нет.

Как поставить и вызвать

Команда установки ниже скачивает всю папку. Агент сам берёт скилл, когда речь о настройке Prisma или проблеме с подключением. Вызвать вручную:

  • Claude Code: /prisma-orm-setup или попросить скилл по имени.
  • Codex: $prisma-orm-setup.
  • Cursor: наберите / в чате Agent и выберите prisma-orm-setup.

Пример: /prisma-orm-setup Подключи Prisma к этому приложению на Next.js с нашей базой PostgreSQL из DATABASE_URL и докажи это запросом на чтение.

Нужны CLI Prisma, который агент запускает через пакетный менеджер проекта, и строка подключения к базе.

Чем отличается от похожих

Команды Prisma CLI и Справочник по Prisma Client API — справочники по Prisma 7 для проекта, который уже работает; этот скилл выбирает версию и добивается первого рабочего подключения. Бессерверный Postgres в Neon закрывает сторону Neon: Prisma Migrate нужна прямая строка подключения, а через пулер миграция может упасть с prepared statement "s0" already exists.

Установка

Выполните одну команду — она сохранит SKILL.md и файлы, которые он использует, в папку скиллов агента. Claude Code и Codex подхватывают новый скилл без перезапуска; если скилл не появился, перезапустите агента.

Скилл написан на английском — агент поймёт его и ответит вам по-русски.

Claude Code — macOS, Linux
curl -fsSL --create-dirs -o ~/.claude/skills/prisma-orm-setup/SKILL.md https://anymodel.org/en/skills/prisma/prisma-orm-setup/SKILL.md -o ~/.claude/skills/prisma-orm-setup/LICENSE https://anymodel.org/en/skills/prisma/prisma-orm-setup/LICENSE -o ~/.claude/skills/prisma-orm-setup/references/v6-mongodb.md https://anymodel.org/en/skills/prisma/prisma-orm-setup/references/v6-mongodb.md -o ~/.claude/skills/prisma-orm-setup/references/v7-client-setup.md https://anymodel.org/en/skills/prisma/prisma-orm-setup/references/v7-client-setup.md -o ~/.claude/skills/prisma-orm-setup/references/v7-cockroachdb.md https://anymodel.org/en/skills/prisma/prisma-orm-setup/references/v7-cockroachdb.md -o ~/.claude/skills/prisma-orm-setup/references/v7-mysql.md https://anymodel.org/en/skills/prisma/prisma-orm-setup/references/v7-mysql.md -o ~/.claude/skills/prisma-orm-setup/references/v7-postgresql.md https://anymodel.org/en/skills/prisma/prisma-orm-setup/references/v7-postgresql.md -o ~/.claude/skills/prisma-orm-setup/references/v7-prisma-postgres.md https://anymodel.org/en/skills/prisma/prisma-orm-setup/references/v7-prisma-postgres.md -o ~/.claude/skills/prisma-orm-setup/references/v7-sqlite.md https://anymodel.org/en/skills/prisma/prisma-orm-setup/references/v7-sqlite.md -o ~/.claude/skills/prisma-orm-setup/references/v7-sqlserver.md https://anymodel.org/en/skills/prisma/prisma-orm-setup/references/v7-sqlserver.md
Codex, Cursor — macOS, Linux
curl -fsSL --create-dirs -o ~/.agents/skills/prisma-orm-setup/SKILL.md https://anymodel.org/en/skills/prisma/prisma-orm-setup/SKILL.md -o ~/.agents/skills/prisma-orm-setup/LICENSE https://anymodel.org/en/skills/prisma/prisma-orm-setup/LICENSE -o ~/.agents/skills/prisma-orm-setup/references/v6-mongodb.md https://anymodel.org/en/skills/prisma/prisma-orm-setup/references/v6-mongodb.md -o ~/.agents/skills/prisma-orm-setup/references/v7-client-setup.md https://anymodel.org/en/skills/prisma/prisma-orm-setup/references/v7-client-setup.md -o ~/.agents/skills/prisma-orm-setup/references/v7-cockroachdb.md https://anymodel.org/en/skills/prisma/prisma-orm-setup/references/v7-cockroachdb.md -o ~/.agents/skills/prisma-orm-setup/references/v7-mysql.md https://anymodel.org/en/skills/prisma/prisma-orm-setup/references/v7-mysql.md -o ~/.agents/skills/prisma-orm-setup/references/v7-postgresql.md https://anymodel.org/en/skills/prisma/prisma-orm-setup/references/v7-postgresql.md -o ~/.agents/skills/prisma-orm-setup/references/v7-prisma-postgres.md https://anymodel.org/en/skills/prisma/prisma-orm-setup/references/v7-prisma-postgres.md -o ~/.agents/skills/prisma-orm-setup/references/v7-sqlite.md https://anymodel.org/en/skills/prisma/prisma-orm-setup/references/v7-sqlite.md -o ~/.agents/skills/prisma-orm-setup/references/v7-sqlserver.md https://anymodel.org/en/skills/prisma/prisma-orm-setup/references/v7-sqlserver.md
Claude Code — Windows PowerShell
foreach ($f in 'SKILL.md','LICENSE','references/v6-mongodb.md','references/v7-client-setup.md','references/v7-cockroachdb.md','references/v7-mysql.md','references/v7-postgresql.md','references/v7-prisma-postgres.md','references/v7-sqlite.md','references/v7-sqlserver.md') { $p = Join-Path "$HOME\.claude\skills\prisma-orm-setup" $f; New-Item -ItemType Directory -Force (Split-Path $p) | Out-Null; Invoke-WebRequest "https://anymodel.org/en/skills/prisma/prisma-orm-setup/$f" -UseBasicParsing -OutFile $p }
Codex, Cursor — Windows PowerShell
foreach ($f in 'SKILL.md','LICENSE','references/v6-mongodb.md','references/v7-client-setup.md','references/v7-cockroachdb.md','references/v7-mysql.md','references/v7-postgresql.md','references/v7-prisma-postgres.md','references/v7-sqlite.md','references/v7-sqlserver.md') { $p = Join-Path "$HOME\.agents\skills\prisma-orm-setup" $f; New-Item -ItemType Directory -Force (Split-Path $p) | Out-Null; Invoke-WebRequest "https://anymodel.org/en/skills/prisma/prisma-orm-setup/$f" -UseBasicParsing -OutFile $p }

Другой агент: сохраните файл в его папку скиллов или дайте ему ссылку на файл: https://anymodel.org/en/skills/prisma/prisma-orm-setup/SKILL.md

SKILL.md

Исходник

Prisma ORM setup

This skill owns ORM version selection for setup and connection work. Preserve the application's ORM version and intended database. A connection repair does not require a major upgrade.

New applications default to Prisma ORM 8. Detailed Prisma 8 configuration, queries, migrations, and runtime code belong to the versioned prisma-8 skill shipped with the ORM package.

1. Detect the starting point

Read the package manifest, lockfile, Prisma configuration, schema, and application imports. Identify the ORM version, database provider, and runtime. The CLI version alone does not identify the application's version: a Prisma 8 CLI can coexist with a legacy client, so inspect @prisma/client, @prisma/prisma7, and the schema and configuration.

Starting point Path
Prisma 8 application Step 4, without reinitializing
New application without a version choice Step 3
Prisma 6 or 7 application, or an explicit earlier major Step 5

For a new application, check the selected Prisma 8 release's provider support and runtime requirements before installing. If the provider is unsupported, explain the limitation and offer an explicitly selected earlier version. Keep the requested database; do not silently fall back or invent a supported target.

Use an existing database when supplied. Load prisma-postgres-setup only when Prisma Postgres is needed and no connection has been selected yet; return here once connected.

2. Handle requested major upgrades separately

When the user requests a major upgrade, load a workflow that supports the source version and provider. For PostgreSQL 6 or 7 to 8 in one pass, use prisma-postgres-upgrade; for PostgreSQL 7-to-8 one route at a time, use the route-by-route guide; for MongoDB 6-to-8, use prisma-mongodb-upgrade. Other providers need an explicitly supported migration path. prisma-upgrade-v7 covers 6 to 7; the package-owned prisma-8 upgrade reference covers updates within 8.

3. Bootstrap a new Prisma 8 application

Check the selected release's runtime requirements and initialization guide. Resolve and pin a published Prisma CLI 8 release, including its prerelease suffix if needed; verify its version before initialization. Do not rely on a floating latest remaining version 8.

Use the project's package manager to run the installed CLI. For PostgreSQL and Prisma schema language authoring:

prisma orm init --yes --target postgres --authoring psl

Use the supported target for the selected provider. Preserve existing application files and connection configuration; do not let setup provision an unrelated database. Verify that the resolved ORM package is version 8 before proceeding.

4. Load the installed Prisma 8 guidance

Run the installed CLI through the project's package manager:

prisma skills sync

Then read the synced prisma-8/SKILL.md, for example .agents/skills/prisma-8/SKILL.md, and follow its preconditions and selected references. Syncing alone does not load the instructions. If the package-owned guidance cannot be loaded, report the blocker. Continue with step 6.

5. Set up or repair an earlier version

For a new setup that explicitly selects an earlier version, pin packages to that major and use its runtime requirements. Keep the CLI, client, and SQL adapter releases compatible. Existing dependencies need not change for a connection repair.

  • Prisma 7 SQL: use the provider reference below and client setup.
  • Prisma 6 MongoDB: use MongoDB setup. SQL driver adapters do not apply.
  • Prisma 6 SQL: preserve its generator, schema URL, and client initialization. Use the provider's connection details below and the Prisma 6 documentation; do not copy the Prisma 7 configuration or adapter examples into it.
Database Reference
PostgreSQL PostgreSQL
MySQL / MariaDB / PlanetScale MySQL
SQLite / Turso SQLite
Microsoft SQL Server / Azure SQL SQL Server
CockroachDB CockroachDB
MongoDB / Atlas on Prisma 6 MongoDB
Prisma Postgres with Prisma 7 Prisma Postgres

The Prisma 7 SQL examples were verified with Prisma 7.10.0; the MongoDB examples with Prisma 6.19.3.

6. Connect and verify

The CLI and the application can load different environment files. Load the intended environment for each without printing secrets, and keep credentials in ignored environment files or the host's secret configuration. For SQL adapters, make the adapter's runtime options address the same database as the CLI connection URL.

For an existing app, preserve schema, migrations, and generator configuration unless the requested work requires changes. Diagnose the connection before running schema-changing commands.

Run the project's relevant checks and a read-only query through the application's client against the intended database. Report the ORM version, the loaded prisma-8 skill version where applicable, and the query result. Package installation or a successful skill sync alone is not a completed setup.

Подключить через AnyModel API

Скилл работает на той модели, которую использует агент. Подключите Claude Code, Codex или Cursor к AnyModel и запускайте его на Claude, GPT, Gemini и других моделях по одному ключу — оплата за токены, без подписки.

Ещё из пака Скиллы Prisma