B · Review & TestIntermediate40 min read
5. Reviewing AI-generated code
AI Coding with Cursor · 44 pages source format
Never accept agent output blindly. Read every line. Check edge cases, security, tests, and style. You own the code, not the model.
What you'll learn
- Diff review
- Security checklist
- Test verification
Review checklist
Logic correct? Edge cases? Tests exist and pass? Secrets leaked? Dependencies justified? Style matches project?
- Logic handles null/empty/error paths
- No hardcoded secrets or API keys
- Tests cover happy path + one failure path
- No unnecessary new dependencies
- Matches existing naming and patterns
Do this now
Review an agent diff with the checklist. Find at least one issue to fix.
Clear?
Run tests before accept
Agent says "done" but tests may not exist or may fail. Always run the test suite.
Do this now
Accept an agent change only after npm test / pytest passes green.
Clear?