gen-endpoint

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

A command for adding an API endpoint to an existing controller in a TypeScript web application. An API endpoint is a defined URL and HTTP action that other software can call.

In plain words
What is it for?
Use it when adding GET, POST, PUT, PATCH, or DELETE routes, including their request and response data types and access rules.
Why use it?
It provides a checklist for fitting the new endpoint into the project's existing patterns for authentication, roles, request data, responses, documentation, and translations.

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-endpoint
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-endpoint

README.md
[![agentmods](https://agentmods.dev/badge/commands/hmake98/nestjs-starter/gen-endpoint.svg)](https://agentmods.dev/commands/hmake98/nestjs-starter/gen-endpoint)
Your own site
<a href="https://agentmods.dev/commands/hmake98/nestjs-starter/gen-endpoint"><img src="https://agentmods.dev/badge/commands/hmake98/nestjs-starter/gen-endpoint.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 501 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.00501
Opus 5 $0.00000 $0.00251
Sonnet 5 $0.00000 $0.00100
Haiku 4.5 $0.00000 $0.00050

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

Security

Grade A, and why

gen-endpoint 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 5d 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-endpoint.md · 39 lines

What it actually says

Add a new API endpoint to an existing controller: $ARGUMENTS

Read these files first:

  • src/modules/user/controllers/user.public.controller.ts — public endpoint pattern
  • src/modules/user/controllers/user.admin.controller.ts — admin endpoint pattern
  • src/common/doc/decorators/doc.api-endpoint.decorator.ts — @ApiEndpoint options
  • src/common/request/decorators/auth-user.decorator.ts — @AuthUser usage
  • src/common/request/decorators/roles.decorator.ts — @AllowedRoles usage
  • src/common/response/dtos/response.generic.dto.ts — generic response shape

Determine from the arguments:

  • Which controller file to modify
  • HTTP method (GET / POST / PUT / PATCH / DELETE)
  • Route path and params
  • Whether it needs auth (@ApiBearerAuth), role restriction (@AllowedRoles), or is public (@PublicRoute)
  • Request body DTO (create if it doesn't exist)
  • Response DTO (create if it doesn't exist, extend the base response DTO)

For every new endpoint:

  1. Controller method — add to the correct controller with:

    • @ApiEndpoint({ summary: '...', serialization: ResponseDto, messageKey: '<domain>.success.<action>' })
    • Correct HTTP decorator (@Get, @Post, @Put, @Patch, @Delete)
    • @Param, @Body, @Query decorators as needed
    • @AuthUser() user: IAuthUser if it needs the authenticated user
  2. Service method — add to the corresponding service:

    • Throws HttpException with i18n key and HttpStatus for all error cases
    • Returns the response DTO type
    • Uses assertExists private helper for existence pre-checks
  3. DTOs — if new ones are needed:

    • Input DTOs: class-validator decorators + @ApiProperty
    • Response DTOs: extend base response DTO, @Expose() on each field
  4. i18n message key — remind me to add the messageKey value to the translations file

After adding the endpoint also tell me: does the corresponding service method need a new repository method? If so, describe what it should look like following src/common/database/repositories/user.repository.ts.

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. 5d ago First seen · 39 lines · 0 tokens per session scan A bd588f3730f2

Subscribe to this mod's changes

gen-endpoint 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 501 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.