Code Review
When to Use
Activate this skill when reviewing code changes (not necessarily a PR) for quality, patterns, and adherence to project conventions. This is a broader review than PR review — it can apply to any code segment.
Instructions
- Type safety: Verify TypeScript strict mode compliance. Check for implicit
any, missing return types on public methods, and proper null handling.
- Pattern adherence:
- NestJS: Modules, injectable services, controllers with decorators, guards for auth.
- Express: Middleware chain, router handlers, inline SQL with prepared statements.
- Next.js: App Router conventions,
"use client" directives, React hooks.
- Svelte: Runes (
$state, $derived, $effect), SvelteKit file routing.
- Error handling: All async operations wrapped in try/catch. API errors return proper status codes and
ApiErrorResponse shape.
- Database access: Parameterized queries only. No string concatenation in SQL. WAL mode enabled.
- Code smells:
- Functions longer than 50 lines → suggest extraction.
- Duplicated logic between backends → suggest shared utility.
- Magic numbers or strings → suggest constants in
packages/shared.
- Deep nesting (>3 levels) → suggest early returns or extraction.
- Security: No SQL injection, no XSS vectors, no exposed secrets, auth on all endpoints.
- Legacy awareness: Verify no new features are being added to legacy projects (Express.js, Next.js). Only critical bug fixes are permitted in
apps/backend-express and apps/frontend-nextjs. New development must target NestJS and SvelteKit.
Examples
Good pattern:
// NestJS service with proper error handling
async findOne(id: number): Promise<Franchise> {
const row = this.db.prepare('SELECT * FROM franchises WHERE id = ?').get(id);
if (!row) throw new NotFoundException(`Franchise #${id} not found`);
return this.mapRow(row);
}
Code smell:
// Duplicated row mapping — should be in shared package
const franchise = {
id: row.id,
name: row.name,
ownerName: row.owner_name, // exists in both Express and NestJS
// ...
};
1---2name: code-review-23description: Review code quality, patterns, and best practices4---56# Code Review78## When to Use9Activate this skill when reviewing code changes (not necessarily a PR) for quality, patterns, and adherence to project conventions. This is a broader review than PR review — it can apply to any code segment.1011## Instructions12131. **Type safety**: Verify TypeScript strict mode compliance. Check for implicit `any`, missing return types on public methods, and proper null handling.142. **Pattern adherence**:15 - NestJS: Modules, injectable services, controllers with decorators, guards for auth.16 - Express: Middleware chain, router handlers, inline SQL with prepared statements.17 - Next.js: App Router conventions, `"use client"` directives, React hooks.18 - Svelte: Runes (`$state`, `$derived`, `$effect`), SvelteKit file routing.193. **Error handling**: All async operations wrapped in try/catch. API errors return proper status codes and `ApiErrorResponse` shape.204. **Database access**: Parameterized queries only. No string concatenation in SQL. WAL mode enabled.215. **Code smells**:22 - Functions longer than 50 lines → suggest extraction.23 - Duplicated logic between backends → suggest shared utility.24 - Magic numbers or strings → suggest constants in `packages/shared`.25 - Deep nesting (>3 levels) → suggest early returns or extraction.266. **Security**: No SQL injection, no XSS vectors, no exposed secrets, auth on all endpoints.277. **Legacy awareness**: Verify no new features are being added to legacy projects (Express.js, Next.js). Only critical bug fixes are permitted in `apps/backend-express` and `apps/frontend-nextjs`. New development must target NestJS and SvelteKit.2829## Examples3031**Good pattern:**32```typescript33// NestJS service with proper error handling34async findOne(id: number): Promise<Franchise> {35 const row = this.db.prepare('SELECT * FROM franchises WHERE id = ?').get(id);36 if (!row) throw new NotFoundException(`Franchise #${id} not found`);37 return this.mapRow(row);38}39```4041**Code smell:**42```typescript43// Duplicated row mapping — should be in shared package44const franchise = {45 id: row.id,46 name: row.name,47 ownerName: row.owner_name, // exists in both Express and NestJS48 // ...49};50```