Write efficient Prisma queries, design schemas, and avoid common ORM pitfalls.
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install prisma或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install prisma⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/prisma/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: Prisma description: Write efficient Prisma queries, design schemas, and avoid common ORM pitfalls. metadata: category: database skills: ["prisma", "orm", "database", "typescript", "nodejs"] ---
@default(cuid()) over @default(uuid()) for IDs—shorter, URL-safe, still unique@updatedAt doesn't update on nested writes—must touch parent record explicitly@unique on nullable field allows multiple NULLs—intended behavior but often surprisingfindUniqueOrThrow / findFirstOrThrow—cleaner than null check after findUniquecreateMany skips hooks and returns count only—use create in loop if you need records backupsert requires unique field in where—can't upsert on non-unique compound conditionsconnectOrCreate in nested writes—avoids separate existence checkselect and include are mutually exclusive—can't mix; use nested select inside includeinclude everything you'll access—check logs for unexpected queriesfindMany + include better than loop of findUnique—single query vs N queries$transaction([]) array syntax rolls back all on any failure—use for atomic operations$transaction(async (tx) => {}) hold connection—keep short$transaction doesn't retry on conflict—implement retry logic for optimistic lockinginclude result type doesn't narrow—TypeScript thinks relations might be undefinedunknown[]—need manual type assertion or Prisma.$queryRawJsonValue—cast needed; consider using typed JSON librariesPrisma.validator for reusable query fragments with correct types$executeRaw is count—not the affected rowsprisma db push for prototyping—prisma migrate dev for version controldb push can drop data silently—never use in productionmigrate dev—needs create permission or separate DB@map to keep datafindMany without take can return millions—always paginatecount() scans table—expensive on large tables; consider approximate or cached countsinclude with large relations loads everything—use cursor pagination for big lists_count: { select: { posts: true } }—single query, not N+1orderBy on non-indexed field = slow—ensure indexes match sort patterns$queryRaw for reads, $executeRaw for writes—different return typesPrisma.sql template for safe interpolation—never string concatenation$queryRawUnsafe exists but name is a warning—use only for dynamic column names@map usedconnection_limit in URL?pool_timeout=0—prevents connection exhaustion$disconnect() in scripts and tests—lambda/serverless should manage differentlydelete, convert to update—but deleteMany needs handling$use captures all queries—but adds latency to every operationinclude in middleware—transform happens before middlewareawait—Prisma returns promises; queries don't execute without awaitupdate without where = error—unlike some ORMs, Prisma requires explicit where@relation names must match—cryptic error if they don'tprisma migrate deploy in CI安装 Prisma 后,可以对 AI 说这些话来触发它
Help me get started with Prisma
Explains what Prisma does, walks through the setup, and runs a quick demo based on your current project
Use Prisma to write efficient Prisma queries, design schemas, and avoid common OR...
Invokes Prisma with the right parameters and returns the result directly in the conversation
What can I do with Prisma in my design & creative workflow?
Lists the top use cases for Prisma, with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/prisma/ 目录(个人级,所有项目可用),或 .claude/skills/prisma/(项目级)。重启 AI 客户端后,用 /prisma 主动调用,或让 AI 根据上下文自动发现并使用。
Prisma 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
Prisma 可免费安装使用。请查阅仓库了解许可证信息。
Write efficient Prisma queries, design schemas, and avoid common ORM pitfalls.
Prisma 属于「Design & Creative」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。
Automate my design & creative tasks using Prisma
Identifies repetitive steps in your workflow and sets up Prisma to handle them automatically