prisma-8
Skill này làm gì
Nó cho agent của bạn hướng dẫn hiện hành để làm việc với Prisma 8, một bộ công cụ cơ sở dữ liệu xoay quanh hợp đồng dữ liệu. Nó dành cho lập trình viên xây ứng dụng trên Prisma 8 và muốn agent dùng đúng phiên bản hiện tại.
Khi nào nên dùng
- ✓Khi bạn chỉnh sửa file hợp đồng dữ liệu hoặc chạy lệnh tạo các artifact hợp đồng.
- ✓Khi bạn cần lập kế hoạch hoặc áp dụng một migration cơ sở dữ liệu trong dự án Prisma 8.
- ✓Khi bạn viết truy vấn cơ sở dữ liệu hoặc thiết lập kết nối cơ sở dữ liệu trong dự án Prisma 8.
Liên kết skill
https://github.com/prisma/orm/blob/main/skills/prisma-8/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Bạn có thể thêm một trường mới vào hợp đồng của tôi và lập kế hoạch migration cho nó trong dự án Prisma 8 này không?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent trước hết kiểm tra xem dự án có thật sự dùng Prisma 8 không, rồi dùng các file tham chiếu đi kèm phiên bản đã cài. Những file đó được ưu tiên hơn những gì agent nhớ về Prisma.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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.
- The project is on Prisma 8.
prisma.config.tsexportsdefinePrismaConfig({ orm: ... }), andpackage.jsondepends on@prisma/orm-postgres,@prisma/orm-sqlite, or@prisma/orm-mongo. A project withschema.prismaand@prisma/clientis Prisma 7 or earlier; this skill does not apply to it, and its instructions will break such a project. - The skill matches the installed version. Compare
metadata.library_versionin this file's frontmatter with the installed@prisma/orm-*version inpackage.json. If they differ, runprisma skills syncand re-read this file before continuing. - The contract artefacts exist.
contract.jsonandcontract.d.tssit next to the contract source named byprisma.config.ts. If they are missing or older than the source, runprisma contract emitfirst; 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.
Never reset or drop a database
Never reset or drop a database to fix a migration, marker or contract problem, and never propose it. A database can always be moved to the contract you want. When its migration history does not need to be kept (a local, development, staging or preview database), reconcile it with prisma db update. When it changes only through migrations, as production should, author the migrations that bring it there. A deploy that says there is no migration path, or MIGRATION.MARKER_MISMATCH, is covered in references/migrations.md § A database whose marker is not in the migration graph.
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:
- Edit your data contract. (
references/contract.md) - The system plans the migrations for you. (
references/migrations.md) - If you need data migrations, you edit
migration.tsand 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 writ
Câu hỏi thường gặp
Nó có hoạt động với các dự án Prisma cũ hơn không?
Không. Skill chỉ áp dụng cho dự án Prisma 8, và các hướng dẫn của nó sẽ làm hỏng dự án Prisma 7 trở xuống.
Nếu phiên bản skill không khớp với bản cài đặt của tôi thì sao?
Skill nói hãy chạy prisma skills sync và đọc lại file trước khi tiếp tục.
Những gì phải có trước khi bắt đầu?
Các artifact hợp đồng như contract.json và contract.d.ts phải tồn tại và còn mới, nên nếu thiếu, agent sẽ chạy prisma contract emit trước.
Chi tiết
Mô tả gốc của tác giả
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 u
repo: prisma/orm
Độ phổ biến
- Sao GitHub
- 48k
- Vị trí xếp hạng
- #6313
- Giấy phép
- Apache-2.0
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
adr-review
48kDạy agent của bạn rà soát các bản ghi quyết định kiến trúc với góc nhìn mới, rồi viết lại để quyết định rõ ràng với người đọc mới.
ast-visitor-pattern
48kDạy agent của bạn một mẫu mã cho union type được xử lý ở nhiều nơi, để một biến thể mới được thêm vào sẽ bị trình biên dịch phát hiện.
markdown-no-artificial-line-wraps
48kGiúp agent của bạn viết Markdown với mỗi đoạn văn trên một dòng, để chữ tự xuống dòng gọn gàng trên màn hình và các thay đổi file sạch sẽ.
multiline-commit-messages
48kChỉ cho agent của bạn cách an toàn để viết thông điệp commit git nhiều dòng trong shell, để thông điệp không bị hỏng.
Skill tương tự
api-connector-builder
280kGiúp agent của bạn xây dựng kết nối API mới theo đúng mẫu đã có, dùng khi bạn cần thêm một tích hợp mà không tạo cách làm mới.
api-design
280kGiúp agent của bạn thiết kế REST API theo các thực hành tốt nhất, hữu ích để định nghĩa cách API giao tiếp, hiển thị lỗi và tổ chức dữ liệu.
backend-patterns
280kGiúp agent của bạn với các mẫu kiến trúc phía máy chủ và tối ưu cơ sở dữ liệu, hữu ích khi xây dựng hoặc rà soát code chạy trên máy chủ.