원클릭으로
init-feature
Generate a complete NestJS feature with all necessary components following the init-feature command specification
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Generate a complete NestJS feature with all necessary components following the init-feature command specification
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
| name | init-feature |
| description | Generate a complete NestJS feature with all necessary components following the init-feature command specification |
This skill generates a complete NestJS feature with Entity, DTOs, Module, Service, Controller, and tests.
init-feature, init, new-feature, create-feature, feature
You MUST follow these steps in exact order. Do NOT skip any step.
Read the following files before creating any components:
.agents/rules/dtos.md - For DTO creation.agents/rules/modules.md - For Module creation.agents/rules/services.md - For Service creation.agents/rules/controllers.md - For Controller creationTHIS STEP IS MANDATORY. You must determine the target directory BEFORE any generation.
Check which directory structure exists:
src/domains folder existssrc/features folder existsIf NEITHER exists, you MUST ask the user:
"No
domainsorfeaturesfolder found. Where should I create the feature?"
- Options: "Create
domainsfolder", "Createfeaturesfolder", "Usesrcroot"
Set base path based on user choice:
domains choice → src/domains/<feature-name>features choice → src/features/<feature-name>src root choice → src/<feature-name>THIS STEP IS MANDATORY. You must determine where to register the module BEFORE generation.
Check which parent module exists:
src/domains/domains.module.ts existssrc/features/features.module.ts existssrc/app.module.tsIf NEITHER domains.module.ts NOR features.module.ts exists, you MUST ask the user:
"Where should I register this module?"
- Options: "Create domains.module.ts and register", "Create features.module.ts and register", "Register in app.module.ts"
This determines:
Priority order for generation:
.agents/mcp.json).agents/skills/nestjs-crud/scripts/generate-resource.sh <feature-name> --path <relative-base-path>pnpm nest g resource <feature-name> --no-spec --path <relative-path>You MUST fix all code style issues BEFORE creating tests or running lint/format.
In entities/<feature-name>.entity.ts:
id: number to id: string (UUID)@PrimaryGeneratedColumn('uuid') instead of @PrimaryGeneratedColumn()In dto/create-<feature-name>.dto.ts and dto/update-<feature-name>.dto.ts:
.agents/rules/dtos.md firstclass-validator decorators: @IsString(), @IsEmail(), @IsOptional(), @MinLength(), etc.@ApiProperty(), @ApiPropertyOptional()@Type() from class-transformer if needed for transformationIn <feature-name>.service.ts:
.agents/rules/services.md first_paramNameIn <feature-name>.controller.ts:
.agents/rules/controllers.md first@ApiTags('<feature-name>') to the controller class@ApiOperation(), @ApiResponse() to each endpoint@ApiProperty() or @ApiPropertyOptional() to params/body DTOsCreate src/domains/<feature-name>/<feature-name>.service.spec.ts (or appropriate path based on Step 2)
Follow the pattern in existing spec files like:
src/config/health-check/health-check.service.spec.tsRequired format:
import { Test, TestingModule } from '@nestjs/testing'
import { DataSource } from 'typeorm'
import { <FeatureName>Service } from './<feature-name>.service'
const mockDataSource = {
query: jest.fn()
}
describe('<FeatureName>Service', () => {
let <featureName>Service: <FeatureName>Service
beforeAll(async () => {
const module: TestingModule = await Test.createTestingModule({
providers: [
<FeatureName>Service,
{
provide: DataSource,
useValue: mockDataSource
}
]
}).compile()
<featureName>Service = module.get<<FeatureName>Service>(<FeatureName>Service)
})
it('should be defined', () => {
expect(<featureName>Service).toBeDefined()
})
})
Create test/<feature-name>.e2e-spec.ts
Follow the pattern in test/app.e2e-spec.ts:
import { Test, TestingModule } from '@nestjs/testing'
import { INestApplication } from '@nestjs/common'
import request from 'supertest'
import { <FeatureName>Module } from './../src/<path-to-module>'
import { setup } from './../src/setup'
import { Environment } from './../src/config'
describe('<FeatureName>Controller (e2e)', () => {
let app: INestApplication
beforeEach(async () => {
const moduleFixture: TestingModule = await Test.createTestingModule({
imports: [<FeatureName>Module]
}).compile()
app = moduleFixture.createNestApplication()
setup(app, Environment.Development)
await app.init()
})
afterAll(async () => {
await app.close()
})
describe('<Feature> CRUD', () => {
it('/v1/<feature-name> (GET)', () => {
return request(app.getHttpServer())
.get('/v1/<feature-name>')
.expect(200)
})
})
})
Based on Step 3, register the module in the appropriate parent:
domains.module.ts → import DomainsModulefeatures.module.ts → import FeaturesModuleapp.module.ts → import directlyRun after all files are created:
pnpm run lint
pnpm run format
.agents/rules/dtos.md.agents/rules/modules.md.agents/rules/services.md.agents/rules/controllers.mdsrc/domains folder (Step 5)src/features folder (Step 5)domains.module.ts (Step 6)features.module.ts (Step 6)Do NOT proceed to Step 6 until Step 5 is complete. Do NOT run lint until Step 5 is complete.