database-orm-expert

A guide to designing databases and using TypeScript tools such as Prisma, Drizzle ORM, and TypeORM to work with them.

In plain words
What is it for?
Use it to create or migrate schemas, choose an ORM, write joins and paginated queries, optimize PostgreSQL, MySQL, SQLite, or PlanetScale databases, and set up migrations.
Why use it?
It helps avoid poorly designed schemas, unsafe queries, difficult migrations, slow database operations, and repeated queries caused by N+1 problems.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/roedyrustam/vibes-plug/database-orm-expert
Any agent
npx skills add roedyrustam/vibes-plug --skill database-orm-expert
Clone the repo
git clone --depth 1 https://github.com/roedyrustam/vibes-plug

Made for: Claude Code, Codex.

Per session 82 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,728 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00082 $0.02728
Opus 5 $0.00041 $0.01364
Sonnet 5 $0.00016 $0.00546
Haiku 4.5 $0.00008 $0.00273

Measured 2d ago against content hash 07c6d4ed79e8, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

database-orm-expert 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 2d 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.

skills/database-orm-expert/SKILL.md · 305 lines

How it starts

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

Database ORM Expert (Prisma 6 + Drizzle ORM Edition)

English | Bahasa Indonesia


English

Description

Design schemas, select ORMs, execute migrations, optimize queries, and implement type-safe SQL patterns. Prioritize Prisma 6 and Drizzle ORM. Implement connection pooling for production workloads.

Trigger Conditions

  • Designing or migrating a database schema.
  • Choosing between Prisma, Drizzle ORM, or TypeORM.
  • Writing complex queries with joins, aggregations, or pagination.
  • Optimizing slow queries or N+1 problems.
  • Setting up database migrations in CI/CD pipelines.
  • Implementing Row Level Security (RLS) patterns.
  • Working with PostgreSQL, MySQL, SQLite, or PlanetScale.

Orchestration & Integration

  • js-backend-expert: For Node/Bun/Deno backend implementations integrating these ORMs.
  • edge-serverless-db-expert: For edge/serverless connections (e.g., Supabase, Neon, Turso).
  • database-migration-versioning-expert: For advanced migration strategies and CI/CD pipelines.

ORM Selection Guide

Criteria Prisma 6 Drizzle ORM TypeORM
Type Safety Schema-generated types SQL-like, inferred types Decorator-based
Bundle Size Heavy (binary client) Lightweight (<35KB) Medium
Query Style Fluent ORM API SQL-first, composable ActiveRecord / QueryBuilder
Edge Runtime Prisma Accelerate needed Native edge support No
Migrations prisma migrate dev drizzle-kit push/migrate synchronize (dev only)
Best For Rapid prototyping, teams Production edge, monorepos Legacy NestJS projects

Recommendation: Use Drizzle ORM for edge-compatible apps and performance-critical systems. Use Prisma 6 for teams that prefer a schema-first DX and rich Studio tooling.


Prisma 6 — Best Practices

Schema Design
// schema.prisma
generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["relationJoins", "nativeDistinct"]
}

datasource db {
  provider  = "postgresql"
  url       = env("DATABASE_URL")
  directUrl = env("DIRECT_URL") // for Supabase Pooler
}

model User {
  id        String    @id @default(cuid())
  email     String    @unique
  name      String?
  role      Role      @default(USER)
  posts     Post[]
  createdAt DateTime  @default(now())
  updatedAt DateTime  @updatedAt

  @@index([email])
  @@map("users")
}

model Post {
  id          String   @id @default(cuid())
  title       String
  content     String?
  published   Boolean  @default(false)
  authorId    String
  author      User     @relation(fields: [authorId], references: [id], onDelete: Cascade)
  publishedAt DateTime?

  @@index([authorId, published])
  @@map("posts")
}

enum Role {
  USER
  ADMIN
  SUPER_ADMIN
}

Read the full file on GitHub · 305 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. 2d ago First seen · 305 lines · 82 tokens per session scan A 07c6d4ed79e8

Subscribe to this mod's changes

database-orm-expert is a skill published in the GitHub repository roedyrustam/vibes-plug (48 stars, last pushed 15d ago), licensed MIT. It adds 82 tokens to every session and 2,728 once invoked, about $0.0004 per session on Opus 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-08-30.

Related

Other skills, from other repositories

performance-optimization

Optimizes application performance across frontend, backend, queries, and databases. Use when performance requirements exist, when you suspect performance regressions, when Core Web Vitals or load times need improvement, when N+1 query patterns need fixing, or when profiling reveals bottlenecks.

addyosmani/agent-skills · 59 tokens

doubt-driven-development

Subjects every non-trivial decision to a fresh-context adversarial review before it stands. Use when correctness matters more than speed, when working in unfamiliar code, when stakes are high (production, security-sensitive logic, irreversible operations), or any time a confident output would be cheaper to verify now…

addyosmani/agent-skills · 67 tokens

test-driven-development

Drives development with tests. Use when implementing any logic, fixing any bug, or changing any behavior. Use when you need to prove that code works, when a bug report arrives, or when you're about to modify existing functionality.

addyosmani/agent-skills · 50 tokens

ci-cd-and-automation

Automates CI/CD pipeline setup. Use when setting up or modifying build and deployment pipelines. Use when you need to automate quality gates, configure test runners in CI, or establish deployment strategies.

addyosmani/agent-skills · 45 tokens

context-engineering

Optimizes agent context setup. Use when starting a new session, when agent output quality degrades, when switching between tasks, or when you need to configure rules files and context for a project.

addyosmani/agent-skills · 43 tokens

documentation-and-adrs

Records decisions and documentation. Use when making architectural decisions, changing public APIs, shipping features, or when you need to record context that future engineers and agents will need to understand the codebase.

addyosmani/agent-skills · 43 tokens