prisma-client-api (prisma/skills)
提供 Prisma Client 查询、筛选、运算符和方法参考,覆盖增删改查、关联和事务。
prisma-client-api:对照组 5.0、一句话提示 5.0、装 skill 5.0(0–5 分,Codex 实测,n=2/任务/组)。结论:视情况而定,相对不装 skill +0.00。
Codex CLI · gpt-6-astra
24.0 / 30
相对不装 skill 的提升:+0.00 · 看情况 · 18 次运行
视情况而定:提升 +0.00 低于 +1.0。推荐要求总分 22/30、产出质量 3.5、提升 +1.0。
前沿
通过使用 Codex 测试。
覆盖 Codex, Claude Code
Codex CLI 0.166(SOTA 档):18 次评分运行。按我们的分档规则,这档通过同时覆盖 Claude Code;它不代表第二档的结果。
分数
每一维 0 到 5 分,六维相加是满分 30 的总分。每一维都是 5 更好。成本 5 表示又便宜又快。安装 5 表示容易。
- 触发可靠性
- 5.0
- 相对不装的提升
- 2.0
- 产出质量
- 5.0
- 令牌与时间成本
- 5.0
- 安装与可移植性
- 3.0
- 安全
- 4.0
安全审查
安全静态扫描:9 CRITICAL / 9 HIGH / 0 MEDIUM。人工审查:可在断网沙箱中运行。扫描没有命中不等于绝对安全。
安装
npx skills@latest add prisma/skills --skill prisma-client-api
固定提交: 8ea289b730c2e89f7ff1f518af128b113d842a92
测试日期: 2026-11-02
我们测了什么
- Write typed queries from a description — Write src/queries.ts using Prisma Client with these functions: getUserWithPosts(id) returning the user and only their published posts, newest first, max 10; searchPosts(term, cursor?) a cursor-paginated (page size 20) case-insensitive title search; upsertUser(…
- Remove an N+1 query — src/report.ts is slow on large tables. Fix the performance problem in src/report.ts and keep the returned shape the same.
- Review Prisma code for mistakes — Review src/search.ts and src/report.ts for Prisma mistakes and anything risky; list the problems most serious first. Do not change any files.
优点
- 不点名也会被触发:Skill file read in 6/6 treatment runs.
- 不增加 token 开销:约为不装 skill 时的 1.05 倍。
- 装 skill 后绝对质量高:5.0 / 5。
缺点
- 相对不装 skill 没有可测量的提升(+0.00,在噪声范围内)。
- 一句话提示得 5.0,装 skill 得 5.0(差 +0.00)。
- 对照组已经 5.0 分:触到天花板,这个测试看不出提升。
- 每个任务每组 n=2,差距在 1 分以内属于噪声。
评测
在 Codex CLI(SOTA 档)上跑 3 个任务、对照、一句话提示、装 skill 三组,共 18 次运行,由规则脚本打分(没有 LLM 评委),断网沙箱、每次运行独立临时目录。具体做法见下方英文评测原文。
三组对比
| 组别 | 平均分(0–5) | 每次 token |
|---|---|---|
| 不装 skill | 5.0 | 92k |
| 一句话提示 | 5.0 | 88k |
| 装了 skill | 5.0 | 97k |
Codex CLI 实测,18 次运行,规则脚本打分,没有 LLM 评委。总分 24.0 / 30,结论 视情况而定。
下面是评测原文,英文。
Verdict: Situational (24.0 / 30). Source: prisma/skills, prisma-client-api, pinned at commit 8ea289b. Install: npx skills@latest add prisma/skills --skill prisma-client-api. Licence: Apache-2.0 (repo LICENSE).
What it is
The prisma-client-api skill (prisma/skills): a reference for the Prisma Client query API (findUnique/findMany, select/include, filters, cursor pagination, upsert, transactions, groupBy, raw queries) plus documentation-style guidance, delivered as SKILL.md and rule files.
How we tested
Codex CLI 0.166 (gpt-6-astra, low reasoning) on a dedicated Windows test PC, a fresh temporary project and temporary HOME/TMPDIR/caches per run, skill installed (treatment) or absent (control) or absent with the skill's core requirement squeezed into one sentence appended to the prompt (one-liner group), 2 runs per group per task, network off, /tmp writes blocked. The prompts never mention the skill (except the wording noted below).
A small Prisma project (schema, seed, src files). Tasks: write src/queries.ts with five typed query functions (user with last 10 published posts, cursor-paginated case-insensitive search, upsert, atomic transfer of posts, a groupBy count), fix an N+1 in src/report.ts keeping its output shape, and review two files for Prisma mistakes (a raw query built with string interpolation and others). Prompts do not name Prisma features. The one-liner lists the idiomatic features in one sentence.
- Write typed queries from a description — Write src/queries.ts using Prisma Client with these functions: getUserWithPosts(id) returning the user and only their published posts, newest first, max 10; searchPosts(term, cursor?) a cursor-paginated (page size 20) case-insensitive title search; upsertUser(…
- Remove an N+1 query — src/report.ts is slow on large tables. Fix the performance problem in src/report.ts and keep the returned shape the same.
- Review Prisma code for mistakes — Review src/search.ts and src/report.ts for Prisma mistakes and anything risky; list the problems most serious first. Do not change any files.
Scoring is programmatic (hidden tests / planted-issue recall / constraint checks / render+OCR where relevant), 0–5 per run. No LLM judge decided any score.
Results
The one-liner given to the third group: "Use Prisma Client idiomatically: findUnique on unique fields, include/select to avoid N+1 and over-fetching, filters with mode: 'insensitive', cursor pagination with take, upsert for insert-or-update, $transaction or updateMany for atomic changes, groupBy for aggregates, and never $queryRawUnsafe with interpolated input."
| Task | Control score | One-liner | With skill | Control tokens | One-liner tokens | With-skill tokens | Skill read |
|---|---|---|---|---|---|---|---|
| t1-queries | 5.0 | 5.0 | 5.0 | 83k | 83k | 105k | 2/2 |
| t2-n-plus-1 | 5.0 | 5.0 | 5.0 | 103k | 103k | 100k | 2/2 |
| t3-review | 5.0 | 5.0 | 5.0 | 89k | 75k | 84k | 2/2 |
Mean score: 5.0 without vs 5.0 with the skill (delta +0.0). Tokens per run: 92k vs 97k (1.05x); time 44s vs 40s. One-liner group: 5.0 (the skill's gain over the one-liner: +0.0; one-liner's own gain over no skill: +0.0); one-liner tokens 88k per run, so the skill costs 1.10x the one-liner.
What happened
- Every run in every group passed every check: control 5.00, one-liner 5.00, skill 5.00 (n=6 each). The generated queries use findUnique,
mode: 'insensitive', cursor + take, upsert, $transaction/updateMany and groupBy; the N+1 was fixed with include/select or batching; the review found the unsafe raw interpolation in every run. - The skill was read in 6/6 treatment runs and cost 97k tokens per run against 92k control and 88k one-liner (1.05x): a small overhead, no gain.
- Treatment runs copy the skill's rule files into the project (9.7 files per run on average).
- The check set has a ceiling effect: with all runs at the maximum it can only say the skill did no harm, not that it never helps. Harder tasks (Prisma 7 driver adapters, newer features the model may not know) would be needed to find a benefit.
Dimension scores
| Dimension | Score | Why |
|---|---|---|
| 1_output_quality | 5.0 | Mean score 5.00/5 with the skill (programmatic checks, see per-task table). |
| 2_lift_vs_no_skill | 2.0 | +0.00 points vs 5.00 without the skill (n=2 per task; under ~1 point is noise). |
| 3_trigger | 5.0 | Skill file read in 6/6 treatment runs. |
| 4_instructions_portability | 3 | SKILL.md plus about ten rule files; docs only. |
| 5_efficiency | 5 | 1.05x tokens (97k vs 92k per run) and 0.92x time (40s vs 44s). |
| 6_safety_hygiene | 4 | Scanner reports 9 CRITICAL, all documentation mentions of
|
Limits of this test
- Rule-based checks on code text; no Prisma client was generated and no query was executed (offline, no database).
- All groups at the ceiling: the tasks measure basic idiomatic Prisma that the base model already knows.
- n=2 per cell; newer-API knowledge (the part a docs-style skill is most likely to add) is not exercised.
- n = 2 per group per task: differences under about 1 point are noise.
- Rule-based scoring measures what the checks can see; it cannot judge taste or whether a result is the best possible.
Security
See security.md. Scan: 9 CRITICAL / 9 HIGH / 0 MEDIUM. Verdict: safe to run (no-network sandbox). A clean scan does not prove a skill safe.
Bottom line
On everyday Prisma Client work plain Codex is already correct, so the skill adds a small token cost for no visible change here. It may matter for very new Prisma features this test did not touch.
记录
Run log for prisma-client-api: Codex CLI, network off, per-run temp HOME/TMPDIR, one row per graded run. Columns: task, arm-run, score (0-5), tokens, seconds, checks passed, skill files the agent opened. t1-queries control-1: score 5.0, tokens 84040, secs 35.0, checks 7/7, opened nothing t1-queries control-2: score 5.0, tokens 83803, secs 36.4, checks 7/7, opened nothing t1-queries oneliner-1: score 5.0, tokens 83731, secs 38.4, checks 7/7, opened nothing t1-queries oneliner-2: score 5.0, tokens 83779, secs 38.1, checks 7/7, opened nothing t1-queries treatment-1: score 5.0, tokens 110031, secs 39.9, checks 7/7, opened prisma-client-api t1-queries treatment-2: score 5.0, tokens 100691, secs 36.8, checks 7/7, opened prisma-client-api t2-n-plus-1 control-1: score 5.0, tokens 103258, secs 57.7, checks 3/3, opened nothing t2-n-plus-1 control-2: score 5.0, tokens 103374, secs 54.2, checks 3/3, opened nothing t2-n-plus-1 oneliner-1: score 5.0, tokens 103307, secs 51.8, checks 3/3, opened nothing
18 次运行、3 个产物
样例产物
前沿 · 装了 skill:src/queries.ts(t1-queries,第 1 次,Codex)
import { prisma } from "./db"; export function getUserWithPosts(id: number) { return prisma.user.findUnique({ where: { id }, include: { posts: { where: { published: true }, orderBy: [{ createdAt: "desc" }, { id: "desc" }], take: 10, }, }, }); } // Pass the last post's id as the cursor for the next page. export function searchPosts(term: string, cursor?: number) { return prisma.post.findMany({ where: { title: { contains: term, mode: "insensitive" } }, orderBy: { id: "asc" }, take: 20, ...(cursor !== undefined ? { cursor: { id: cursor }, skip: 1 } : {}), }); } export function upsertUser(email: string, name: string | null) { return prisma.user.upsert({ where: { email }, update: { name }, create: { email, name }, }); } // Returns { count } with the number of posts transferred. export function transferPosts(fromId: number, toId: number) { return prisma.$transaction(async (tx) => { await tx.user.findUniqueOrThrow({ where: { id: fromId } }); await tx.user.findUniqueOrThrow({ where: { id: toId } }); return tx.post.updateMany({ where: { authorId: fromId }, data: { authorId: toId }, }); }); } // Includes authors with posts; each row has { authorId, _count: { _all } }. export function postCountsByAuthor() { return prisma.post.groupBy({ by: ["authorId"], _count: { _all: true }, orderBy: { authorId: "asc" }, }); }