mcpbeat Sign in

Nestjs Drizzle Crud Generator Agent Skill

Generates complete CRUD modules for NestJS applications with Drizzle ORM. Use when building server-side features in NestJS that require database operations, including creating new entities with full CRUD endpoints, services with Drizzle queries, Zod-validated DTOs, and unit tests. Triggered by requests like "generate a user module", "create a product CRUD", "add a new entity with endpoints", or when setting up database-backed features in NestJS.

8k tokens
context cost
the whole folder, loaded on every use
9
files
ships runnable scripts
0
copies elsewhere
how many repositories repackaged it
316
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/giuseppe-trisciuoglio/developer-kit --skill nestjs-drizzle-crud-generator

The instruction itself

23 sections, as written by the author

NestJS Drizzle CRUD Generator

Overview

Automatically generates complete CRUD modules for NestJS applications using Drizzle ORM. Creates all necessary files following the zaccheroni-monorepo patterns: feature modules, controllers, services, Zod-validated DTOs, Drizzle schemas, and Jest unit tests.

When to Use

  • Creating new entity modules with full CRUD endpoints
  • Building database-backed features in NestJS
  • Generating type-safe DTOs with Zod validation
  • Adding services with Drizzle ORM queries
  • Creating unit tests with mocked database

Instructions

Step 1: Define Entity Fields

Gather entity definition:

  • Entity name (e.g., user, product, order)
  • List of fields with types (see references/field-types.md for supported types)
  • Required fields vs optional fields with defaults

Step 2: Run the Generator

python scripts/generate_crud.py --feature <name> --fields '<json-array>' --output <path>

Step 3: Verify Generated Files

Check that all expected files were created:

ls -la libs/server/<feature-name>/src/lib/

Expected structure:

controllers/
services/
dto/
schema/
<feature>-feature.module.ts

Step 4: Run TypeScript Compilation

cd libs/server && npx tsc --noEmit

Step 5: Execute Unit Tests

cd libs/server && npm test -- --testPathPattern=<feature-name>

Examples

Generate a User module

python scripts/generate_crud.py \
  --feature user \
  --fields '[{"name": "name", "type": "string", "required": true}, {"name": "email", "type": "email", "required": true}, {"name": "password", "type": "string", "required": true}]' \
  --output ./libs/server

Generate a Product module

python scripts/generate_crud.py \
  --feature product \
  --fields '[{"name": "title", "type": "string", "required": true}, {"name": "price", "type": "number", "required": true}, {"name": "description", "type": "text", "required": false}, {"name": "inStock", "type": "boolean", "required": false, "default": true}]' \
  --output ./libs/server

Generated Structure

libs/server/{feature-name}/
├── src/
│   ├── index.ts
│   └── lib/
│       ├── {feature}-feature.module.ts
│       ├── controllers/
│       │   ├── index.ts
│       │   └── {feature}.controller.ts
│       ├── services/
│       │   ├── index.ts
│       │   ├── {feature}.service.ts
│       │   └── {feature}.service.spec.ts
│       ├── dto/
│       │   ├── index.ts
│       │   └── {feature}.dto.ts
│       └── schema/
│           └── {feature}.table.ts

Features

Module

  • Uses forRootAsync pattern for lazy configuration
  • Exports generated service for other modules
  • Imports DatabaseModule for feature tables

Controller

  • Full CRUD endpoints: POST, GET, PATCH, DELETE
  • Query parameter validation for pagination
  • Zod validation pipe integration

Service

  • Drizzle ORM query methods
  • Soft delete support (via deletedAt column)
  • Pagination with limit/offset
  • Filtering support
  • Type-safe return types

DTOs

  • Zod schemas for Create and Update
  • Query parameter schemas for filtering
  • NestJS DTO integration

Tests

  • Jest test suite
  • Mocked Drizzle database
  • Test cases for all CRUD operations

Manual Integration

After generation, integrate into your app module:

// app.module.ts
import { {{FeatureName}}FeatureModule } from '@your-org/server-{{feature}}';

@Module({
  imports: [
    {{FeatureName}}FeatureModule.forRootAsync({
      useFactory: () => ({
        defaultPageSize: 10,
        maxPageSize: 100,
      }),
    }),
  ],
})
export class AppModule {}

Dependencies

Required packages:

  • @nestjs/common
  • @nestjs/core
  • drizzle-orm
  • drizzle-zod
  • zod
  • nestjs-zod

Best Practices

  • Verify before commit: Always run tsc --noEmit and tests before committing generated code
  • Customize services: Add business logic to generated services after validation
  • Database migrations: Create migrations separately for generated Drizzle schemas
  • Use generated types: Reference generated types in your application code
  • Review DTOs: Adjust Zod validation rules based on your API requirements

Constraints and Warnings

  • Soft delete only: Delete operations use soft delete (deletedAt timestamp). Hard deletes require manual modification
  • No authentication: Generated code does not include auth guards - add them based on your security requirements
  • Basic CRUD only: Complex queries, transactions, or business logic must be implemented manually
  • JSON escaping: Use single quotes around the JSON array when passing fields on command line

Other skills for the same job

different authors, same section of the catalogue
Hypogenic Hypothesis Generation
by BioTender-max
×1

LLM-driven hypothesis generation/testing on tabular data. Three methods: HypoGeniC (data-driven), HypoRefine (literature+data), Union. Iterative refinement, Redis caching, multi-hypothesis inference. Manual: hypothesis-generation; ideation: scientific-brainstorming.

4k tokens
Sqlmap Database Pentesting
by ComeOnOliver
×1

This skill should be used when the user asks to \"automate SQL injection testing,\" \"enumerate database structure,\" \"extract database credentials using sqlmap,\" \"dump tables and columns...

6k tokens
Performance Optimization
by addyosmani

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.

4k tokens
Bisect
by ClickHouse
vendor

Bisect a ClickHouse regression using pre-built master binaries from CI. Use when the user wants to find the commit that introduced a bug.

1k tokens
Validate Data
by anthropics
vendor

QA an analysis before sharing -- methodology, accuracy, and bias checks. Use when reviewing an analysis before a stakeholder presentation, spot-checking calculations and aggregation logic, verifying a SQL query's results look right, or assessing whether conclusions are actually supported by the data.

4k tokens
Errors API E2e
by triggerdotdev
vendor

End-to-end smoke test for the public Errors HTTP API (error groups). Seeds failed runs into ClickHouse so the error materialized views populate, then drives the real endpoints against the running webapp — list (with filters + pagination), retrieve, resolve/ignore/unresolve, the `filter[error]` runs filter, user attribution via the `trigger.dev mint-token` -> JWT exchange, and the 401/403/404 negatives. Use for "smoke test the errors API", "test the errors API e2e", "prove the errors endpoints work", or to re-verify after changes.

3k tokens
Strix•SQL 注入
by asdfgh1445

Strix SQL 注入测试手册,覆盖 union、blind、error-based 与 ORM 绕过技巧;触发名:strix-sql-injection

2k tokens
Analyzing Experiment Query Performance
by PostHog
vendor

> Pull and interpret production experiment query-performance data from the staff-only slowest experiment queries, precompute read/build health, and preaggregation cache footprint. and response field semantics (exception codes, exposure paths, precompute skip reasons, job states). Use when investigating slow or failing experiment queries, precompute regressions, 307/159/241 errors, preaggregation table growth, or when asked how experiment query performance or the precompute rollout is doing in production.

3k tokens

How to use it

Copy the folder

Take giuseppe-trisciuoglio/nestjs-drizzle-crud-generator from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.

Install what it needs

The instructions reference npx. Without those the skill loads but fails at the first command.