agentleFS
eusouwilsoneusouwilson/angular-nest-ai-kit/skills/generating-backend-module/SKILL.md

generating-backend-module

Skill2 starsChanged 4 months agoMITView on GitHub

Gera modulo NestJS completo - DTOs com class-validator, Service estendendo BaseService, Controller com Swagger completo, Module e testes unitarios com TDD. Use quando o usuario pede "crie um modulo backend", "novo endpoint", "novo recurso no backend" ou "generate-module".

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    DTOs: create, update, response.

    line 27

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Gerando Backend Module (NestJS)

Inicio rapido

Pedir o nome do modulo em kebab-case (ex: products, teams, reports). Gera:

apps/<backend-app>/src/<modulo>/
  dto/
    create-{module}.dto.ts
    update-{module}.dto.ts
    {module}-response.dto.ts
  {module}.service.ts
  {module}.controller.ts
  {module}.module.ts
  {module}.service.spec.ts   <- TDD: escrever ANTES do service

Ordem de geracao (obrigatoria)

  1. Interface compartilhada: verificar/criar em @org/shared se ainda nao existe.
  2. DTOs: create, update, response.
  3. Testes (spec.ts): escrever ANTES do service (TDD Red).
  4. Service: implementar ate os testes passarem (TDD Green).
  5. Controller: conectar DTOs + Swagger.
  6. Module: registrar controller + service e importar no modulo raiz.

Templates

  • DTOs: DTOS
  • Service: SERVICE
  • Controller e Module: CONTROLLER
  • Testes: TESTS

Checklist Swagger (por endpoint)

  • @ApiOperation({ summary, description })
  • @ApiResponse({ status: 200, type: ResponseDto })
  • @ApiParam se a rota tem :id
  • @ApiBody({ type: CreateDto }) em POST/PUT/PATCH
  • Controller com @ApiTags, @ApiBearerAuth, @UseGuards(JwtAuthGuard)

Regras criticas

  • Nunca throw new Error(): usar HttpException ou o helper de erro do BaseService.
  • Nunca export default.
  • Sempre excludeExtraneousValues: true na serializacao dos response DTOs.
  • Importar tipos de @org/shared; nunca duplicar contrato publico.
  • TDD: spec antes da implementacao.
  • Banco em snake_case, JSON em camelCase (mapear com @Expose / @Transform ou no service).
  • select explicito no Prisma: nunca retornar a linha inteira por padrao.

Placeholders

PlaceholderTroca por
<backend-app>nome do app NestJS
{Entity} / {module} / {model}PascalCase / kebab-case / nome no Prisma
@org/sharedalias da lib de contratos
JwtAuthGuardguard de auth do projeto
tenantId / tenant_idcampo de escopo multi-tenant, ou remover se nao aplicavel

Pre-requisito: BaseService

Os templates assumem um BaseService com:

protected validateId(id: number): void;
protected validateExists<T>(entity: T | null, label: string, id: number): asserts entity is T;
protected handleServiceError(error: unknown, context: string): never;

Se o projeto destino nao tiver, criar antes ou trocar as chamadas por throw new HttpException(...) direto no service.

Alinhamento de arquitetura

Contratos HTTP publicos nascem na lib compartilhada, nunca duplicados entre front e back. Nao introduzir novos limites de rede (microservicos, BFF extra) sem aprovacao explicita.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.