Adds a domain module to an existing NestJS project: "add a user module", "새 도메인 추가", "admin + client 엔드포인트 만들어". Scaffold a new domain module in an existing NestJS project that follows the Admin/Client dual-interface convention (Fastify + TypeORM + dot-notation file naming). Use this whenever the user wants to add a domain/feature/resource to a Nest project set up with this convention — phrases like "add a user module", "새 도메인 추가", "create the post feature", "scaffold an orders resource", "admin + client 엔드포인트 만들어". Generates controllers, services, modules, DTOs, and (optionally) the entity, then registers the module in the shared CLIENT_MODULES / ADMIN_MODULES arrays so Swagger and AppModule pick it up automatically. Do NOT use this for: the initial project bootstrap/setup from scratch (use nestjs-bootstrap instead), extracting use-cases out of a fat service (that is a refactor, not a new module), writing the migration for the new entity (hand off to nestjs-migration), or non-NestJS / non-TypeORM stacks.
Ships in backend. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Generate one vertical slice of a domain following the dual-interface convention: Admin and Client are split at the file level because their auth model and response shape almost always diverge. Merging them forces conditional branches that rot; splitting them keeps each interface honest.
{
"domainName": "user", // kebab-case; used for folder + file names + URL path
"interfaces": ["admin", "client"], // subset — generate only what's asked
"entity": { // omit entirely if the domain has no own table yet
"softDeletable": true, // extends SoftDeletableEntity vs CoreEntity
"fields": [
{ "name": "email", "type": "varchar", "unique": true, "nullable": false }
]
},
"useContracts": true // response DTO `implements` a packages/contracts interface (§7)
}
If the caller (or user) omits fields, ask only for what blocks generation:
domain name and which interfaces. Everything else has a safe default
(interfaces: ["admin","client"], no entity, useContracts = true only if
packages/contracts exists in the repo).
{
"createdFiles": ["src/modules/user/...", "src/entities/user/user.entity.ts"],
"registeredIn": "src/module-groups.ts", // module added to CLIENT_MODULES / ADMIN_MODULES
"migrationNeeded": true // true iff an entity was created/changed
}
When migrationNeeded is true, tell the caller to run nestjs-migration next
(name suggestion: Create<Pascal> e.g. CreateUser). Do not generate the
migration here — that is a separate, safety-gated step.
package.json has the Nest
deps (usually apps/api, or repo root for a single-repo). All paths below are
relative to that root's src/.src/modules/<domain>/ already exists, stop
and report — do not overwrite an existing module. (Idempotency: adding a
missing interface to an existing domain is fine; overwriting is not.)src/modules/<domain>/ and, if an entity is
requested, src/entities/<domain>/.src/module-groups.ts (see step 6).migrationNeeded: true.src/modules/<domain>/
├── admin.<domain>.controller.ts # if "admin"
├── admin.<domain>.service.ts # if "admin"
├── admin.<domain>.module.ts # if "admin"
├── client.<domain>.controller.ts # if "client"
├── client.<domain>.service.ts # if "client"
├── client.<domain>.service.spec.ts # if "client" — seed unit test (establishes the test convention)
├── client.<domain>.module.ts # if "client"
├── <domain>.service.ts # (선택) shared logic — ONLY when non-trivial logic is genuinely shared, NOT for a trivial findAndCount
└── dtos/
├── admin.<domain>.dto.ts # if "admin"
└── client.<domain>.dto.ts # if "client"
src/entities/<domain>/<domain>.entity.ts # if entity requested
Use PascalCase for the class prefix (user → User). URL path is
admin/<domain> / <domain> with version: '1' (URI versioning — the folder
never encodes the version, §2.4).
src/entities/<domain>/<domain>.entity.tsimport { Column, Entity, Index } from 'typeorm';
import { Expose } from 'class-transformer';
import { SoftDeletableEntity } from '../common/core.entity'; // or CoreEntity if not soft-deletable
// Soft-deletable + unique column → partial unique index so a deleted row does
// not block re-registration with the same value (§7).
@Index(['email'], { unique: true, where: '"deleted_at" IS NULL' })
@Entity()
export class User extends SoftDeletableEntity {
@Column({ type: 'varchar', comment: '이메일' })
@Expose()
email!: string;
}
Rules baked in (§7): camelCase properties, ! definite-assignment for strict
mode, @Expose() on every field that should reach the client, Korean comment,
no class-validator decorators on entities. Non-unique fields drop the @Index.
admin.<domain>.controller.tsAdmin may return entities directly (§7). Every endpoint needs @ApiOperation
with a Korean, noun-form summary.
import { Controller, Get, Query } from '@nestjs/common';
import { ApiOkResponse, ApiOperation, ApiTags } from '@nestjs/swagger';
import { PaginationDto } from '../../common/dtos/pagination.dto';
import { AdminUserService } from './admin.user.service';
import { AdminUserListResDto } from './dtos/admin.user.dto';
@ApiTags('사용자')
@Controller({ path: 'admin/user', version: '1' }) // → /api/v1/admin/user
export class AdminUserController {
constructor(private readonly adminUserService: AdminUserService) {}
@Get()
@ApiOperation({ summary: '사용자 목록 조회' })
@ApiOkResponse({ type: AdminUserListResDto })
list(@Query() dto: PaginationDto): Promise<AdminUserListResDto> {
return this.adminUserService.list(dto);
}
}
client.<domain>.controller.tsClient responses go through a dedicated response DTO (never the raw entity, §7).
import { Controller, Get, Query } from '@nestjs/common';
import { ApiOkResponse, ApiOperation, ApiTags } from '@nestjs/swagger';
import { PaginationDto } from '../../common/dtos/pagination.dto';
import { ClientUserService } from './client.user.service';
import { ClientUserListResDto } from './dtos/client.user.dto';
@ApiTags('사용자')
@Controller({ path: 'user', version: '1' }) // → /api/v1/user
export class ClientUserController {
constructor(private readonly clientUserService: ClientUserService) {}
@Get()
@ApiOperation({ summary: '사용자 목록 조회' })
@ApiOkResponse({ type: ClientUserListResDto })
list(@Query() dto: PaginationDto): Promise<ClientUserListResDto> {
return this.clientUserService.list(dto);
}
}
Neither controller carries @ApiBearerAuth(). nestjs-bootstrap leaves auth out of scope, and the
decorator makes Swagger say a token is required while nothing checks one. Add it only to a controller
that an auth guard in the project actually protects (@UseGuards(...) on it, or a global APP_GUARD).
// client.user.service.ts — returns response-DTO *instances* (plainToInstance),
// never plain object literals (global excludeAll would blank them out, §8.1).
import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { plainToInstance } from 'class-transformer';
import { Repository } from 'typeorm';
import { User } from '../../entities/user/user.entity';
import { PaginationDto } from '../../common/dtos/pagination.dto';
import { ClientUserListResDto } from './dtos/client.user.dto';
@Injectable()
export class ClientUserService {
constructor(@InjectRepository(User) private readonly userRepo: Repository<User>) {}
async list({ limit, offset }: PaginationDto): Promise<ClientUserListResDto> {
const [data, total] = await this.userRepo.findAndCount({ take: limit, skip: offset });
return plainToInstance(ClientUserListResDto, { data, pagination: { limit, offset, total } });
}
}
admin.user.service.ts mirrors this (Admin may return entities directly). The two
interface services legitimately return different shapes, so a trivial one-liner like
findAndCount is NOT "shared logic" — leave it in each service; do not force a shared
service (or an untemplated file) just for it. Only when genuinely non-trivial logic is
shared (validation, state transitions, a reused query such as getActiveUserOrThrow)
extract it into the optional <domain>.service.ts and inject it into both — that file is
"(선택)" per §2.2, and §2.5's "do not duplicate" is about that non-trivial shared logic,
not a one-line repository call.
client.<domain>.service.spec.tsSeed one colocated unit test for the client service. This is deliberate: a fresh domain
that ships zero tests forces every downstream tool (e.g. api-creator/test-checker) to
guess the test convention instead of detecting it. This one spec pins the convention —
NestJS Test module + getRepositoryToken, a typed mock (not a raw as any cast), one
call-assertion for the passthrough plus one on the mapped result shape. The admin service gets
its own spec only if its logic diverges; do not seed a second near-identical spec.
import { vi, type Mocked } from 'vitest'; // vitest is the house runner (nestjs-bootstrap testing.md); describe/it/expect are globals
import { Test } from '@nestjs/testing';
import { getRepositoryToken } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { User } from '../../entities/user/user.entity';
import { ClientUserService } from './client.user.service';
describe('ClientUserService', () => {
let service: ClientUserService;
let repo: Mocked<Pick<Repository<User>, 'findAndCount'>>;
beforeEach(async () => {
repo = { findAndCount: vi.fn() };
const moduleRef = await Test.createTestingModule({
providers: [
ClientUserService,
{ provide: getRepositoryToken(User), useValue: repo },
],
}).compile();
service = moduleRef.get(ClientUserService);
});
it('list() paginates via findAndCount and returns a DTO with pagination meta', async () => {
const rows = [Object.assign(new User(), { id: 1 })];
repo.findAndCount.mockResolvedValue([rows, 1]);
const res = await service.list({ limit: 10, offset: 0 });
expect(repo.findAndCount).toHaveBeenCalledWith({ take: 10, skip: 0 });
expect(res.pagination).toEqual({ limit: 10, offset: 0, total: 1 });
});
});
dtos/client.<domain>.dto.tsimport { ApiProperty } from '@nestjs/swagger';
import { Expose, Type } from 'class-transformer';
import { PaginatedResDto } from '../../../common/dtos/pagination.dto';
// import type { UserSummary } from '@app/contracts'; // when useContracts
export class ClientUserResDto /* implements UserSummary */ {
@ApiProperty({ description: '사용자 ID' }) @Expose() id!: number;
@ApiProperty({ description: '이메일' }) @Expose() email!: string;
}
export class ClientUserListResDto extends PaginatedResDto {
@ApiProperty({ type: [ClientUserResDto], description: '사용자 목록' }) // every DTO property, the list too (swagger.md)
@Expose() @Type(() => ClientUserResDto) data!: ClientUserResDto[];
}
dtos/admin.<domain>.dto.ts is the same shape with Admin names: AdminUserResDto exposes
the admin-visible columns (usually more than the client's, such as createdAt; no deletedAt, since the
mirrored findAndCount never loads soft-deleted rows and the field would always be null),
AdminUserListResDto extends PaginatedResDto with the same @ApiProperty({ type: [...] })
data line. Write it; do not leave the admin controller importing a DTO that does not exist.
Every property gets a Korean @ApiProperty({ description }) (§5.1) AND @Expose()
(§4) — the two are not interchangeable. Request DTOs additionally carry
class-validator decorators.
client.<domain>.module.tsimport { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { User } from '../../entities/user/user.entity';
import { ClientUserController } from './client.user.controller';
import { ClientUserService } from './client.user.service';
@Module({
imports: [TypeOrmModule.forFeature([User])],
controllers: [ClientUserController],
providers: [ClientUserService],
})
export class ClientUserModule {}
admin.<domain>.module.ts is the Admin mirror.
Add the generated module classes to the shared arrays in src/module-groups.ts.
This is the whole point of the convention: AppModule imports and Swagger include
read the same arrays, so registering here wires up the app AND all three Swagger
docs at once — registration can never silently drift (§5).
// src/module-groups.ts
export const CLIENT_MODULES = [ClientUserModule /* , ... */];
export const ADMIN_MODULES = [AdminUserModule /* , ... */];
Insert the new module into the matching array(s) and add the import. If
module-groups.ts does not exist, the project was not bootstrapped with this
convention — stop and point the user at nestjs-bootstrap.
strict: true (all entity/DTO props use ! or ?).*.service.spec.ts was seeded; pnpm --filter api test runs it green (this seed
test establishes the project's test convention for later tooling to detect, not guess).migrationNeeded.What SKILL.md sets; muted values are Claude Code's defaults
/backend:nestjs-domain-modulefrom backend
npx claudepluginhub siu9068/ggyul-skills --plugin backend11 skills in this plugin
/api-creator-bootstrapGenerates a backend repo's `api-creator` + `test-checker` skill pair: set up, port, or bootstrap the API + test skills here. Generate a project-tailored TDD skill PAIR — `api-creator` (scaffold new APIs) and `test-checker` (audit & fill existing unit tests) — for a backend project: extract the proven gated, test-first methodology and fill in THIS project's own conventions (layers, base classes, auth, DTO/serialization, folder layout, test framework, verify commands). Both skills share one discovered recipe so they stay consistent. Use whenever the user wants to "set up api-creator here", "port the api-creator/test-checker skills to this project", "bootstrap the API + test skills for this repo", or bring one project's API + test conventions into another as reusable skills. Do NOT use this to actually build an API or audit tests in the current project (that is the generated skills' job), nor to edit an existing skill (use skill-creator / skill-ops)./axum-bootstrapScaffolds a Rust axum 0.8 + SeaORM 2.0 + PostgreSQL 16 backend from zero, standalone or apps/api monorepo. House convention: DDD-lite domains with Admin/Client route groups, fail-fast env validation, three utoipa OpenAPI docs with Swagger UI, tracing JSON logs, a Docker image, tests against a real Postgres. Phase 0 decides standalone (Cargo workspace at the repo root) or apps/api in a pnpm monorepo next to packages/contracts. Use when the user wants to start, set up or scaffold a new axum or Rust backend with this stack: "러스트 백엔드 새로 세팅해줘", "axum 프로젝트 만들어줘", "sea-orm 붙여서 rust api 서버 깔아줘", "bootstrap an axum backend", "scaffold a Rust API with SeaORM and Postgres", "set up apps/api in Rust". Do NOT use for: adding a domain to an existing axum project (use axum-domain-module), writing a SeaORM migration (use axum-migration), NestJS or FastAPI backends (nestjs-bootstrap / fastapi-bootstrap), the whole multi-app bootstrap chain (project-setup), or other Rust frameworks such as actix-web, rocket, poem or loco.Other plugins' skills for the same job