.cursor/skills/review-nestjs/SKILL.md
Reviews NestJS TypeScript code for correctness, security, multi-tenancy safety, and architectural best practices. Use when reviewing generated NestJS controllers, services, guards, interceptors, pipes, or modules, or when asked to do a code review on backend API code.
npx skillsauth add guimap01/notes_app review-nestjsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Targets NestJS with Prisma in a multi-tenant SaaS context. Work through the five areas in order. For the full pass/fail checklist, see checklist.md.
return true/false or throw.RBAC guard chain pattern (two guards, not one):
@UseGuards(JwtAuthGuard, RolesGuard) // auth first, roles second
@Roles(Role.ADMIN)
@Get('admin-data')
Never collapse token validation and role checking into a single guard.
Every query on a tenant-scoped resource must filter by tenantId sourced from the JWT/session, not from the request body or URL params.
// BAD — tenantId from request body; attacker can spoof it
async getNotes(@Body() dto: GetNotesDto) {
return this.notesService.findAll({ tenantId: dto.tenantId });
}
// GOOD — tenantId from validated JWT payload
async getNotes(@CurrentUser() user: JwtPayload) {
return this.notesService.findAll({ tenantId: user.tenantId });
}
Use Prisma middleware to inject tenantId automatically as a safety net — but do not rely on it as the only enforcement layer.
Background jobs and raw queries bypass Prisma middleware: every one must explicitly set tenant context.
Apply ValidationPipe globally with strict settings:
app.useGlobalPipes(
new ValidationPipe({
whitelist: true, // strip unknown properties
forbidNonWhitelisted: true, // throw on unknown properties
transform: true, // auto-transform to DTO types
}),
);
Without whitelist: true, unvalidated properties reach service logic. Every incoming DTO must use class-validator decorators.
SharedModule imported explicitly where neededconsole.log) for request/response loggingAuditServicewarn level with user ID, resource, and action — never swallowed silentlytools
Writes unit tests for React components using Vitest and React Testing Library. Use when writing or reviewing tests for React components, hooks, forms, or pages in apps/client. Covers setup, mocking strategy, form validation testing, async interactions, and testing library best practices.
development
Reviews React and TypeScript code for correctness, security, hook usage, and multi-tenancy safety. Use when reviewing generated React components, hooks, or TypeScript files, or when asked to do a code review on frontend code.
development
Maintainer-only workflow for handling GitHub Secret Scanning alerts on OpenClaw. Use when Codex needs to triage, redact, clean up, and resolve secret leakage found in issue comments, issue bodies, PR comments, or other GitHub content.
development
Maintainer workflow for OpenClaw releases, prereleases, changelog release notes, and publish validation. Use when Codex needs to prepare or verify stable or beta release steps, align version naming, assemble release notes, check release auth requirements, or validate publish-time commands and artifacts.