hm-nodejs-database

Designs Prisma schemas, migrations, and query patterns for Node.js PostgreSQL applications.

Updated Apr 26, 2026
One-click install
npx skills add https://github.com/ArkhiMuttaqina/publisher-for-campuss --skill hm-nodejs-database-arkhimuttaqina
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: hm-nodejs-database
Source: https://github.com/ArkhiMuttaqina/publisher-for-campuss/tree/main/skills/hm-nodejs-database
Command: npx skills add https://github.com/ArkhiMuttaqina/publisher-for-campuss --skill hm-nodejs-database-arkhimuttaqina

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? It prevents common database mistakes in Node.js backends—such as N+1 queries, missing indexes, unsafe production migrations, and inconsistent naming—by enforcing Prisma best practices across schema design, migrations, and query code. ## Core Features & Use Cases - Schema & Migration Conventions: Standardized Prisma schema patterns with @map/@@map naming, audit fields, and a safe migrate dev vs migrate deploy workflow. - Query Optimization: Guidance on findUnique vs findFirst, select vs include, N+1 avoidance, and index strategy for PostgreSQL. - Soft Delete & Pagination: Ready-to-use middleware/Client Extensions for soft delete plus offset and cursor pagination implementations. - Use Case: When adding a new Order model to a NestJS/Node.js API, use this Skill to define the schema with proper indexes, generate a migration, and write repository-layer queries that eager-load relations without N+1 issues. ## Quick Start Ask the AI to design a Prisma schema with soft delete and cursor-based pagination for a new orders table in your Node.js project.

Frequently Asked Questions about hm-nodejs-database

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I avoid N+1 queries in Prisma?▼

Avoid calling Prisma inside loops. Use `include` or nested `select` to eager-load relations in one query, or batch fetch related records with `where: { id: { in: ids } }` and join them in memory with a Map.

How do I implement soft delete in Prisma?▼

Add a nullable `deletedAt` field to the model, then use Prisma middleware or Client Extensions to convert `delete` calls into updates setting `deletedAt`, and automatically filter out soft-deleted rows in `findMany` and `findFirst`.

What is the difference between prisma migrate dev and migrate deploy?▼

`migrate dev` is for development: it creates migration files, applies them, and regenerates the client interactively. `migrate deploy` is non-interactive and only applies pending migrations, making it safe for CI/CD and production.

Should I use offset or cursor pagination in Prisma?▼

Use offset pagination for admin panels and numbered pages where jumping to a page is needed. Use cursor pagination for infinite scroll and large tables, since offset performance degrades as it scans skipped rows on big datasets.

When should I use findUnique instead of findFirst in Prisma?▼

Use `findUnique` when filtering by a primary key or a field with a `@unique` constraint, since Prisma optimizes these lookups. Use `findFirst` only for filters on non-unique fields, such as combining a business key with `deletedAt: null`.

Why is db push dangerous in production with Prisma?▼

`db push` syncs the schema directly without creating migration files, so changes are untracked and can cause irreversible data loss. Production deployments should always use `migrate deploy` with versioned migration files.