Getting it into your agent
It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.
git clone --depth 1 https://github.com/prisma/prisma-nextnpx agentmods add skills/prisma/prisma-next/prisma-next-migrationsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/prisma/prisma-next/prisma-next-migrations)<a href="https://agentmods.dev/skills/prisma/prisma-next/prisma-next-migrations"><img src="https://agentmods.dev/badge/skills/prisma/prisma-next/prisma-next-migrations.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00127 | $0.09810 |
| Opus 5 | $0.00063 | $0.04905 |
| Sonnet 5 | $0.00025 | $0.01962 |
| Haiku 4.5 | $0.00013 | $0.00981 |
Grade A, and why
prisma-next-migrations scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 524 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Prisma Next — Migration Authoring
Edit your data contract. Prisma Next plans the migration. You fill in any data transforms.
The three-step user model:
- You edit your data contract. (
prisma-next-contract) - Prisma Next plans the migration for you. ← this skill
- If a data transform is needed, you edit
migration.tsand self-emit. ← this skill
Once the contract changes, you choose how the change reaches the database. This skill covers the two paths (db update and migration plan + migrate), the migration-package contract, the migration.ts authoring API, and the failure modes you recover from without leaving the loop.
Targets. Migration authoring is first-class for Postgres and Mongo. The CLI reads the target from prisma-next.config.ts (set during prisma-next init --target …). Migration commands do not accept a --target flag — use a config scoped to the target you need. Examples below call out target-specific imports, markers, factories, and transaction behavior where they diverge.
When to Use
- User edited the contract and wants to apply the change to the DB.
- User wants to author a migration with a data transform.
- User wants to run pending migrations against a local DB.
- User hit
MIGRATION.HASH_MISMATCH,PN-MIG-2001(unfilled placeholder), or a partially-applied migration. - User mentions: migrate, migration, db push, db update,
prisma migrate dev,prisma migrate deploy, drift, hash mismatch, data backfill.
When Not to Use
- User wants to know what migrations will run on deploy / on merge, or to manage refs and invariants →
prisma-next-migration-review. - User wants to edit the contract →
prisma-next-contract. - User wants a deeper read of a single structured error envelope →
prisma-next-debug.
Key Concepts
db update(quick path). Reads the emitted contract, diffs against the live DB, applies the change. Optional--dry-runprints the plan without executing. Interactive destructive-op confirmation (or-yto auto-accept). Writes no migration directory. Operations needing data transforms are not handled by this path —db updateexcludes thedataoperation class entirely and short-circuits where a data transform would be required. Use only against a database that has no shared history with anyone else (your local dev DB).migration plan(formal path). Reads the emitted contract, diffs against the head of the on-disk migration graph, writes a new migration package undermigrations/app/<YYYYMMDDTHHMM>_<snake_slug>/. If any operation needs a data transform, the package'smigration.tscontainsplaceholder(...)calls you fill in.- The
app/segment in migration paths is the consuming application's contract-space id. Every migration you author lives undermigrations/app/. Extensions your contract depends on get their own sibling directories (migrations/<extension-space-id>/) — those are managed by the extension package and you don't write into them. Theapp/segment lands automatically the first time you runmigration plan/db initagainst an app-level config. - Migration package files (inside each
migrations/app/<dir>/):migration.json— manifest (metadata +migrationHash).ops.json— canonical operation list. Content-addressed;migrationHashis computed over this.migration.ts— TypeScript authoring source, framework-rendered bymigration plan(ormigration new). You edit specific holes in it (see Fill a placeholder below) and re-emitops.json/migration.jsonby running it.
- Contract snapshots.
migration.tsimports its bookend contracts from the shared, content-addressed store atmigrations/snapshots/<hex>/contract.json+contract.d.ts(<hex>is the contract's 64-hex storage hash) — not from files inside the migration package. - Self-emit. Running
node migrations/app/<dir>/migration.tsregeneratesops.jsonandmigration.jsonfrom the (possibly edited) TS source. This is the only supported way to update an existing migration package after edits. migration.tsshape. Framework-rendered. A class extendingMigration(from@prisma-next/family-mongo/migrationon Mongo, or re-exported via@prisma-next/postgres/migrationon Postgres — see the framing block below), with anoperationsgetter that returns an array of factory-call values. The file ends withMigrationCLI.run(import.meta.url, M)so executing it self-emits.placeholder(slot). A sentinel the planner emits into the renderedmigration.ts(from@prisma-next/errors/migrationon Mongo, or the@prisma-next/postgres/migrationimport on Postgres) wherever a data transform is needed. Callingplaceholder(...)at emit time throwsPN-MIG-2001Unfilled migration placeholder. The user replaces the() => placeholder(...)arrow with a real query-plan closure (Postgres) or fillsdataTransform({ check, run })sources (Mongo — see Fill a placeholder), then self-emits.this.dataTransform(endContract, name, { check, run }). The data-transform factory.checkis a rowset query whose presence-of-any-row signals "work remains";runis one or more mutation queries that perform the backfill. Both are lazy closures returning query-plans built againstendContract. The runner wrapscheckasEXISTS(...)for precheck andNOT EXISTS(...)for postcheck, so the same closure asserts both "there is work" and "the work is done".pendingPlaceholders. A boolean field on the JSON result ofmigration plan.truemeans the package was written but contains unfilled placeholders —migratewill throwPN-MIG-2001until you editmigration.tsand self-emit.migrationHash. Content-addressed identity of a migration package.MIGRATION.HASH_MISMATCHfires when the stored hash inmigration.jsondisagrees with the hash recomputed from the on-disk files (almost always: someone editedmigration.tswithout self-emitting).- Marker. Records "this database is at contract hash X for space Y". Postgres: a row in
prisma_contract.marker. Mongo: a document in the_prisma_migrationscollection (keyed by space). Each successful migration advances the marker once schema verification passes for that space.db signwrites the marker from the current contract hash, but only after a schema-verification pass succeeds (it will not sign a database whose live schema disagrees with the contract). - Apply atomicity. Postgres: each migration runs inside
BEGIN ... COMMIT; on failure, Postgres rolls back and the marker stays at the previous migration'stohash. Mongo: DDL ops (createCollection,createIndex,collMod,setValidation, …) are not wrapped in a multi-document transaction; the runner applies ops, verifies the live schema against the destination contract, and advances the marker only on verify-pass (resumable across spaces — see the MongoDB family doc). Ordinary DDL +dataTransformflows stay consistent; partial state from failed mid-migration runs is diagnosed withdb verify/db schema, not assumed away. - Operation classes. Every operation declares an
operationClass:additive,widening,data, ordestructive. The CLI surfaces these in the plan preview and in JSON output. There is nolong-runningclass and the framework does not emitCREATE INDEX CONCURRENTLY— operations stay transactional.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 3d ago First seen · 524 lines · 127 tokens per session scan A 227bd13429da
prisma-next-migrations is a skill published in the GitHub repository prisma/prisma-next (418 stars, last pushed 12d ago), licensed Apache-2.0. It adds 127 tokens to every session and 9,810 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.
Other skills, from other repositories
prisma-8
Comprehensive guide for building with Prisma 8 (Prisma Next), the contract-first data layer. Use whenever working on Prisma code in a project that uses it — authoring or editing the data contract (contract.prisma, PSL, TypeScript builders), migrations, queries (db.orm / db.sql), runtime wiring (db.ts, middleware…
record-upgrade-instructions
Record upgrade instructions alongside a Prisma Next breaking-change PR, so downstream consumers (users of @internal/ and authors of Prisma Next extensions) can apply the matching code translation automatically via the published upgrade skills. Use when you have refactored framework code and the test suite went red in…
create-pr
Creates a GitHub PR with a Linear-ticket-prefixed title and a decision-led, narrative description for prisma-next. Use when the user wants to create a pull request, open a PR, or submit changes for review.
draft-release-notes
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…
contrib-pr
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.
triage-contributor-pr
Triage open pull requests from external contributors to prisma/prisma and produce a per-PR verdict with evidence. Use when a maintainer asks to triage, evaluate, assess, or review the queue of incoming contributor PRs, to decide whether a fork PR is safe to run CI on, to check whether a PR is in scope for its version…