一键导入
new-module
Scaffold a new NestJS business module in the project following the project's file structure, naming, and import conventions.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Scaffold a new NestJS business module in the project following the project's file structure, naming, and import conventions.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Create an End-to-End (E2E) test for a REST controller or GraphQL resolver using Fastify injection.
Add a new BullMQ job queue to the project — processor, producer injection, module registration, Bull Board integration, and unit tests.
Write unit tests for an existing NestJS service, resolver, or controller in the project following its Vitest + NestJS Testing conventions.
Run the full code quality pipeline (TypeScript + Biome + Knip), fix all issues, and clean up comments in changed code.
Create a git commit with all unstaged changes. Use this skill whenever the user asks to commit, make a commit, save changes to git, or says something like "commit this", "commit all changes". Always runs npm run check before committing and fixes any errors found.
Use this workflow to implement ANY new feature following Test-Driven Development strictly.
| name | new-module |
| description | Scaffold a new NestJS business module in the project following the project's file structure, naming, and import conventions. |
The user wants to create a new NestJS module for the project. They will provide the module name and whether it should expose a GraphQL resolver, a REST controller, or both.
File placement:
src/modules/<module-name>/src/infrastructure/<module-name>/src/modules/) unless the user specifies otherwiseFile naming (kebab-case):
src/modules/<name>/
<name>.module.ts
<name>.service.ts
<name>.resolver.ts (if GraphQL)
<name>.controller.ts (if REST)
types/
<name>.object-type.ts (GraphQL @ObjectType)
<name>.input.ts (GraphQL @InputType with Zod validation)
<name>.service.spec.ts (unit tests for service)
test/
<name>.e2e.spec.ts (E2E tests for resolver/controller)
Imports use @/ alias (maps to src/), e.g. import { PrismaService } from '@/common/prisma/prisma.service'
<name>.module.tsimport { Module } from '@nestjs/common';
import { <Name>Resolver } from './<name>.resolver';
import { <Name>Service } from './<name>.service';
@Module({
providers: [<Name>Service, <Name>Resolver],
exports: [<Name>Service],
})
export class <Name>Module {}
Add imports: [PrismaModule] only if using Prisma directly in the module (PrismaModule is global so usually not needed).
<name>.service.tsimport { Injectable } from '@nestjs/common';
import { PrismaService } from '@/common/prisma/prisma.service';
@Injectable()
export class <Name>Service {
constructor(private readonly prisma: PrismaService) {}
}
<name>.resolver.ts (GraphQL)import { UseGuards } from '@nestjs/common';
import { Args, Mutation, Query, Resolver } from '@nestjs/graphql';
import { CurrentUser, CurrentUserType } from '@/common/auth/current-user.decorator';
import { JwtAuthGuard } from '@/common/auth/jwt-auth.guard';
import { RolesGuard } from '@/common/auth/roles.guard';
import { <Name>Service } from './<name>.service';
import { <Name> } from './types/<name>.object-type';
@UseGuards(JwtAuthGuard, RolesGuard)
@Resolver(() => <Name>)
export class <Name>Resolver {
constructor(private readonly <name>Service: <Name>Service) {}
}
types/<name>.object-type.ts and types/<name>.input.tsUse the /add-graphql-type skill for templates and conventions for @ObjectType, @InputType, and enum types.
<name>.controller.ts (REST)import { Controller, Get, Post, Body, UseGuards } from '@nestjs/common';
import { ApiBearerAuth, ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
import { JwtAuthGuard } from '@/common/auth/jwt-auth.guard';
import { <Name>Service } from './<name>.service';
@ApiTags('<name>')
@Controller('<name>')
export class <Name>Controller {
constructor(private readonly <name>Service: <Name>Service) {}
@Get()
@UseGuards(JwtAuthGuard)
@ApiBearerAuth()
@ApiOperation({ summary: 'Get <name>' })
@ApiResponse({ status: 200 })
@ApiResponse({ status: 401, description: 'Unauthorized.' })
async get<Name>() {
// ...
}
}
Add controller to module (use controllers, not providers):
@Module({
controllers: [<Name>Controller],
providers: [<Name>Service],
exports: [<Name>Service],
})
<name>.service.spec.ts and test/<name>.e2e.spec.tsUse the /add-tests skill for unit test templates and patterns.
Use the /add-e2e-test skill for E2E test templates.
After creating the module files, add the module to src/app.module.ts:
imports array in @Module()import { <Name>Module } from '@/modules/<name>/<name>.module';
@Module({
imports: [
// ... existing imports
<Name>Module,
],
})
src/app.module.ts to understand the current imports listapp.module.ts/add-tests to create the unit test and /add-e2e-test to create the E2E testnpm run check from the project root to verify types and linting pass