prisma-patterns

prisma-patterns is a skill for Claude Code, Codex from ronmkr/PromptBook. It costs 61 tokens per session (3,324 once invoked), scanned A, a copy of prisma-patterns, Apache-2.0.

A guide to using Prisma, a TypeScript database toolkit, for schemas, queries, transactions, pagination, and migrations. It also documents behaviours that can surprise developers during bulk updates and serverless deployment.

In plain words
What is it for?
Use it when designing Prisma models, writing queries or transactions, changing schemas, handling bulk operations, implementing tenant filtering, or deploying TypeScript backends without permanent servers.
Why use it?
It helps avoid lost records, incorrect assumptions about bulk-operation results, migration resets, transaction timeouts, and too many database connections.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is --from-migrations ./prisma/migrations \.

Good fit Use it when designing Prisma models, writing queries or transactions, changing schemas, handling bulk operations, implementing tenant filtering, or deploying TypeScript backends without permanent servers.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/ronmkr/PromptBook
agentmods
npx agentmods add skills/ronmkr/promptbook/prisma-patterns

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for prisma-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/ronmkr/promptbook/prisma-patterns/github.svg)](https://agentmods.dev/skills/ronmkr/promptbook/prisma-patterns)
Your own site
<a href="https://agentmods.dev/skills/ronmkr/promptbook/prisma-patterns"><img src="https://agentmods.dev/badge/skills/ronmkr/promptbook/prisma-patterns/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for prisma-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/ronmkr/promptbook/prisma-patterns"><img src="https://agentmods.dev/badge/skills/ronmkr/promptbook/prisma-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 61 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,324 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 86% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00061 $0.03324
Opus 5 $0.00030 $0.01662
Sonnet 5 $0.00012 $0.00665
Haiku 4.5 $0.00006 $0.00332

Measured 6d ago against content hash 883820fb1900, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

prisma-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

86% identical to prisma-patterns — 68 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

skills/patterns/prisma-patterns/SKILL.md · 372 lines

How it starts

The opening of the file, as written. The whole thing — 372 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Prisma Patterns

Production patterns and non-obvious traps for Prisma ORM in TypeScript backends. Tested against Prisma 5.x and 6.x. Some behaviors differ from Prisma 4.

Check the Prisma version before applying version-specific patterns:

npx prisma --version

Prisma 5 introduced relationJoins, which can load relations via JOIN rather than separate queries depending on query strategy and configuration. The omit field modifier and prisma.$extends Client Extensions API were also added. Note: relationJoins can cause row explosion on large 1:N relations or deep nested include — benchmark both approaches when relations may return many rows per parent.

When to Activate

  • Designing or modifying Prisma schema models and relations
  • Writing queries, transactions, or pagination logic
  • Using updateMany, deleteMany, or any bulk operation
  • Running or planning database migrations
  • Deploying to serverless environments (Vercel, Lambda, Cloudflare Workers)
  • Implementing soft delete or multi-tenant row filtering

Core Concepts

ID Strategy

Strategy Use When Avoid When
@default(cuid()) Default choice — URL-safe, sortable, no collisions Sequential IDs needed for external systems
@default(uuid()) Interoperability with non-Prisma systems required High-write tables (random UUIDs fragment B-tree indexes)
@default(autoincrement()) Internal join tables, audit logs Public-facing IDs (exposes record count)

Schema Defaults

model User {
  id        String    @id @default(cuid())
  email     String    @unique  // @unique already creates an index — no @@index needed
  name      String
  role      Role      @default(USER)
  posts     Post[]
  createdAt DateTime  @default(now())
  updatedAt DateTime  @updatedAt
  deletedAt DateTime?

  @@index([createdAt])
  @@index([deletedAt, createdAt]) // composite for soft-delete + sort queries
}
  • Add @@index on every foreign key and column used in WHERE or ORDER BY.
  • Declare deletedAt DateTime? upfront when soft delete is a foreseeable requirement — adding it later requires a migration on a live table.
  • updatedAt @updatedAt is set automatically by Prisma on update and upsert only (see Anti-Patterns for bulk update trap).

Read the full file on GitHub · 372 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 372 lines · 61 tokens per session scan A 883820fb1900

Subscribe to this mod's changes

prisma-patterns is a skill published in the GitHub repository ronmkr/PromptBook (2 stars, last pushed 3mo ago), licensed Apache-2.0. It adds 61 tokens to every session and 3,324 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. It is 86% identical to prisma-patterns, differing in 68 lines, and is treated as a copy.

Related

Other skills, from other repositories

microsoft-typescript

TypeScript is a language for application scale JavaScript development. ALWAYS use when editing or working with .ts, .tsx, .mts, .cts files or code importing "typescript". Consult for debugging, best practices, or modifying typescript, TypeScript.

skilld-dev/skilld · 57 tokens

bombshell-dev-clack

ALWAYS use when writing code importing "@clack/prompts". Consult for debugging, best practices, or modifying @clack/prompts, clack/prompts, clack prompts, clack.

skilld-dev/skilld · 46 tokens

neo4j-driver-javascript-skill

Neo4j JavaScript/TypeScript Driver v6 — driver lifecycle, executeQuery, managed transactions (executeRead/executeWrite), session.run, Integer handling, JSON serialization, record access, async/await patterns, TypeScript types, error handling, and connection setup for Node.js and browser. Use when writing JS/TS code…

neo4j-contrib/neo4j-skills · 157 tokens

using-prisma

Prisma 5+ ORM with schema-first design, type-safe client, migrations, and database integrations (Supabase, PlanetScale, Neon). Use for TypeScript/JavaScript database access.

FortiumPartners/ensemble · 43 tokens

ax-go-gen

Use when writing Go code with github.com/ax-llm/ax/packages/go for AxGen programs, forward calls, indexed multi-sampling, result pickers, streaming, tools, assertions, traces, usage, and output parsing.

ax-llm/ax · 54 tokens

stripe-projects

Use when the user wants to provision infrastructure or third-party services using Stripe Projects. Triggers: "I need a database", "set up auth", "add caching", "give me a Postgres", "provision Redis", "I need hosting", "add a vector DB", "get me an API key for X", "get credentials for X", "sign up for a service", "set…

stripe/ai · 213 tokens