بنقرة واحدة
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.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').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.synchronize: false in TypeORM config. Use migrations (typeorm migration:generate and typeorm migration:run) for production schema changes. If needed only for development, guard with synchronize: process.env.NODE_ENV !== 'production'.class-transformer's @Exclude() decorator on sensitive entity fields and @SerializeOptions() on the controller. Never return raw ORM entities from controller methods.@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().async keyword since a new Promise() is already being constructed manually. Otherwise, either add an await expression or remove the async keyword.@Module() arrays (providers, controllers, imports, exports).@Module({}) decorator to the class. Import it from @nestjs/common.await before the async call to properly handle rejections. If fire-and-forget is intentional, prefix with void and add a .catch() handler: void this.service.sendEmail().catch(err => this.logger.error(err)).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.this.moduleRef.get(SomeService) with constructor injection: add private readonly someService: SomeService to the constructor. If the service is truly dynamic or lazily resolved, document the reason with a comment.@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).onModuleInit() lifecycle hook. Implement OnModuleInit interface.require(variable) with a static import or a switch/map pattern that uses static require() calls.Scope.REQUEST unless the provider genuinely needs per-request state (e.g., request-scoped context like REQUEST object). Use Scope.DEFAULT (singleton) or Scope.TRANSIENT instead. Remember that request scope propagates to all dependents.After applying fixes, suggest re-running the scan:
Fixes applied. Run
/nestjs-doctoragain to verify the score improved.