Agent skill

Prisma Orm

by ericrisco in ericrisco/rsc-harness

A skill your agent uses when modeling data or writing type-safe queries with Prisma ORM in TypeScript — schema.prisma, prisma.config.ts, the generated Prisma Client, and Prisma Migrate, including…

MITAuto-check passedDatabases

Install Prisma Orm

skills CLI
$ npx skills add ericrisco/rsc-harness --skill prisma-orm -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install ericrisco/rsc-harness prisma-orm --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/ericrisco/rsc-harness.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/prisma-orm .claude/skills/prisma-orm && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
prisma-orm
GitHub stars
156
Token cost
~3k tokens
SKILL.md length
1,027 words
Files
6 (incl. scripts, references)
Skills in repo
229
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses when modeling data or writing type-safe queries with Prisma ORM in TypeScript — schema.prisma, prisma.config.ts, the generated Prisma Client, and Prisma Migrate, including…

  • Works in 4 steps: Generator is provider = "prisma-client"… → A driver adapter is REQUIRED on the… → Connection config lives in… → …
  • Writing type-safe queries with Prisma ORM in TypeScript — schema.prisma
  • SKILL.md covers Decide first, Install & config, Model the schema and Instantiate the client, plus 6 more sections
  • Runs Shell scripts from its folder; calls npm

What it does

Prisma Orm is an agent skill from ericrisco/rsc-harness. Use when modeling data or writing type-safe queries with Prisma ORM in TypeScript — schema.prisma, prisma.config.ts, the generated Prisma Client, and Prisma Migrate, including the v6 to v7 upgrade. NOT schema-as-TS with a SQL builder (that is drizzle-orm), NOT ORM-agnostic zero-downtime migration (that is db-migrations), NOT Postgres engine tuning (that is postgresdb).

Its SKILL.md is about 3k tokens, which your agent loads only when the skill is triggered. The skill folder holds 8 other files, including scripts and reference files (for example `evals/README.md`, `evals/cases.yaml` and `references/migrations-and-v7-upgrade.md`).

It sits in Databases, covering Database migrations, ORMs and data access and Type safety. It works with Prisma, Drizzle ORM, TypeScript and SQL. The repository describes itself as: Your agent invents things because it has no memory, and can't touch your database because it has no arms. rsc is the meta-harness that gives it both, plus the trade to know the… The licence is MIT.

When your agent uses it

  • Writing type-safe queries with Prisma ORM in TypeScript — schema.prisma
  • Prisma.config.ts
  • The generated Prisma Client
  • Including the v6 to v7 upgrade

Example prompts

  • “/prisma-orm”

Requirements

  • Node.js
  • A Bash shell

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. Generator is provider = "prisma-client" and output is REQUIRED. The client is no
  2. A driver adapter is REQUIRED on the constructor. new PrismaClient({ adapter }). Omit
  3. Connection config lives in prisma.config.ts, not the datasource block. url,
  4. Rust-free by default. The query engine is TypeScript now — no native binaries, ~3x

What it can do on your machine

Read from SKILL.md and the folder at commit 92fde8f. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/ (Shell), which the agent can run.

    Shell commands in SKILL.md call:

    • npm

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • prisma.io

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Prisma Orm loads about 3k tokens when it runs, and up to ~6.5k if it reads all its reference files. Until then it costs about 98 tokens; SKILL.md has 1,027 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~98
When it runs · the whole SKILL.md, loaded when a task matches
~3k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~6.5k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from ericrisco/rsc-harness at commit 92fde8f, republished under its MIT licence (© ericrisco). 1,027 words, ~2,988 tokens.

Download SKILL.mdSave it as .claude/skills/prisma-orm/SKILL.md (or your agent's skills folder). This skill also uses 5 other files; get the full folder from GitHub.
name
prisma-orm
description
Use when modeling data or writing type-safe queries with Prisma ORM in TypeScript — `schema.prisma`, `prisma.config.ts`, the generated Prisma Client, and Prisma Migrate, including the v6 to v7 upgrade. NOT schema-as-TS with a SQL builder (that is `drizzle-orm`), NOT ORM-agnostic zero-downtime migration (that is `db-migrations`), NOT Postgres engine tuning (that is `postgresdb`).
tags
prisma, prisma-orm, typescript-orm, prisma-migrate, schema, migrations, orm
recommends
drizzle-orm, db-migrations, postgresdb, neon, planetscale, supabase, sqlite-turso, typescript, sql
origin
risco

Prisma ORM (v7)

You declare a data model in schema.prisma, generate a type-safe client, and query it without the foot-guns: N+1, over-fetch, unbounded reads. This skill is Prisma 7-native. If you are writing prisma-client-js, binaryTargets, or new PrismaClient() with no adapter, you are writing v6 — stop and read the upgrade notes.

Decide first

Prisma is a schema DSL (schema.prisma) + a generated type-safe client + Prisma Migrate. The rival, Drizzle, is schema-as-TypeScript with a SQL builder and no codegen — if the ask says pgTable, drizzle-kit, or drizzle.config.ts, that is ../drizzle-orm/SKILL.md, not here.

Prisma 7 has four non-negotiables. Get these wrong and nothing runs:

  1. Generator is provider = "prisma-client" and output is REQUIRED. The client is no longer emitted into node_modules — you import it from your generated path. The legacy prisma-client-js generator is gone.
  2. A driver adapter is REQUIRED on the constructor. new PrismaClient({ adapter }). Omit it and you get requires either adapter or accelerateUrl at runtime.
  3. Connection config lives in prisma.config.ts, not the datasource block. url, directUrl, shadowDatabaseUrl in schema.prisma are deprecated in v7.
  4. Rust-free by default. The query engine is TypeScript now — no native binaries, ~3x faster queries, ~90% smaller bundles. binaryTargets no longer exists.

Version note: stable is the 7.x line — latest stable is 7.7.0 (2026-04-07) per the Prisma changelog (accessed 2026-06-02); pin >=7.7. "Prisma Next" — the future fully-TS foundation, first announced 2026-03-04 in The Next Evolution of Prisma ORM — reached Early Access in May 2026 per the Prisma Next Roadmap (2026-03-20, accessed 2026-06-02). Early Access is forward-looking only and not the install default; for production work stay on stable 7.x.

Install & config

Install the CLI, the client, and the adapter for your database. One adapter per DB.

bash
# Postgres
npm i -D prisma
npm i @prisma/client @prisma/adapter-pg
# others: @prisma/adapter-better-sqlite3, -libsql, -mariadb, -mssql, -d1

Minimal schema.prisma — note the generator shape and the no-url datasource:

prisma
generator client {
  provider = "prisma-client"
  output   = "../src/generated/prisma" // REQUIRED in v7
}

datasource db {
  provider = "postgresql" // url moved to prisma.config.ts
}

prisma.config.ts holds the connection (replaces url in the datasource):

ts
import "dotenv/config";
import { defineConfig } from "prisma/config";

export default defineConfig({
  schema: "prisma/schema.prisma",
  migrations: { seed: "tsx prisma/seed.ts" },
  datasource: { url: process.env.DATABASE_URL! },
});

package.json scripts:

json
{
  "scripts": {
    "db:generate": "prisma generate",
    "db:migrate": "prisma migrate dev",
    "db:deploy": "prisma migrate deploy",
    "db:seed": "prisma db seed"
  }
}

Model the schema

schema.prisma is the single source of truth. Every relation needs an explicit FK field and an index on that FK column — Prisma does not index foreign keys for you, and a join on an unindexed column is a sequential scan.

prisma
model User {
  id        String   @id @default(cuid())
  email     String   @unique
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  role      Role     @default(MEMBER)
  posts     Post[]
}

model Post {
  id        String   @id @default(cuid())
  title     String
  body      String   @db.Text // native type
  published Boolean  @default(false)
  author    User     @relation(fields: [authorId], references: [id])
  authorId  String
  createdAt DateTime @default(now())

  @@index([authorId])            // index the FK you join/filter on
  @@unique([authorId, title])    // composite uniqueness
}

enum Role {
  ADMIN
  MEMBER
}
prisma
// Bad: relation with no index on the FK — every join scans the table
model Post {
  author   User   @relation(fields: [authorId], references: [id])
  authorId String
}
// Good: add @@index([authorId]) — see the model above.

Instantiate the client

One PrismaClient per process. A new client per request opens a fresh connection pool each time and exhausts the database. In dev, pin it to globalThis so HMR reuses one instance.

ts
import { PrismaClient } from "../generated/prisma/client";
import { PrismaPg } from "@prisma/adapter-pg";

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

const globalForPrisma = globalThis as unknown as { prisma?: PrismaClient };
export const prisma =
  globalForPrisma.prisma ??
  new PrismaClient({ adapter, log: ["query"] }); // log surfaces emitted SQL

if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma;
ts
// Bad: no adapter → throws "requires either adapter or accelerateUrl"
export const prisma = new PrismaClient();
// Bad: per-request instance → connection-pool exhaustion
app.get("/u", () => new PrismaClient({ adapter }).user.findMany());

Query safely

Three rules cover most query bugs:

  • Prefer select over include. select returns only the named fields; include adds a relation but otherwise returns all scalar fields (over-fetch). Never put select and include at the same level — Prisma rejects it.
  • Always pass take to findMany. It is unbounded by default and will happily stream the whole table.
  • Never query inside a loop. Batch with where: { id: { in: ids } }.
ts
// Good: shape the row, bound the read
const users = await prisma.user.findMany({
  take: 20,
  where: { role: "MEMBER" },
  select: { id: true, email: true, posts: { select: { title: true } } },
});
ts
// Bad: N queries in a loop
for (const id of ids) {
  await prisma.user.findUnique({ where: { id } });
}
// Good: one query
const users = await prisma.user.findMany({ where: { id: { in: ids } } });

Pagination — pick by table size:

NeedUseWhy
Small/medium set, jump to page Nskip + take (offset)Simple; skip gets slow on huge offsets
Large set, infinite scroll, stablecursor + takeSeeks by indexed id, constant cost

Writes: upsert for create-or-update; createMany({ data, skipDuplicates: true }) for bulk.

Transactions — pick by dependency:

SituationForm
Independent writes that must all commitprisma.$transaction([opA, opB]) (array)
Read, branch on the result, then writeprisma.$transaction(async (tx) => { … }) (interactive)

Lean on generated types instead of hand-writing shapes: Prisma.UserGetPayload<…> and Prisma.validator keep a query and its type in sync. See references/queries-and-performance.md for the full cookbook.

Performance: kill N+1 and over-fetch

relationLoadStrategy decides how relations load:

  • "join" (default) — one query: a LATERAL JOIN with JSON aggregation on Postgres (correlated subqueries on MySQL). This is the N+1 killer. The top-level choice cascades to nested loads.
  • "query" — one query per relation, joined in the app. Sometimes wins when a join fans out rows badly.
ts
const feed = await prisma.user.findMany({
  relationLoadStrategy: "join",
  take: 20,
  select: { id: true, email: true, posts: { select: { id: true, title: true } } },
});

Then: select only the fields you render, and @@index the columns you filter and order on. To see what Prisma actually emits, set log: ["query"] on the client and read the SQL. For the deep perf checklist (N+1 detection, index selection, reading the plan) see references/queries-and-performance.md. For EXPLAIN ANALYZE, index theory, and pool sizing — that is the database engine's job: ../postgresdb/SKILL.md.

Show full SKILL.md (365 more words)Show less

Raw SQL safely

Use raw SQL only through the tagged-template form — it parameterizes. The *Unsafe variants concatenate strings and open SQL injection.

ts
// Good: parameterized tagged template
const rows = await prisma.$queryRaw`SELECT id FROM "User" WHERE email = ${email}`;

// Bad: interpolated string into the Unsafe API → SQL injection
const rows = await prisma.$queryRawUnsafe(`SELECT id FROM "User" WHERE email = '${email}'`);

Compose fragments with Prisma.sql / Prisma.join. For fully type-checked results, write .sql files and use $queryRawTyped. Safety matrix in references/queries-and-performance.md.

Migrations

Pick the command by environment — this is the most common mix-up:

CommandUse whereDoes
prisma migrate devdevelopment onlyCreates a migration, applies it, regenerates the client; uses a shadow DB
prisma migrate deployCI / productionApplies pending migrations only — never generates, never resets
prisma db pushprototyping / spikesSyncs schema to the DB with no migration file

Rules with teeth:

  • Never run migrate dev against production. It can reset the database.
  • Never edit a migration that has already been applied. Create a new one.
  • A shadow DB lets migrate dev detect drift; it must be a separate, disposable database.
  • On drift or a failed migration, use prisma migrate resolve --applied|--rolled-back.
  • Seed via the seed entry in prisma.config.ts and prisma db seed.

Failed-migration recovery, baselining an existing database, and the full Prisma 6 to 7 upgrade are in references/migrations-and-v7-upgrade.md. For ORM-independent evolution strategy (expand/contract, dual-write, zero-downtime backfills) that is ../db-migrations/SKILL.md.

Anti-patterns

Anti-patternWhy it bitesDo instead
new PrismaClient() with no adapterv7 throws requires either adapter or accelerateUrlPass a driver adapter
New PrismaClient per requestPool exhaustion, dropped connectionsOne instance per process; globalThis in dev
prisma-client-js generatorLegacy v6 generator, removed in v7provider = "prisma-client" + output
binaryTargets in the generatorRust-era artifact; v7 is Rust-freeDelete it
Unbounded findMany()Streams the whole tableAlways pass take (and cursor for paging)
Fat include everywhereOver-fetches every scalarselect only the rendered fields
Query inside a for loopN+1 round tripsBatch where: { id: { in: ids } } or relationLoadStrategy: "join"
$queryRawUnsafe(\…${x}…`)`SQL injectionTagged $queryRaw\…${x}``
migrate dev in CI/prodCan reset the production DBmigrate deploy
Editing an applied migrationDrift, broken historyNew migration; migrate resolve for drift
FK with no @@indexJoins do sequential scans@@index([fkColumn])

Verify

Run scripts/verify.sh <path> to statically check emitted artifacts: it confirms the prisma-client generator + output, an adapter on the constructor, and flags $queryRawUnsafe injection, binaryTargets, unbounded findMany, and wrong-ORM contamination. Read-only; no database connection.

© ericrisco, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 5 other files (scripts, references) in skills/prisma-orm of ericrisco/rsc-harness.

  • SKILL.md
  • evals/README.md
  • evals/cases.yaml
  • references/migrations-and-v7-upgrade.md
  • references/queries-and-performance.md
  • scripts/verify.sh

Open the folder on GitHubat commit 92fde8f

Compare with similar skills

Prisma Orm next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Prisma Orm compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Prisma Orm this skillericrisco/rsc-harness156—~3kAutomated safety check: PassMIT
Drizzle Ormgrowupanand/ConvoForm1011 repos~2.7kAutomated safety check: PassApache-2.0
Drizzle Orm Expertdavila7/claude-code-templates32k3 repos~2.6kAutomated safety check: PassMIT
Prisma 8 Contract-First ORMprisma/orm48k—~3.7kAutomated safety check: NotesApache-2.0
Daoyou Data LayerChurchTao/Daoyou119—~1.9kAutomated safety check: PassGPL-3.0
Database Migrationsaffaan-m/ECC274k4 repos~3kAutomated safety check: PassMIT

Similar skills

  • Drizzle Orm

    growupanand/ConvoForm

    Type-safe SQL ORM for TypeScript with zero runtime overhead. An agent skill from growupanand/ConvoForm.

    101 GitHub starsUsed in 1 repo~2.7k tokens
    DatabasesAuto-check passed
  • Drizzle Orm Expert

    davila7/claude-code-templates

    Expert in Drizzle ORM for TypeScript — schema design, relational queries, migrations, and serverless database integration.

    32k GitHub starsUsed in 3 repos~2.6k tokens
    DatabasesAuto-check passed
  • Official

    Routes Prisma 8 tasks such as contracts, migrations, queries and upgrades to the right reference files for projects on the contract-first @prisma/orm packages.

    48k GitHub stars~3.7k tokensUpdated today
    DatabasesAuto-check: notes
  • Daoyou Data Layer

    ChurchTao/Daoyou

    Daoyou Drizzle/PostgreSQL、事务、V6 角色与宗门归属、统一背包、Redis 战局和回放归档指南。Use when modifying schema, migrations, repositories, persistence mappers, resource commits or durable game models.

    119 GitHub stars~1.9k tokensUpdated yesterday
    DatabasesAuto-check passed
  • Safe, reversible database migration patterns: forward-only production changes, expand-contract zero-downtime renames, concurrent indexes, batched backfills, and per-tool workflows for PostgreSQL…

    274k GitHub starsUsed in 4 repos~3k tokens
    DatabasesAuto-check passed
  • Better Drizzle

    almeidazs/better-drizzle

    Write, review, and debug code that uses better-drizzle, the typed repository layer over Drizzle ORM 1.x (better(db), client.users.findMany, paginate, cursor, upsertMany, relation include/connect…

    347 GitHub stars~1.7k tokensUpdated 2 days ago
    DatabasesAuto-check passed

More from ericrisco/rsc-harness

All 229 skills in this repo
  • Ab Testing

    ericrisco/rsc-harness

    A skill your agent uses when designing or analyzing a controlled experiment — falsifiable hypothesis, sample size from an MDE, reading significance/CI/power, CUPED, or rescuing tests that won't go…

    156 GitHub stars~2.4k tokensUpdated today
    Auto-check passed
  • Accessibility

    ericrisco/rsc-harness

    A skill your agent uses when making a web UI conform to WCAG 2.2 Level AA — axe-core or Lighthouse a11y violations, keyboard operability, focus management, ARIA roles/names/live regions, contrast…

    156 GitHub stars~3.4k tokensUpdated today
    Auto-check passed
  • Ads

    ericrisco/rsc-harness

    A skill your agent uses when running or fixing paid acquisition on Google or Meta — campaign structure (Performance Max, Demand Gen, Search, Advantage+), platform-fit creative, budget/scaling rules…

    156 GitHub stars~2.2k tokensUpdated today
    Auto-check passed
  • Agent Eval

    ericrisco/rsc-harness

    A skill your agent uses when measuring whether an LLM or agent system actually got better and gating merges on it: golden sets, fixing an inflated LLM-as-judge, scoring RAG (faithfulness, contextual…

    156 GitHub stars~3.2k tokensUpdated today
    Auto-check passed
  • AI Media

    ericrisco/rsc-harness

    A skill your agent uses when a creative goal must become a finished media file: pick and order generative-media models per modality — AI voiceover, image-to-video clips, score — then glue them with…

    156 GitHub stars~3.3k tokensUpdated today
    Auto-check passed
  • Analytics

    ericrisco/rsc-harness

    A skill your agent uses when instrumenting product or web analytics — GA4/PostHog SDK wiring, event taxonomy, funnels, double-counted events, consent gating, PII scrubbing.

    156 GitHub stars~2.8k tokensUpdated today
    Auto-check passed

Categories

Questions about Prisma Orm

What does Prisma Orm do?

A skill your agent uses when modeling data or writing type-safe queries with Prisma ORM in TypeScript — schema.prisma, prisma.config.ts, the generated Prisma Client, and Prisma Migrate, including…. Prisma Orm is an agent skill from ericrisco/rsc-harness.ts, the generated Prisma Client, and Prisma Migrate, including the v6 to v7 upgrade.

When should I use Prisma Orm?

Prisma Orm fits situations like: writing type-safe queries with Prisma ORM in TypeScript — schema.prisma; prisma.config.ts; the generated Prisma Client; including the v6 to v7 upgrade.

How do I install Prisma Orm in Claude Code?

Run `npx skills add ericrisco/rsc-harness --skill prisma-orm -a claude-code`. Or copy the skill folder (skills/prisma-orm in ericrisco/rsc-harness) into .claude/skills/prisma-orm in your project. Claude Code loads it when a task matches its description.

How do I install Prisma Orm in Codex?

Run `npx skills add ericrisco/rsc-harness --skill prisma-orm -a codex`. Or copy the skill folder (skills/prisma-orm in ericrisco/rsc-harness) into .agents/skills/prisma-orm in your project. Codex loads it when a task matches its description.

Can I use Prisma Orm in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add ericrisco/rsc-harness --skill prisma-orm -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/prisma-orm, .gemini/skills/prisma-orm, .github/skills/prisma-orm and .opencode/skills/prisma-orm in your project.

What does Prisma Orm need to run?

Going by SKILL.md and its folder, Prisma Orm needs a shell for the scripts in its folder and the command-line tools its instructions call (npm). Our summary lists: Node.js; A Bash shell.

Does Prisma Orm access the network?

SKILL.md names 1 domain. As links in the text: prisma.io. This is read from the text; nothing was executed.

Is Prisma Orm safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Prisma Orm use?

Prisma Orm is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Prisma Orm use?

About 3k tokens (SKILL.md is roughly 12k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 3.5k tokens, read only when the agent opens those files.

What are the alternatives to Prisma Orm?

Skills that share tags, products or a category with Prisma Orm: Drizzle Orm (growupanand/ConvoForm, 101 stars), Drizzle Orm Expert (davila7/claude-code-templates, 32k stars), Prisma 8 Contract-First ORM (prisma/orm, 48k stars) and Daoyou Data Layer (ChurchTao/Daoyou, 119 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Prisma Orm?

ericrisco (a GitHub user) maintains it in ericrisco/rsc-harness, which has 156 GitHub stars. The repository holds 229 skills in this directory. The repository was last updated on October 6, 2026.

Source: ericrisco/rsc-harness on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.