prisma-database

prisma-database is a skill for Claude Code, Codex from monkilabs/opencastle. It costs 35 tokens per session (528 once invoked), scanned A, original, MIT.

A database development guide for Prisma, a tool that lets applications define database tables and read or change data using generated code. It covers schemas, migrations, queries, and the Prisma Client.

In plain words
What is it for?
Use it to design database schemas, create and review migrations, generate the database client, and write queries with relations and indexes.
Why use it?
It helps prevent lost data, broken migration history, stale generated code, and inefficient queries. It distinguishes safe production migration steps from development-only commands.

Skill for Claude CodeCodex

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

Good fit Use it to design database schemas, create and review migrations, generate the database client, and write queries with relations and indexes.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/monkilabs/opencastle/prisma-database
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add monkilabs/opencastle --skill prisma-database
Clone the repo
git clone --depth 1 https://github.com/monkilabs/opencastle

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-database

README.md
[![agentmods](https://agentmods.dev/badge/skills/monkilabs/opencastle/prisma-database/github.svg)](https://agentmods.dev/skills/monkilabs/opencastle/prisma-database)
Your own site
<a href="https://agentmods.dev/skills/monkilabs/opencastle/prisma-database"><img src="https://agentmods.dev/badge/skills/monkilabs/opencastle/prisma-database/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-database

Your own site · 80×15
<a href="https://agentmods.dev/skills/monkilabs/opencastle/prisma-database"><img src="https://agentmods.dev/badge/skills/monkilabs/opencastle/prisma-database.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 35 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 528 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 original No closer match found 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.00035 $0.00528
Opus 5.5 $0.00014 $0.00211
Sonnet 5.5 $0.00007 $0.00106
Haiku 4.5 $0.00003 $0.00053

Measured 19d ago against content hash 7abc711f9540, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

prisma-database 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 19d 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.

src/orchestrator/plugins/prisma/skills/prisma-database/SKILL.md · 38 lines

How it starts

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

Prisma Database

Project schema and connection details: .opencastle/stack/database-config.md. Docs: https://www.prisma.io/docs

Migration rules

  • npx prisma migrate dev in development only — never in production; it can reset data. CI/production uses npx prisma migrate deploy.
  • Inspect prisma/migrations/<timestamp>/migration.sql before applying. Destructive operations (drops, column rewrites) need an explicit backfill step added to the migration.
  • Never edit an already-applied migration file — the checksum is recorded and will fail. Write a corrective migration instead.
  • npx prisma generate after every schema change; a stale client silently mismatches the DB. npx prisma db push skips migration history entirely — prototyping only.

Schema gotchas

  • Use cuid() / uuid() for IDs, not serial increments, in anything distributed.
  • Renaming a field without matching @map/@@map produces a column drop plus add, not a rename. Check both when renaming.
  • Add @@index explicitly on frequently queried columns — the schema does not imply them.
  • Write @relation explicitly, including onDelete (e.g. onDelete: Cascade); leaving it implicit means the delete behavior is whatever the connector defaults to.
  • Include createdAt @default(now()) and updatedAt @updatedAt for auditability.

Client and queries

Hot reload in dev creates a new PrismaClient per reload and exhausts the connection pool. Use the global singleton:

const globalForPrisma = globalThis as unknown as { prisma?: PrismaClient };
export const prisma = globalForPrisma.prisma ?? new PrismaClient();
if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma;

Use select for narrow reads, include for relations, prisma.$transaction for multi-step writes. Catch error code P2002 for unique-constraint violations and handle it rather than letting it surface as a 500.

Other commands: prisma studio (visual editor), prisma db pull (introspect), prisma db seed, prisma validate, prisma format.

Read the full file on GitHub · 38 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. 19d ago Changed · -2 lines · -2 tokens per session 7abc711f9540
  2. 20d ago First seen · 40 lines · 37 tokens per session scan A 37bf342fec20

Subscribe to this mod's changes

prisma-database is a skill published in the GitHub repository monkilabs/opencastle (80 stars, last pushed 3d ago), licensed MIT. It adds 35 tokens to every session and 528 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-04.

Related

Other skills, from other repositories

transactional-patterns

Use when defining or debugging Spring Boot 3 database transaction boundaries, rollback, propagation, optimistic-lock retries, or commit-bound events. For duplicate HTTP commands use idempotency-patterns; for reactive transactions use webflux-reactive-patterns.

rrezartprebreza/spring-boot-skills · 53 tokens

flyway-migrations

Use when creating database migrations, schema changes, seed data, or any SQL that modifies database structure. Covers Flyway naming conventions, versioning, and safe migration patterns.

rrezartprebreza/spring-boot-skills · 39 tokens

spring-data-redis

Use when implementing caching, session storage, rate limiting, or any Redis integration. Covers cache-aside pattern, key naming, TTL strategy, and serialization config.

rrezartprebreza/spring-boot-skills · 37 tokens

spring-data-jpa

Use when generating JPA entities, repositories, queries, or anything touching the persistence layer. Covers entity conventions, N+1 prevention, projections, and query patterns.

rrezartprebreza/spring-boot-skills · 38 tokens

idempotency-patterns

Use when making retried HTTP commands or message processing safe against duplicate effects, including database-backed request keys, payload conflicts and concurrent retries. Do not apply caching as a substitute for business idempotency.

rrezartprebreza/spring-boot-skills · 46 tokens

multi-tenancy

Use when implementing tenant resolution, database or schema isolation, tenant-aware JPA, reactive tenant context, migrations, caching, jobs, or authorization in Spring Boot 3.

rrezartprebreza/spring-boot-skills · 38 tokens