本文へ移動
cccskills
無料GitHub で公開

prisma-8

Use when working in a project that depends on @prisma/orm-postgres, @prisma/orm-sqlite, or @prisma/orm-mongo (Prisma 8, formerly Prisma Next): editing contract.prisma or a contract.ts builder, running `prisma contract emit`, planning or applying migrations, editing migration.ts, writing db.orm / db.sql / db.query queries, wiring db.ts or middleware, integrating a build tool, using the Supabase extension or RLS, or reading a dotted error code such as MIGRATION.HASH_MISMATCH. Use when the user asks "what is Prisma 8", "where do I start", or compares it to another ORM. Use when the user asks to upgrade or bump Prisma 8 in an app or an extension package. Use when you see @internal/* or @prisma/orm-* imports, prisma.config.ts with definePrismaConfig, or contract.json / contract.d.ts. Do not use for Prisma ORM 7 or earlier (schema.prisma + @prisma/client).

インストール方法を見る

含まれるファイル(95)

  • SKILL.md14.8 KB
  • references/build.md9.1 KB
  • references/contract.md43.7 KB
  • references/debug.md20.4 KB
  • references/feedback.md16.5 KB
  • references/migration-model.md18.9 KB
  • references/migration-review.md20.0 KB
  • references/migrations.md51.0 KB
  • references/queries-mongo.md13.0 KB
  • references/queries-postgres.md47.4 KB
  • references/queries.md22.3 KB
  • references/quickstart.md31.3 KB
  • references/runtime.md37.1 KB
  • references/supabase.md20.4 KB
  • references/upgrade-app.md10.4 KB
  • references/upgrade-extension.md10.1 KB
  • upgrading/app/upgrades/0.10-to-0.11/instructions.md1.9 KB
  • upgrading/app/upgrades/0.11-to-0.12/instructions.md21.9 KB
  • upgrading/app/upgrades/0.11-to-0.12/re-emit-closed-mongo-contracts.ts6.8 KB
  • upgrading/app/upgrades/0.11-to-0.12/re-emit-domain-namespaced-contracts.ts6.2 KB
  • upgrading/app/upgrades/0.11-to-0.12/re-emit-postgres-public-default.ts6.2 KB
  • upgrading/app/upgrades/0.11-to-0.12/strip-migration-labels-hints.ts12.3 KB
  • upgrading/app/upgrades/0.12-to-0.13/instructions.md16.5 KB
  • upgrading/app/upgrades/0.12-to-0.13/re-emit-mti-variant-link-columns.ts7.7 KB
  • upgrading/app/upgrades/0.13-to-0.14/instructions.md29.0 KB
  • upgrading/app/upgrades/0.13-to-0.14/migration-op-factories-to-methods.ts10.0 KB
  • upgrading/app/upgrades/0.13-to-0.14/uuid-preset-rename.ts1.3 KB
  • upgrading/app/upgrades/0.14-to-0.15/instructions.md20.2 KB
  • upgrading/app/upgrades/0.15-to-0.16/instructions.md11.0 KB
  • upgrading/app/upgrades/0.16-to-0.17/instructions.md54.2 KB
  • upgrading/app/upgrades/0.16-to-0.17/strip-sha256-hash-prefixes.ts14.4 KB
  • upgrading/app/upgrades/0.17-to-8.0.0-rc.1/instructions.md4.9 KB
  • upgrading/app/upgrades/0.7-to-0.8/instructions.md183 B
  • upgrading/app/upgrades/0.8-to-0.9/instructions.md2.7 KB
  • upgrading/app/upgrades/0.8-to-0.9/strip-inline-contracts.ts7.8 KB
  • upgrading/app/upgrades/0.9-to-0.10/instructions.md5.4 KB
  • upgrading/app/upgrades/0.9-to-0.10/stamp-storage-types-kind.ts12.7 KB
  • upgrading/app/upgrades/8.0.0-rc.1-to-8.0.0-rc.2/instructions.md39.4 KB
  • upgrading/app/upgrades/8.0.0-rc.10-to-8.0.0-rc.11/instructions.md1.5 KB
  • upgrading/app/upgrades/8.0.0-rc.11-to-8.0.0-rc.12/instructions.md49.1 KB
  • upgrading/app/upgrades/8.0.0-rc.11-to-8.0.0-rc.12/scripts/multifile-psl/add-use-prisma-8-directive.mjs1.8 KB
  • upgrading/app/upgrades/8.0.0-rc.11-to-8.0.0-rc.12/scripts/psl-verbatim-table-names/add-model-map.mjs8.5 KB
  • upgrading/app/upgrades/8.0.0-rc.12-to-8.0.0-rc.13/instructions.md24.9 KB
  • upgrading/app/upgrades/8.0.0-rc.12-to-8.0.0-rc.13/scripts/execution-ref-entry-field/rename-execution-ref-keys.ts6.5 KB
  • upgrading/app/upgrades/8.0.0-rc.13-to-8.0.0-rc.14/instructions.md36.8 KB
  • upgrading/app/upgrades/8.0.0-rc.14-to-8.0.0-rc.15/instructions.md107.6 KB
  • upgrading/app/upgrades/8.0.0-rc.14-to-8.0.0-rc.15/scripts/data-type-in-contract/data-type-in-contract.ts54.4 KB
  • upgrading/app/upgrades/8.0.0-rc.15-to-8.0.0-rc.16/instructions.md9.3 KB
  • upgrading/app/upgrades/8.0.0-rc.16-to-8.0.0-rc.17/instructions.md70.5 KB
  • upgrading/app/upgrades/8.0.0-rc.2-to-8.0.0-rc.3/instructions.md56 B
  • upgrading/app/upgrades/8.0.0-rc.3-to-8.0.0-rc.4/instructions.md7.5 KB
  • upgrading/app/upgrades/8.0.0-rc.4-to-8.0.0-rc.5/instructions.md2.3 KB
  • upgrading/app/upgrades/8.0.0-rc.5-to-8.0.0-rc.6/instructions.md9.5 KB
  • upgrading/app/upgrades/8.0.0-rc.6-to-8.0.0-rc.7/instructions.md1.8 KB
  • upgrading/app/upgrades/8.0.0-rc.7-to-8.0.0-rc.8/instructions.md1.8 KB
  • upgrading/app/upgrades/8.0.0-rc.8-to-8.0.0-rc.9/instructions.md5.1 KB
  • upgrading/app/upgrades/8.0.0-rc.9-to-8.0.0-rc.10/instructions.md5.1 KB
  • upgrading/extension/upgrades/0.10-to-0.11/instructions.md14.6 KB
  • upgrading/extension/upgrades/0.11-to-0.12/instructions.md42.1 KB
  • upgrading/extension/upgrades/0.11-to-0.12/migrate-contract-testing-imports.ts2.7 KB
  • upgrading/extension/upgrades/0.11-to-0.12/regenerate-extension-public-baseline.ts7.1 KB
  • upgrading/extension/upgrades/0.11-to-0.12/strip-migration-labels-hints.ts12.3 KB
  • upgrading/extension/upgrades/0.12-to-0.13/instructions.md14.6 KB
  • upgrading/extension/upgrades/0.13-to-0.14/instructions.md25.8 KB
  • upgrading/extension/upgrades/0.13-to-0.14/migration-op-factories-to-methods.ts10.0 KB
  • upgrading/extension/upgrades/0.13-to-0.14/uuid-preset-rename.ts1.3 KB
  • upgrading/extension/upgrades/0.14-to-0.15/instructions.md47.8 KB
  • upgrading/extension/upgrades/0.15-to-0.16/instructions.md14.5 KB
  • upgrading/extension/upgrades/0.16-to-0.17/instructions.md55.3 KB
  • upgrading/extension/upgrades/0.16-to-0.17/strip-sha256-hash-prefixes.ts14.4 KB
  • upgrading/extension/upgrades/0.17-to-8.0.0-rc.1/instructions.md12.2 KB
  • upgrading/extension/upgrades/0.7-to-0.8/instructions.md188 B
  • upgrading/extension/upgrades/0.8-to-0.9/instructions.md5.2 KB
  • upgrading/extension/upgrades/0.8-to-0.9/strip-inline-contracts.ts7.8 KB
  • upgrading/extension/upgrades/0.9-to-0.10/instructions.md8.7 KB
  • upgrading/extension/upgrades/0.9-to-0.10/stamp-storage-types-kind.ts12.7 KB
  • upgrading/extension/upgrades/8.0.0-rc.1-to-8.0.0-rc.2/instructions.md47.8 KB
  • upgrading/extension/upgrades/8.0.0-rc.10-to-8.0.0-rc.11/instructions.md1.6 KB
  • upgrading/extension/upgrades/8.0.0-rc.11-to-8.0.0-rc.12/instructions.md60.6 KB
  • upgrading/extension/upgrades/8.0.0-rc.11-to-8.0.0-rc.12/scripts/psl-verbatim-table-names/add-model-map.mjs8.5 KB
  • upgrading/extension/upgrades/8.0.0-rc.12-to-8.0.0-rc.13/instructions.md36.8 KB
  • upgrading/extension/upgrades/8.0.0-rc.12-to-8.0.0-rc.13/scripts/execution-ref-entry-field/rename-execution-ref-keys.ts6.5 KB
  • upgrading/extension/upgrades/8.0.0-rc.13-to-8.0.0-rc.14/instructions.md9.6 KB
  • upgrading/extension/upgrades/8.0.0-rc.14-to-8.0.0-rc.15/instructions.md143.6 KB
  • upgrading/extension/upgrades/8.0.0-rc.14-to-8.0.0-rc.15/scripts/data-type-in-contract/data-type-in-contract.ts54.4 KB
  • upgrading/extension/upgrades/8.0.0-rc.15-to-8.0.0-rc.16/instructions.md16.8 KB
  • upgrading/extension/upgrades/8.0.0-rc.16-to-8.0.0-rc.17/instructions.md45.9 KB
  • upgrading/extension/upgrades/8.0.0-rc.2-to-8.0.0-rc.3/instructions.md56 B
  • upgrading/extension/upgrades/8.0.0-rc.3-to-8.0.0-rc.4/instructions.md6.9 KB
  • upgrading/extension/upgrades/8.0.0-rc.4-to-8.0.0-rc.5/instructions.md8.0 KB
  • upgrading/extension/upgrades/8.0.0-rc.5-to-8.0.0-rc.6/instructions.md6.1 KB
  • upgrading/extension/upgrades/8.0.0-rc.6-to-8.0.0-rc.7/instructions.md1.9 KB
  • upgrading/extension/upgrades/8.0.0-rc.7-to-8.0.0-rc.8/instructions.md1.8 KB
  • upgrading/extension/upgrades/8.0.0-rc.8-to-8.0.0-rc.9/instructions.md9.5 KB
  • upgrading/extension/upgrades/8.0.0-rc.9-to-8.0.0-rc.10/instructions.md3.6 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Prisma 8 (Prisma 8)

Edit your data contract. Prisma handles the rest.

Prisma 8 moves fast, and your training data about it is very likely outdated. This skill ships inside the installed Prisma packages, so it describes the exact version this project has — treat it and its reference files as the source of truth, over anything you remember about Prisma.

Pre-conditions

Check these before acting on anything below. Halt on the first one that fails and tell the user what is missing.

  1. The project is on Prisma 8. prisma.config.ts exports definePrismaConfig({ orm: ... }), and package.json depends on @prisma/orm-postgres, @prisma/orm-sqlite, or @prisma/orm-mongo. A project with schema.prisma and @prisma/client is Prisma 7 or earlier; this skill does not apply to it, and its instructions will break such a project.
  2. The skill matches the installed version. Compare metadata.library_version in this file's frontmatter with the installed @prisma/orm-* version in package.json. If they differ, run prisma skills sync and re-read this file before continuing.
  3. The contract artefacts exist. contract.json and contract.d.ts sit next to the contract source named by prisma.config.ts. If they are missing or older than the source, run prisma contract emit first; every query and migration instruction below assumes current artefacts.

Import paths in the references. The reference files spell façade imports as @internal/<target>/<subpath> and @internal/extension-<name>/<subpath>. In an application those packages are published as @prisma/orm-<target>/<subpath> (@prisma/orm-postgres/runtime, @prisma/orm-mongo/config, @prisma/orm-sqlite/runtime) and @prisma/orm-extension-<name>/<subpath> (@prisma/orm-extension-pgvector/control). Write the @prisma/orm-* name in user code; the two spellings are the same package. Paths already written as @prisma/orm-* in the references are exact. The metadata.library_version in this file's frontmatter is the version it was published with; if it does not match the project's installed Prisma packages, run prisma skills sync and re-read.

Prisma 8 is a contract-first data layer. This skill routes every Prisma 8 task to the right reference file — open the reference before writing code; do not answer from this file alone.

The canonical model (one paragraph)

You author a data contract (a contract.prisma file, or a TypeScript builder). The framework emits machine-readable artifacts (contract.json, contract.d.ts) and gives you two runtime surfaces on SQL targets: a typed SQL query builder (db.sql.<ns>.<table>) and a typed ORM client (db.orm.<ns>.<Model>). On MongoDB targets only the ORM lane exists, and its keys are collection storage names (db.orm.users) rather than PSL model names — references/queries.md § MongoDB ORM addressing covers the rule. Migrations are planned from the contract diff; you review them, optionally edit the migration.ts for data transforms, and apply.

Three steps the user does:

  1. Edit your data contract. (references/contract.md)
  2. The system plans the migrations for you. (references/migrations.md)
  3. If you need data migrations, you edit migration.ts and execute it. (references/migrations.md)

Everything else — queries, runtime wiring, build integration, debugging, feedback — sits on top of those three.

One cross-cutting migration fact: migration plan does not chain from the newest migration on disk. Its origin is --from, else the db ref, else an empty database — so a project with no ref keeps planning from scratch. Over existing migrations the CLI refuses that (MIGRATION.PLAN_ORIGIN_UNKNOWN) instead of writing a full-create package; choose the exit that matches your intent rather than reflexively passing --from @empty. references/migration-model.md § The trap explains which to choose.

Routing table

Open the reference whose triggers match the task. If more than one matches, open each — they are written to compose.

TaskReferenceTriggers
Adopt / set up / first stepsreferences/quickstart.mdnew project, existing database, "what can I do with Prisma 8", "where do I start", "just ran createprisma", npx create-prisma, first steps, first query, prisma orm init greenfield setup, contract infer + db sign brownfield adoption, connect-write-read first arc, day-to-day commands (contract emit, db init, db update, migration plan, db migrate, db schema, db verify), flags --target / --authoring / --schema-path / --probe-db / --output
Edit the data contractreferences/contract.mdschema, models, fields, attributes, relations, indexes, enums, value objects (composite types), type aliases, namespaces (Postgres schemas), cross-contract foreign keys (cross-space FK), polymorphic types (@@discriminator / @@base), extension namespaces (pgvector.Vector(...), postgis.Geometry(...)), prisma.config.ts / definePrismaConfig / ormConfig, prisma contract emit, PSL, contract.prisma, contract.ts, contract.json, contract.d.ts, @internal/postgres/config, @internal/postgres/contract-builder, @internal/mongo/config, extensions:, pgvector, postgis, paradedb, Temporal / temporal-polyfill / RUNTIME.TEMPORAL_UNAVAILABLE, @@control, control policy (managed / tolerated / external / observed), soft delete, validations, callbacks
Author migrationsreferences/migrations.mddb update vs migration plan, db migrate, migration new, migration show, db update --dry-run, db verify, db sign, data migration, dataTransform, placeholder sentinels in framework-rendered migration.ts, MIGRATION.HASH_MISMATCH, MIGRATION.UNFILLED_PLACEHOLDER, data-loss questions (--delete, --rename, --allow, CLI.CONSENT_REQUIRED), schema drift
Migration graph, refs, plan originreferences/migration-model.mdmigration graph, refs, migration ref set / list / delete, the db ref, --advance-ref, --no-advance-ref, migration plan --from, from: (baseline) in plan output, greenfield / from-scratch plan, baseline, first migration before deploy (Composer / CD-managed databases), chaining migrations, retrofitting migrations onto an existing database, MIGRATION.HASH_NOT_IN_GRAPH, MIGRATION.PATH_UNREACHABLE at plan/chain time
Review migrations on deployreferences/migration-review.md"what migrations are going to run", "what runs on deploy / merge", merge conflict, diamond convergence, concurrent migrations, migration status, ref management for CI, staging / production environment refs, MIGRATION.MARKER_NOT_IN_HISTORY, MIGRATION.MISSING_INVARIANTS, db migrate --show
Write queriesreferences/queries.mdquery, where, select, project, orderBy, limit, offset, take, skip, include, lookup, first, all, count, aggregate, groupBy, create, update, delete, upsert, returning, transaction, db.orm, db.sql, runtime.query(plan) vs runtime.execute(plan), db.prepare / prepared statements, streaming / for await, many-to-many include and nested connect, and / or / not from @prisma/orm-postgres/orm-client, db.query.from(...) (Mongo pipeline), namespace-aware accessors, .all() Thenable, single-use iterators (RUNTIME.ITERATOR_CONSUMED), target-declared aggregate types (count, integer sum, and integer avg are number; count and integer sum throw outside ±(2^53 − 1) rather than round, while avg is a fraction already and carries no guard; countBigInt / sumBigInt / avgDecimal are the lossless forms, avgDecimal on PostgreSQL only), custom collection class (extends Collection), with and query fragments (QueryFragment, Filtered, Ordered), shared query fragments and scopes (db.orm.fragment(fields, body) for a filter on every model with given fields, CodecField, db.orm.public.Post.fragment(...) for a shared select / include, orderByField for an order or sort parameter from a request), drizzle-style, kysely-style. Naming types (§ Naming model and result types): "type of my model", "return type of a query", ResultType, Scalars, Shape, models / Models namespace in contract.d.ts, Models.public_User, Prisma 7 Prisma.User / GetPayload / UserGetPayload equivalents. Postgres/SQLite specifics: references/queries-postgres.md; Mongo specifics: references/queries-mongo.md
Wire the runtimereferences/runtime.mddb.ts, postgres<Contract>(...) / sqlite<Contract>(...) / mongo<Contract>(...) façades, middleware composition (lints, budgets, cache via @prisma/orm-extension-middleware-cache, custom afterQuery middleware, @prisma/orm-postgres/family-runtime), DATABASE_URL, .env, connection pool / poolOptions, dev vs prod config, transactions, read replicas, multi-database, script won't exit / hangs, db.close / pool.end, await using / [Symbol.asyncDispose]
Build-tool integrationreferences/build.mdVite plugin (@internal/vite-plugin-contract-emit, Vite 7/8), vite.config.ts, contract emit on save, HMR / dev server, Next.js / Webpack / esbuild / Rollup / Turbopack (named gaps, not fabricated)
Supabasereferences/supabase.md@internal/extension-supabase, RLS, row level security, policies (policy_select / policy_update / @@rls, auth.uid()), role binding (asUser(jwt) / asAnon() / asServiceRole()), auth.users, cross-space FKs to supabase:auth.AuthUser, JWT / JWKS (SUPABASE_JWKS_URL, SUPABASE_JWT_SECRET), SUPABASE.JWT_INVALID, SUPABASE.CONFIG_INVALID, RoleBoundDb, session pooler
Debug an errorreferences/debug.mdany structured error envelope (code, severity, why, fix, nextActions, meta), emit failed, query won't typecheck, query crashed, migration won't apply, MIGRATION.HASH_MISMATCH, MIGRATION.RUNNER_FAILED, BUDGET.ROWS_EXCEEDED, BUDGET.TIME_EXCEEDED, RUNTIME.ABORTED, RUNTIME.TEMPORAL_UNAVAILABLE, PLAN.HASH_MISMATCH, CONTRACT.MARKER_MISSING, CONFIG.* / CLI.* / CONTRACT.* / MIGRATION.* / ORM.* / RUNTIME.* codes, legacy PN-* codes, exit code 4 findings, drift, capability missing, planner conflict, EXPLAIN, query log, script won't exit / close connection
Upgrade Prisma in an appreferences/upgrade-app.md"upgrade Prisma", "upgrade Prisma 8", "bump Prisma 8", "move to Prisma 8 X.Y", @internal/* version bump in an application, per-transition upgrade instructions in upgrading/app/upgrades/, extension-pin pre-flight, PN-UPGRADE-*
Upgrade Prisma in an extensionreferences/upgrade-extension.mdthe same request in a package that is a Prisma extension (@internal/contract / SPI dependency, ^@.*/extension- name), prisma-8-check-pins, exact-pin rule, per-transition instructions in upgrading/extension/upgrades/
File feedback / ask the teamreferences/feedback.mdbug report, file an issue, feature request, missing feature, capability gap, "this is broken", surprising behaviour, Q&A / design discussion, ask the Prisma team, Prisma Discord (pris.ly/discord), extension-author questions

Routing rules

If the task clearly matches a row, open that reference directly without asking.

For a vague prompt, ask one disambiguating question. Pick from:

If you still can't tell which reference applies, ask the user what they want to do. Do not guess.

Checklist

  • If the task matches a routing-table row, open that reference before writing code.
  • If the prompt is vague, ask one disambiguating question.
  • Do not attempt to answer from this file alone — the references carry the verified tool surface.
  • If the user describes a missing feature or a misbehaviour they want fixed, open references/feedback.md.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Review one or more ADRs with fresh eyes (as a team member without prior context), identify narrative and structural issues, then rewrite them. Use when the user asks to review, improve, rewrite, or take a fresh-eyes pass on an ADR or a set of ADRs (Architecture Decision Records).

日本語の概要は準備中です。原文の説明を表示しています。

prisma/orm4.8万2026年10月10日 更新

Use the frozen-class/visitor pattern for discriminated unions that have multiple dispatch sites. Use when creating a new set of variants (commands, IR nodes, factory calls) that will be switched over in 2+ places, or when refactoring an existing union type that has grown multiple switch sites.

日本語の概要は準備中です。原文の説明を表示しています。

prisma/orm4.8万2026年10月10日 更新

Bumps `biome` package versions (e.g. `@biomejs/biome`) using `pnpm`, aligns `biome.jsonc` files with the new version/s across the repository and runs biome-related checks. Use when required to update `biome` to a newer version - explicitly or implicitly (e.g. after running `pnpm up`, `pnpm update`, `pnpm upgrade` without specific package names).

日本語の概要は準備中です。原文の説明を表示しています。

prisma/orm4.8万2026年10月10日 更新

Open a high-quality external contributor PR against prisma/orm. Use when the user is an outside contributor (not a Prisma maintainer) and wants to submit a change as a pull request from a fork. Encodes the contribution flow from CONTRIBUTING.md so the resulting PR passes review on the first round.

日本語の概要は準備中です。原文の説明を表示しています。

prisma/orm4.8万2026年10月10日 更新

create-pr

無料

Creates a GitHub PR with a Linear-ticket-prefixed title and a decision-led, narrative description for Prisma 8. Use when the user wants to create a pull request, open a PR, or submit changes for review.

日本語の概要は準備中です。原文の説明を表示しています。

prisma/orm4.8万2026年10月10日 更新

Author the committed release-notes file for a Prisma 8 release (stable or `8.0.0-rc.N`) by enumerating the merged PRs since the previous release `v*` tag (stable or `-rc.N`), resolving opaque `TML-NNNN:` titles via Linear context (never copied verbatim), triaging public-worthiness, and writing categorized notes — breaking changes first — into `docs/releases/v<version>.md` plus a mirrored `CHANGELOG.md` entry. Use when cutting a release, when the `publish-npm-version` skill reaches its "draft the release notes" step, when asked to "draft the release notes", "write the changelog for this release", "author docs/releases/v<x>.md", or "summarize what shipped since the last release".

日本語の概要は準備中です。原文の説明を表示しています。

prisma/orm4.8万2026年10月10日 更新

prisma のスキルをすべて見る

このスキルの問題を報告する