// interactive learning module

AI code
audit playbook

A systematic checklist for reviewing AI-generated backend code. Security pitfalls, missing error handling, hidden race conditions, performance traps, and architecture smells — the patterns that slip through because AI writes confident, plausible-looking code that doesn't quite work in production.

⚡ Add your Anthropic API key to unlock live AI tutoring in every section
01 — Security Pitfalls

The vulnerabilities AI confidently writes

AI-generated code is stylistically consistent but security-naive. It produces SQL injection risks, missing input validation, exposed secrets, and broken auth flows. Click each issue to see the bad pattern and the fix.

← select an issue to see the bad pattern and fix
AI tutor — Securityinjection, auth, secrets, input validation
02 — Error Handling

The silences that kill you in production

AI-generated code swallows errors, uses empty catch blocks, forgets to handle Promise rejections, and returns 200 OK for internal failures. Toggle between the patterns.

AI tutor — Error Handlingtry/catch, async errors, error propagation
03 — Race Conditions

The bugs that only appear under load

Race conditions are invisible in testing and lethal in production. AI code almost never includes locks, transactions, or atomic operations — it assumes sequential execution. Click each pattern to see the problem.

← select a race condition pattern above
AI tutor — Race Conditionsconcurrency, locks, atomic operations
04 — Performance Traps

Code that works for 10 users and breaks at 10,000

AI-generated code doesn't think about scale. It generates N+1 queries, loads entire tables into memory, missing indexes, and synchronous operations inside async handlers. Click each trap.

← select a performance trap above
AI tutor — PerformanceN+1, memory leaks, blocking event loop
05 — Architecture Smells

Structural problems that compound over time

AI generates code that works but doesn't scale as a system. God functions that do everything, missing separation of concerns, business logic in controllers, hardcoded values, no dependency injection. These smell fine at first and become unmaintainable at scale.

← select an architecture smell above
AI tutor — Architecturestructure, separation of concerns, testability
06 — The Checklist

Before any AI-generated code goes to production

Every item below is something I've found broken in AI-generated backend code in the wild. Work through this before merging any AI-assisted PR.

0 / 0 checked
AI tutor — Code Reviewask about anything on the checklist