xiaohongshu
xiaohongshu
dto-response
Use when creating or modifying DTO files in the `dto/` folder.
Full skill instructions
Use this skill when creating or modifying DTO files in the dto/ folder.
import { IsDateString, IsEnum, IsNotEmpty, IsOptional, IsString, Length } from 'class-validator';
import { IsE164 } from 'src/app.utils';
import { EntityEnum } from '../entity.enums';
export class CreateEntityDto {
@IsNotEmpty()
@IsString()
requiredField!: string;
@IsOptional()
@IsString()
@Length(1, 30)
optionalField?: string;
@IsOptional()
@IsDateString()
dateField?: string;
@IsOptional()
@IsEnum(EntityEnum)
enumField?: EntityEnum;
}
Use class-validator decorators
@IsNotEmpty(): Required fields@IsOptional(): Optional fields@IsString(), @IsNumber(), @IsBoolean(): Type validation@IsEnum(): Enum value validation@Length(): String length limits@IsDateString(): ISO 8601 date stringsField Declaration
! (definite assignment assertion)? (optional)Custom Decorators
@IsE164() (E.164 format validation)app.utils.ts as neededNaming Conventions
Find{Entity}DtoCreate{Entity}DtoUpdate{Entity}Dto{Action}{Entity}Dtoimport { Expose } from 'class-transformer';
import { EntityEnum } from '../entity.enums';
export class FindEntityRes {
@Expose()
id!: string;
@Expose()
name!: string;
@Expose()
enumField!: EntityEnum;
@Expose()
createdAt!: Date;
}
@Expose() decorator is required
@Expose() on all fields to exposeexcludeExtraneousValues: true optionNaming Conventions
Find{Entity}ResCreate{Entity}ResUpdate{Entity}Res{Action}{Entity}ResEntity → Response Transformation
import { mapTo } from '../app.utils';
// Usage in controller
return mapTo(FindEntityRes, entity);
Define in same file when DTO and Response are closely related (e.g., update API):
// update-entity.dto.ts
import { Expose } from 'class-transformer';
import { IsOptional, IsString, Length } from 'class-validator';
export class UpdateEntityDto {
@IsOptional()
@IsString()
@Length(0, 30)
name?: string;
}
export class UpdateEntityRes {
@Expose()
id!: string;
@Expose()
name!: string;
}
Transformation function defined in app.utils.ts:
import { type ClassConstructor, plainToInstance } from 'class-transformer';
export function mapTo<T, I>(type: ClassConstructor<T>, instance: I): T {
return plainToInstance(type, instance, {
excludeExtraneousValues: true,
});
}
import { applyDecorators } from '@nestjs/common';
import { Matches } from 'class-validator';
export function IsE164(): PropertyDecorator {
return applyDecorators(
Matches(/^\+[1-9]\d{1,14}$/, {
message: '전화번호는 E.164을 준수해야 합니다.',
}),
);
}
src/{module}/dto/
├── create-{entity}.dto.ts
├── update-{entity}.dto.ts
├── find-{entity}.dto.ts
└── index.ts # barrel export
export * from './create-entity.dto';
export * from './update-entity.dto';
export * from './find-entity.dto';
Global pipe setup in main.ts:
app.useGlobalPipes(
new ValidationPipe({
whitelist: true, // Remove undefined fields
forbidNonWhitelisted: true, // Error on undefined fields
transform: true, // Auto type transformation
}),
);
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience