[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6EBJHTJG4M5N53H74X2ZMKV":3,"skill-same:01M6EBJHTJG4M5N53H74X2ZMKV":55},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":27,"linkOnly":28,"markdownContent":29,"markdownBody":30,"frontMatter":31,"refName":32,"commitSha":33,"skillDirectory":34,"forksCount":35,"repositoryHtmlUrl":36,"repositoryHomepageUrl":37,"ownerHtmlUrl":38,"ownerBlogUrl":6,"ownerDescription":39,"updatedAt":40,"install":41,"resources":54},"01M6EBJHTJG4M5N53H74X2ZMKV","nestjs-controllers-services",null,"Controller\u002FService separation and Custom Decorators. Use when defining NestJS controllers, services, or custom parameter decorators. (triggers: **\u002F*.controller.ts, **\u002F*.service.ts, Controller, Injectable, ExecutionContext, createParamDecorator)","ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",67,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FHoangNguyen0403\u002Fagent-skills-standard\u002Fnestjs-controllers-services\u002FSKILL.md",[],[19,20,21,22,23,24,25,26],"services","nestjs","nestjs controllers services","controller","use","service","triggers","separation","2026-11-10 10:12:30",false,"---\nname: nestjs-controllers-services\ndescription: 'Controller\u002FService separation and Custom Decorators. Use when defining NestJS controllers, services, or custom parameter decorators. (triggers: **\u002F*.controller.ts, **\u002F*.service.ts, Controller, Injectable, ExecutionContext, createParamDecorator)'\n---\n\n# NestJS Controllers & Services Standards\n\n## **Priority: P0 (FOUNDATIONAL)**\n\nLayer separation standards and dependency injection patterns for NestJS applications.\n\n## Controllers\n\n- **Role**: Handler only. Delegate **all** logic to Services.\n- **Context**: Use `ExecutionContext` helpers (`switchToHttp()`) for platform-agnostic code.\n- **Custom Decorators**:\n  - **Avoid**: `@Request() req` -> `req.user` (Not type-safe).\n  - **Pattern**: Create typed decorators like `@CurrentUser()`, `@DeviceIp()`.\n\n  ```typescript\n  import { RequestWithUser } from 'src\u002Fcommon\u002Finterfaces\u002Frequest.interface';\n\n  export const CurrentUser = createParamDecorator(\n    (data: unknown, ctx: ExecutionContext): User => {\n      const request = ctx.switchToHttp().getRequest\u003CRequestWithUser>();\n      return request.user;\n    },\n  );\n  ```\n\n## DTOs & Validation\n\n- **Strictness**:\n  - `whitelist: true`: Strip properties without decorators.\n  - **Critical**: `forbidNonWhitelisted: true`: Throw error if unknown properties exist.\n- **Transformation**:\n  - `transform: true`: Auto-convert primitives (String '1' -> Number 1) and instantiate DTO classes.\n- **Documentation**:\n  - **Automation**: Use the `@nestjs\u002Fswagger` CLI plugin (`nest-cli.json`) to auto-detect DTO properties without manual `@ApiProperty()` tags.\n\n## Interceptors (Response Mapping)\n\n- **Standardization**: specific responses should be mapped in **Interceptors**, not Controllers.\n  - Use `map()` to wrap success responses (e.g. `{ data: T }`).\n  - Refer to **[API Standards](..\u002Fnestjs-api-standards\u002FSKILL.md)** for `PageDto` and `ApiResponse`.\n  - Use `catchError()` to map low-level errors (DB constraints) to `HttpException` (e.g. `ConflictException`) _before_ they hit the global filter.\n\n## Services & Business Logic\n\n- **Singleton**: Default.\n- **Stateless**: Do not store request-specific state in class properties unless identifying as `Scope.REQUEST`.\n\n## Pipes & Validation\n\n- **Global**: Register `ValidationPipe` globally.\n- **Route Params**: Fail fast. Always use `ParseIntPipe`, `ParseUUIDPipe` on all ID parameters.\n\n```typescript\n@Get(':id')\nfindOne(@Param('id', ParseIntPipe) id: number) { ... }\n```\n\n## Lifecycle Events\n\n- **Init**: Use `OnModuleInit` for connection setup.\n- **Destroy**: Use `OnApplicationShutdown` for cleanup. (Requires `enableShutdownHooks()`).\n\n## Anti-Patterns\n\n- **No business logic in controllers**: Delegate everything to Services; controllers only parse and respond.\n- **No req.user access**: Create typed `@CurrentUser()` decorator instead of accessing raw `req`.\n- **No REQUEST scope by default**: Use SINGLETON; it makes the entire injection chain request-scoped.\n\n","# NestJS Controllers & Services Standards\n\n## **Priority: P0 (FOUNDATIONAL)**\n\nLayer separation standards and dependency injection patterns for NestJS applications.\n\n## Controllers\n\n- **Role**: Handler only. Delegate **all** logic to Services.\n- **Context**: Use `ExecutionContext` helpers (`switchToHttp()`) for platform-agnostic code.\n- **Custom Decorators**:\n  - **Avoid**: `@Request() req` -> `req.user` (Not type-safe).\n  - **Pattern**: Create typed decorators like `@CurrentUser()`, `@DeviceIp()`.\n\n  ```typescript\n  import { RequestWithUser } from 'src\u002Fcommon\u002Finterfaces\u002Frequest.interface';\n\n  export const CurrentUser = createParamDecorator(\n    (data: unknown, ctx: ExecutionContext): User => {\n      const request = ctx.switchToHttp().getRequest\u003CRequestWithUser>();\n      return request.user;\n    },\n  );\n  ```\n\n## DTOs & Validation\n\n- **Strictness**:\n  - `whitelist: true`: Strip properties without decorators.\n  - **Critical**: `forbidNonWhitelisted: true`: Throw error if unknown properties exist.\n- **Transformation**:\n  - `transform: true`: Auto-convert primitives (String '1' -> Number 1) and instantiate DTO classes.\n- **Documentation**:\n  - **Automation**: Use the `@nestjs\u002Fswagger` CLI plugin (`nest-cli.json`) to auto-detect DTO properties without manual `@ApiProperty()` tags.\n\n## Interceptors (Response Mapping)\n\n- **Standardization**: specific responses should be mapped in **Interceptors**, not Controllers.\n  - Use `map()` to wrap success responses (e.g. `{ data: T }`).\n  - Refer to **[API Standards](..\u002Fnestjs-api-standards\u002FSKILL.md)** for `PageDto` and `ApiResponse`.\n  - Use `catchError()` to map low-level errors (DB constraints) to `HttpException` (e.g. `ConflictException`) _before_ they hit the global filter.\n\n## Services & Business Logic\n\n- **Singleton**: Default.\n- **Stateless**: Do not store request-specific state in class properties unless identifying as `Scope.REQUEST`.\n\n## Pipes & Validation\n\n- **Global**: Register `ValidationPipe` globally.\n- **Route Params**: Fail fast. Always use `ParseIntPipe`, `ParseUUIDPipe` on all ID parameters.\n\n```typescript\n@Get(':id')\nfindOne(@Param('id', ParseIntPipe) id: number) { ... }\n```\n\n## Lifecycle Events\n\n- **Init**: Use `OnModuleInit` for connection setup.\n- **Destroy**: Use `OnApplicationShutdown` for cleanup. (Requires `enableShutdownHooks()`).\n\n## Anti-Patterns\n\n- **No business logic in controllers**: Delegate everything to Services; controllers only parse and respond.\n- **No req.user access**: Create typed `@CurrentUser()` decorator instead of accessing raw `req`.\n- **No REQUEST scope by default**: Use SINGLETON; it makes the entire injection chain request-scoped.\n\n",{"name":5,"description":7},"main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002FHoangNguyen0403\u002Fagent-skills-standard\u002Fnestjs-controllers-services",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":8,"skillName":5,"commands":42,"prompt":52,"zipAvailable":53},[43,46,49],{"tool":44,"command":45},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill nestjs-controllers-services",{"tool":47,"command":48},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill nestjs-controllers-services",{"tool":50,"command":51},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill nestjs-controllers-services","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FHoangNguyen0403\u002Fagent-skills-standard\u002Fnestjs-controllers-services\u002FSKILL.md",true,[],[56,65,74,83,89,95],{"skillNo":57,"name":58,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":27},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[],[62,63,64],"model","model hierarchy","model hierarchy skill",{"skillNo":66,"name":67,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":27},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[],[71,72,73],"MCP","zoom","zoom mcp",{"skillNo":75,"name":76,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":27},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[80,81,82,72],"sdk","zoom apps sdk","apps",{"skillNo":84,"name":85,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":27},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[85],{"skillNo":90,"name":91,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":27},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[],[91],{"skillNo":96,"name":97,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":27},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[97]]