gen-module

gen-module is a command for Claude Code from hmake98/nestjs-starter. It costs 0 tokens per session (836 once invoked), scanned A, original, MIT.

A command that generates a complete NestJS feature module from a name and the patterns already used in the codebase. NestJS is a framework for building server-side TypeScript applications.

In plain words
What is it for?
Use it to create interfaces, database repositories, data-transfer objects, services, controllers, and module wiring for a new NestJS feature.
Why use it?
It removes the repetitive work of creating related files and helps new features follow the project's existing structure.

Command for Claude Code

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 commands/hmake98/nestjs-starter/gen-module
Clone the repo
git clone --depth 1 https://github.com/hmake98/nestjs-starter

Made for: Claude Code.

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 gen-module

README.md
[![agentmods](https://agentmods.dev/badge/commands/hmake98/nestjs-starter/gen-module.svg)](https://agentmods.dev/commands/hmake98/nestjs-starter/gen-module)
Your own site
<a href="https://agentmods.dev/commands/hmake98/nestjs-starter/gen-module"><img src="https://agentmods.dev/badge/commands/hmake98/nestjs-starter/gen-module.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 836 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.00000 $0.00836
Opus 5 $0.00000 $0.00418
Sonnet 5 $0.00000 $0.00167
Haiku 4.5 $0.00000 $0.00084

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

Security

Grade A, and why

gen-module 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 3d 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.

.claude/commands/gen-module.md · 73 lines

How it starts

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

Generate a complete NestJS feature module for: $ARGUMENTS


Step 1 — Read codebase patterns

Study these files to match existing conventions exactly:

  • src/modules/user/user.module.ts
  • src/modules/user/services/user.service.ts
  • src/modules/user/controllers/user.public.controller.ts
  • src/modules/user/controllers/user.admin.controller.ts
  • src/modules/user/dtos/user.dto.ts
  • src/modules/user/dtos/user.update.dto.ts
  • src/common/database/repositories/user.repository.ts
  • src/common/database/interfaces/user.interface.ts

Step 2 — Generate all 8 files

Use the reference files (Step 1) for structure, decorators, and patterns.

1. src/common/database/interfaces/<name>.interface.ts

  • export type <Name>Entity = <Name> from @prisma/client
  • Create<Name>Input and Update<Name>Input interfaces

2. src/common/database/repositories/<name>.repository.ts

  • @Injectable() injecting DatabaseService as db
  • Standard methods: findById, existsById (via findUnique({ select: { id: true } })), create, update, softDelete, hardDeleteById
  • Return types use <Name>Entity

3. src/modules/<name>/dtos/<name>.dto.ts (response DTOs)

  • <Name>ResponseDto with @Expose() + @ApiProperty({ example: faker.* }) on every included field
  • @ApiHideProperty() + @Exclude() on sensitive fields
  • Named variants extending base: <Name>GetResponseDto, <Name>CreateResponseDto, <Name>UpdateResponseDto

4. src/modules/<name>/dtos/<name>.create.dto.ts + <name>.update.dto.ts

  • class-validator decorators on every field per the spec's DTO Fields section
  • Update DTO: all fields @IsOptional() first

5. src/modules/<name>/services/<name>.service.ts

  • Inject repository (not DatabaseService)
  • private readonly logger = new Logger(<Name>Service.name)
  • private async assertExists(id) using existsById
  • Business rules from spec implemented here
  • All errors: throw new HttpException('<name>.error.key', HttpStatus.STATUS)

Read the full file on GitHub · 73 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. 3d ago First seen · 73 lines · 0 tokens per session scan A 7cc34f1f8d0d

Subscribe to this mod's changes

gen-module is a command published in the GitHub repository hmake98/nestjs-starter (61 stars, last pushed 3mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 836 tokens. 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.