一键导入
nestjs-doctor
Scan a NestJS project with nestjs-doctor, present a health report, and fix issues interactively
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Scan a NestJS project with nestjs-doctor, present a health report, and fix issues interactively
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | nestjs-doctor |
| description | Scan a NestJS project with nestjs-doctor, present a health report, and fix issues interactively |
| disable-model-invocation | true |
| allowed-tools | Bash, Read, Edit, Glob, Grep, Write |
v0.5.1
Scan the NestJS codebase, present a prioritized health report, and offer to fix every issue found.
Run nestjs-doctor and capture the full JSON output:
npx nestjs-doctor $ARGUMENTS --json 2>/dev/null
Parse the JSON output above. Present a summary:
Group diagnostics by severity (errors first, then warnings, then info). Within each severity, group by category (security > correctness > architecture > performance).
For each group show:
If there are more than 30 diagnostics, show the top 30 (prioritizing errors and warnings) and ask if the user wants to see the rest.
Ask the developer what they want to fix:
For each diagnostic to fix:
ConfigService, inject it, and use this.configService.get('ENV_VAR_NAME'). Add the env var name to .env.example if it exists.origin: '*' or origin: true with an explicit allowlist array or configService.get('CORS_ORIGINS').split(',').$1, $2 placeholders (Postgres) or ? (MySQL) and pass values as the second argument.eval() or new Function(). Replace with safe alternatives: JSON.parse() for JSON, a proper expression parser for dynamic evaluation, or refactor to avoid dynamic code execution entirely.// nestjs-doctor-ignore security/no-csrf-disabled -- <reason> comment on that line.res.redirect().createHash('md5') or createHash('sha1') with createHash('sha256') or stronger.process.env.X access with ConfigService. Inject ConfigService and use this.configService.get('X') or this.configService.getOrThrow('X').@UsePipes(new ValidationPipe()) to the handler/controller, or use a global validation pipe in main.ts, or add a DTO class with class-validator decorators.error.stack from response objects. Log the stack trace server-side with this.logger.error(error.stack) and return a generic error message to the client.@UseGuards(AuthGuard) to the controller class or individual routes. If intentionally public, add a comment explaining why.@Injectable() decorator to the class. Import it from @nestjs/common.canActivate(context: ExecutionContext): boolean | Promise<boolean> | Observable<boolean> method to the guard class. Implement CanActivate interface.transform(value: any, metadata: ArgumentMetadata) method to the pipe class. Implement PipeTransform interface.catch(exception: T, host: ArgumentHost) method to the exception filter class. Implement ExceptionFilter interface.intercept(context: ExecutionContext, next: CallHandler): Observable<any> method. Implement NestInterceptor interface.@Inject('TOKEN_NAME') decorator to untyped constructor parameters, or add a proper type annotation.readonly modifier to constructor-injected parameters: constructor(private readonly myService: MyService).onModuleInit(), add implements OnModuleInit.throw new NotImplementedException().await expression, remove the async keyword, or if it intentionally returns a Promise, remove async and return the promise directly.@Module() arrays (providers, controllers, imports, exports).@Module({}) decorator to the class. Import it from @nestjs/common.forwardRef(() => Module), or restructure the module boundaries.new SomeService() with constructor injection. Add the service to the module's providers and inject it via the constructor.@Inject() property injection with constructor injection. Move the dependency to a constructor parameter.import { X } from '../other-module/services/x.service') with imports through the module's public API (barrel file / index.ts).readFileSync, writeFileSync, etc.) with async equivalents (readFile, writeFile from fs/promises).Promise.all(), or eager loading/joins to fetch all related data in a single query.onModuleInit() lifecycle hook. Implement OnModuleInit interface.require(variable) with a static import or a switch/map pattern that uses static require() calls.async keyword since the function contains no await expressions. If it returns a Promise, return it directly without async.skip/take, limit/offset, or cursor-based) to findMany()/find() calls to avoid loading unbounded result sets.After applying fixes, suggest re-running the scan:
Fixes applied. Run
/nestjs-doctoragain to verify the score improved.