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".
In this repository18 other files it gives its agents.
- agents/AGENTS.mdAGENTS.md
- ai-operating-protocolSkill
- angular-feature-architectureSkill
- angular-primeng-auditSkill
- angular-primeng-uiSkill
- angular-testing-patternsSkill
- commit-and-branch-conventionsSkill
- frontend-auth-bootstrapSkill
- generating-data-layerSkill
- generating-dumb-createSkill
- generating-dumb-editSkill
- generating-dumb-listSkill
- generating-smart-pageSkill
- monorepo-workspace-standardsSkill
- nestjs-api-standardsSkill
- prisma-migration-disciplineSkill
- rbac-security-auditorSkill
- shared-contracts-librarySkill
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
- Distinctive: line 27
DTOs: create, update, response.
≈ “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.
Files
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 serviceOrdem de geracao (obrigatoria)
- Interface compartilhada: verificar/criar em
@org/sharedse ainda nao existe. - DTOs: create, update, response.
- Testes (
spec.ts): escrever ANTES do service (TDD Red). - Service: implementar ate os testes passarem (TDD Green).
- Controller: conectar DTOs + Swagger.
- 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 })@ApiParamse a rota tem:id@ApiBody({ type: CreateDto })em POST/PUT/PATCH- Controller com
@ApiTags,@ApiBearerAuth,@UseGuards(JwtAuthGuard)
Regras criticas
- Nunca
throw new Error(): usarHttpExceptionou o helper de erro doBaseService. - Nunca
export default. - Sempre
excludeExtraneousValues: truena serializacao dos response DTOs. - Importar tipos de
@org/shared; nunca duplicar contrato publico. - TDD: spec antes da implementacao.
- Banco em
snake_case, JSON emcamelCase(mapear com@Expose/@Transformou no service). selectexplicito no Prisma: nunca retornar a linha inteira por padrao.
Placeholders
| Placeholder | Troca por |
<backend-app> | nome do app NestJS |
{Entity} / {module} / {model} | PascalCase / kebab-case / nome no Prisma |
@org/shared | alias da lib de contratos |
JwtAuthGuard | guard de auth do projeto |
tenantId / tenant_id | campo 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.
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
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.

