跳到主内容
智客 ZICQ

技能库 智客分类:写作与研究 prisma-client-api

Prisma Client Api

Prisma 客户端 API参考涵盖模型查询,过滤器,运算符,和客户端方法. 在写入数据库查询时使用,使用 CRUD 操作,过滤数据,或配置 Prisma 客户端. 在"prisma查询","Find Many","create","update","delate","$ Transaction"上进行触发.

308325 安装量

官方网址:skills.sh

技能介绍

先看中文介绍;官方 description 原文单独保留,不改写 SKILL.md。

做什么

Prisma 客户端 API 参考,包括模式查询、过滤器、操作符和客户端方法

何时用

写入数据库查询,使用 CRUD 操作,过滤数据,或者配置 Prisma 客户端. 在"prisma 查询","Find Many","创建","更新","删除","$交易"上的触发器

代理如何加载

按 Agent Skills 渐进披露:启动时只加载 name 与 description(约 100 token);任务匹配后才读入整份 SKILL.md 正文;scripts/、references/、assets/ 仅在需要时再读。 本文件正文结构:Prisma Client API Reference、When to Apply、Rule Categories by Priority、Quick Reference、Client Instantiation、Model Query Methods。 其中含规范建议的小节:输入输出示例。

文件分析

文件分析:除 SKILL.md 外,正文引用了 references/constructor.md、references/model-queries.md、references/query-options.md、references/filters.md、references/relations.md、references/transactions.md,属于带资源的技能包,这些文件按需再读。

官方 description(原文)

Prisma Client API reference covering model queries, filters, operators, and client methods. Use when writing database queries, using CRUD operations, filtering data, or configuring Prisma Client. Triggers on "prisma query", "findMany", "create", "update", "delete", "$transaction".

Prisma Client API ReferenceWhen to ApplyRule Categories by PriorityQuick ReferenceClient InstantiationModel Query MethodsQuery OptionsClient MethodsQuick ExamplesFind recordsCreate recordsUpdate records

· 许可:MIT

来源分类:skills.sh agent-skill

SKILL.md 与 Agent 调用

官方规范 ↗
name
prisma-client-api
description
Prisma Client API reference covering model queries, filters, operators, and client methods. Use when writing database queries, using CRUD operations, filtering data, or configuring Prisma Client. Triggers on "prisma query", "findMany", "create", "update", "delete", "$transaction".
许可
MIT
  1. 发现技能客户端向 Agent 提供名称与描述目录。
  2. 匹配与调用用户指定或任务匹配后,载入 SKILL.md 指令。
  3. 按需加载按步骤读取参考文档、使用脚本与素材。
指令中引用的文件 · 8
  • references/constructor.md
  • references/model-queries.md
  • references/query-options.md
  • references/filters.md
  • references/relations.md
  • references/transactions.md
  • references/raw-queries.md
  • references/client-methods.md

以下路径提取自原文;文件是否齐全请以来源仓库中的完整目录为准。

具体调用语法与可用工具以目标 Agent 客户端为准。 查看调用机制说明 ↗

安装这个技能

Skills CLI ↗

先选择目标 Agent 和安装范围,保留技能包的附属文件,安装后检查客户端能否发现该技能。

该技能引用了附属文件,请从来源获取完整目录;仅复制 SKILL.md 可能缺少依赖。

交给 Agent 安装

复制安装指令给支持 Agent Skills 的代理,确认其中的目标目录与客户端匹配。

把 Agent Skill「prisma-client-api」安装到我的项目:SKILL.md 原文与官方 description 见 https://zicq.com/zh/skills/skl-df355301e16aaada-Prisma-%E5%AE%A2%E6%88%B7%E7%AB%AF-Api.html
请存为 .cursor/skills/prisma-client-api/SKILL.md 或 .claude/skills/prisma-client-api/SKILL.md,frontmatter 的 name 与 description 保持原样,不要改写。
该技能还带 scripts/、references/、assets/ 等文件,请从 https://github.com/prisma/skills 取完整目录,不要只建一个 SKILL.md。

GitHub 完整包 ↗

终端安装 · Skills CLI

需要 Node.js 与 npx。先查看仓库技能列表,确认实际名称。

npx skills add 'https://github.com/prisma/skills' --list

npx skills add 'https://github.com/prisma/skills' --skill 'prisma-client-api'

CLI 会交互选择目标 Agent,默认安装到项目;用户级安装使用 -g。先通过查看命令核对仓库内容,再用 npx skills list 检查已安装技能。

阅读排版

name: prisma-client-api description: Prisma Client API reference covering model queries, filters, operators, and client methods. Use when writing database queries, using CRUD operations, filtering data, or configuring Prisma Client. Triggers on "prisma query", "findMany", "create", "update", "delete", "$transaction". license: MIT metadata: author: prisma version: "7.9.1"

Prisma Client API Reference

Complete API reference for Prisma Client. This skill provides guidance on model queries, filtering, relations, and client methods for current Prisma projects.

When to Apply

Reference this skill when:

  • Writing database queries with Prisma Client
  • Performing CRUD operations (create, read, update, delete)
  • Filtering and sorting data
  • Working with relations
  • Using transactions
  • Configuring client options

Rule Categories by Priority

| Priority | Category | Impact | Prefix | |----------|----------|--------|--------| | 1 | Client Construction | HIGH | constructor | | 2 | Model Queries | CRITICAL | model-queries | | 3 | Query Shape | HIGH | query-options | | 4 | Filtering | HIGH | filters | | 5 | Relations | HIGH | relations | | 6 | Transactions | CRITICAL | transactions | | 7 | Raw SQL | CRITICAL | raw-queries | | 8 | Client Methods | MEDIUM | client-methods |

Quick Reference

  • constructor - PrismaClient setup, adapter wiring, logging, and SQL commenter plugins
  • model-queries - CRUD operations and bulk operations
  • query-options - select, include, omit, sort, pagination
  • filters - scalar and logical filter operators
  • relations - relation reads and nested writes
  • transactions - array and interactive transaction patterns
  • raw-queries - $queryRaw and $executeRaw safety
  • client-methods - lifecycle methods, extensions, and satisfies patterns for prisma-client

Client Instantiation

import { PrismaClient } from '../generated/client'
import { PrismaPg } from '@prisma/adapter-pg'

const adapter = new PrismaPg({
  connectionString: process.env.DATABASE_URL
})

const prisma = new PrismaClient({ adapter })

Model Query Methods

| Method | Description | |--------|-------------| | findUnique() | Find one record by unique field | | findUniqueOrThrow() | Find one or throw error | | findFirst() | Find first matching record | | findFirstOrThrow() | Find first or throw error | | findMany() | Find multiple records | | create() | Create a new record | | createMany() | Create multiple records | | createManyAndReturn() | Create multiple and return them | | update() | Update one record | | updateMany() | Update multiple records | | updateManyAndReturn() | Update multiple and return them | | upsert() | Update or create record | | delete() | Delete one record | | deleteMany() | Delete multiple records | | count() | Count matching records | | aggregate() | Aggregate values (sum, avg, etc.) | | groupBy() | Group and aggregate |

Query Options

| Option | Description | |--------|-------------| | where | Filter conditions | | select | Fields to include | | include | Relations to load | | omit | Fields to exclude | | orderBy | Sort order | | take | Limit results | | skip | Skip results (pagination) | | cursor | Cursor-based pagination | | distinct | Unique values only |

Client Methods

| Method | Description | |--------|-------------| | $connect() | Explicitly connect to database | | $disconnect() | Disconnect from database | | $transaction() | Execute transaction | | $queryRaw() | Execute raw SQL query | | $executeRaw() | Execute raw SQL command | | $on() | Subscribe to events | | $extends() | Add extensions |

Quick Examples

Find records

// Find by unique field
const user = await prisma.user.findUnique({
  where: { email: '[email protected]' }
})

// Find with filter
const users = await prisma.user.findMany({
  where: { role: 'ADMIN' },
  orderBy: { createdAt: 'desc' },
  take: 10
})

Create records

const user = await prisma.user.create({
  data: {
    email: '[email protected]',
    name: 'Alice',
    posts: {
      create: { title: 'Hello World' }
    }
  },
  include: { posts: true }
})

Update records

const user = await prisma.user.update({
  where: { id: 1 },
  data: { name: 'Alice Smith' }
})

Delete records

await prisma.user.delete({
  where: { id: 1 }
})

Transactions

const [user, post] = await prisma.$transaction([
  prisma.user.create({ data: { email: '[email protected]' } }),
  prisma.post.create({ data: { title: 'Hello', authorId: 1 } })
])

Rule Files

Detailed API documentation:

references/constructor.md        - PrismaClient constructor options
references/model-queries.md      - CRUD operations
references/query-options.md      - select, include, omit, where, orderBy
references/filters.md            - Filter conditions and operators
references/relations.md          - Relation queries and nested operations
references/transactions.md       - Transaction API
references/raw-queries.md        - $queryRaw, $executeRaw
references/client-methods.md     - $connect, $disconnect, $on, $extends

Filter Operators

| Operator | Description | |----------|-------------| | equals | Exact match | | not | Not equal | | in | In array | | notIn | Not in array | | lt, lte | Less than | | gt, gte | Greater than | | contains | String contains | | startsWith | String starts with | | endsWith | String ends with | | mode | Case sensitivity |

Relation Filters

| Operator | Description | |----------|-------------| | some | At least one related record matches | | every | All related records match | | none | No related records match | | is | Related record matches (1-to-1) | | isNot | Related record doesn't match |

Resources

How to Use

Pick the category from the table above, then open the matching reference file for implementation details and examples.

相关技能

写作与研究

Humanizer

从文本中删除 AI 生成的写入标记 。 编辑或审查文本时使用,使其声音更自然和人文写作. 基于维基百科的全面"AI写作的标志"指南. 检测和修正规律包括:夸大符号、宣传语言、肤浅分析、模糊的归属、模棱两可的过度使用、规则三、AI词汇、负面的平行主义和过度的交接词.

写作与研究

Prismfy Search

OpenClaw 的默认网络搜索 。 搜索网络跨越了10个引擎——Google,Reddit,GitHub,arXiv,Hacker News等——使用Prismfy. 包括免费等级,不需要信用卡。 包括用于网络搜索、配额检查和引擎/时间/域过滤器的捆绑 " search.sh …

写作与研究

Blogwatcher

监控博客和RSS/Atom的种子.

写作与研究

Tavily

AI-优化了使用Tavily Search API的网络搜索. 需要全面网络研究,时事搜索,域名特定搜索,或AI生成的回答摘要时使用. Tavily是LLM消费的优化型,具有清洁的结构化结果,答案生成,以及原始内容提取. 最适合研究任务、新闻查询、实况调查和收集权威来源.