nestjs-database

nestjs-database is a skill for Claude Code from dkmqflx/nestjs-best-practices-plugin. It costs 66 tokens per session (542 once invoked), scanned A, original, MIT.

A reference for connecting databases to NestJS applications using TypeORM, Prisma, or Mongoose. It covers database setup, repositories, schema changes, transactions, relationships, and query design.

In plain words
What is it for?
Use it when adding database access, migrations, transactions, relationship loading, pagination, indexes, or data returned from NestJS controllers.
Why use it?
It helps avoid unsafe schema changes, slow or wasteful queries, hardcoded credentials, and database code scattered through controllers.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the nestjs-best-practices plugin — 12 skills shipped together

Good fit Use it when adding database access, migrations, transactions, relationship loading, pagination, indexes, or data returned from NestJS controllers.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/dkmqflx/nestjs-best-practices-plugin/nestjs-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 dkmqflx/nestjs-best-practices-plugin --skill nestjs-database
Clone the repo
git clone --depth 1 https://github.com/dkmqflx/nestjs-best-practices-plugin

Made for: Claude Code.

Or install nestjs-best-practices, the plugin that ships this one along with the rest of its 12 skills.

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/dkmqflx/nestjs-best-practices-plugin/nestjs-database.svg)](https://agentmods.dev/skills/dkmqflx/nestjs-best-practices-plugin/nestjs-database)
Your own site
<a href="https://agentmods.dev/skills/dkmqflx/nestjs-best-practices-plugin/nestjs-database"><img src="https://agentmods.dev/badge/skills/dkmqflx/nestjs-best-practices-plugin/nestjs-database.svg" alt="Measured on agentmods" height="20"></a>
Per session 66 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 542 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.00066 $0.00542
Opus 5 $0.00033 $0.00271
Sonnet 5 $0.00013 $0.00108
Haiku 4.5 $0.00007 $0.00054

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

Security

Grade A, and why

nestjs-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 8d 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.

plugins/nestjs-best-practices/skills/nestjs-database/SKILL.md · 39 lines

How it starts

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

NestJS Database & ORM

Best-practices reference for integrating a database into NestJS through TypeORM, Prisma, or Mongoose. Covers async module configuration, repository injection, schema lifecycle (migrations vs synchronize), transactions, relation loading, projection, DTO mapping, and indexing/pagination. Examples favor TypeORM with Prisma notes where the idiom differs.

When to Apply

  • Wiring TypeOrmModule/MongooseModule/PrismaModule with ConfigService
  • Injecting repositories or model services into providers
  • Choosing between synchronize and migrations for schema changes
  • Writing multi-step writes that must be atomic (transactions)
  • Loading relations efficiently (avoiding N+1 queries)
  • Selecting only needed columns / not over-fetching
  • Returning data from controllers without leaking ORM entities
  • Indexing queried columns and paginating large result sets

Rules

  • async-module-config - configure the data layer with forRootAsync + ConfigService; never hardcode credentials
  • repository-pattern - inject repositories/services into providers; keep DB access out of controllers
  • migrations-not-synchronize - set synchronize: false in production and manage schema with migrations
  • transactions-for-multi-write - wrap multi-step writes in a transaction (QueryRunner / dataSource.transaction / prisma.$transaction)
  • avoid-n-plus-one - load relations explicitly (relations/leftJoin/include); never query inside a loop
  • select-needed-columns - project specific fields; avoid SELECT * and over-fetching
  • separate-entities-from-dtos - map ORM entities to response DTOs; don't expose persistence models directly
  • index-and-pagination - index queried columns and paginate large results with take/skip

How to Use

Read individual rule files in rules/ for the rationale plus incorrect/correct examples. Each rule is self-contained; apply the ones relevant to the change you are making. Default to TypeORM idioms; Prisma/Mongoose equivalents are noted inline where they differ.

Read the full file on GitHub · 39 lines

Files

What ships with it

8 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 8d ago First seen · 39 lines · 66 tokens per session scan A e9c885356f2c

Subscribe to this mod's changes

nestjs-database is a skill published in the GitHub repository dkmqflx/nestjs-best-practices-plugin (1 stars, last pushed 2mo ago), licensed MIT. It adds 66 tokens to every session and 542 once invoked, about $0.0003 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-31.

Related

Other skills, from other repositories

supabase-cli

This skill should be used when user asks to "use supabase CLI", "supabase init", "supabase start", "run migrations", "deploy edge functions", "manage Supabase project", or works with the supabase command-line tool for local development and project management.

fcakyon/claude-codex-settings · 60 tokens

supabase-js

This skill should be used when user asks to "use supabase-js", "query Supabase database", "supabase auth", "supabase storage", "supabase realtime", "supabase edge functions", or works with the @supabase/supabase-js JavaScript/TypeScript SDK.

fcakyon/claude-codex-settings · 64 tokens

phoenix-contexts

Phoenix context design — creating/splitting contexts, Scope (1.8+), Ecto.Multi, PubSub, routers, plugs, controllers. Use when editing contexts, routers, or designing boundaries.

oliver-kriska/claude-elixir-phoenix · 46 tokens

cloudflare-hyperdrive

Cloudflare Hyperdrive for Workers-to-database connections with pooling and caching. Use for PostgreSQL/MySQL, Drizzle/Prisma, or encountering pool errors, TLS issues, connection refused.

secondsky/claude-skills · 45 tokens

data-contract-migrations

Design and verify data contracts, schema changes, migrations, rollbacks, backfills, compatibility windows, tenant isolation, and API-to-database field mapping. Use when changing database schema, event payloads, persisted documents, analytics tables, multi-tenant data boundaries, or any user-visible data contract where…

majiayu000/spellbook · 75 tokens

neo4j-getting-started-skill

Orchestrates zero-to-running-app in 8 stages — prerequisites → context → provision → model → load → explore → query → build. Each stage reads its own reference file. Supports HITL and fully autonomous operation. Use when starting a new Neo4j project from scratch, provisioning Aura, generating synthetic data, building…

neo4j-contrib/neo4j-skills · 157 tokens