AI Code Review
AI quickly finds nulls, missing checks, duplication and test gaps, but it can also be confidently wrong. This skill defines review order, prompts and the boundary of human verification.
Workflow
- 1
Provide context before the diff
Tell AI the business goal, callers, input range and known constraints before attaching the diff. Review without context only catches syntax and style.
- 2
Review by risk layer
Use a fixed order: correctness, security, concurrency/performance, maintainability, style. Require every finding to include trigger conditions, impact and a minimal fix; reject vague “consider optimizing” comments.
- 3
Ask AI for failing tests
For each suspected issue, have AI write a test that reproduces it before changing code. The test must fail before the fix and pass after; otherwise it proves nothing.
- 4
Human-review high-risk findings
Manually verify findings involving auth, payments, data deletion, concurrency and third-party calls. AI may miss framework conventions or misread lifecycles; never merge its patch blindly.
Recommended prompts
Code Review Prompt
Have the model review code by severity and return actionable fixes.
Unit Test Generation Prompt
Generate runnable tests with edge cases, not just the happy path.
Bug Diagnosis Prompt
Turn an error, logs and code into a verifiable debugging path.
FAQ
Can AI review replace humans?
No. AI is good for broad first-pass screening; architecture trade-offs, business rules and security boundaries still need human judgment.
What should a review prompt include?
Business goal, callers, input range, known constraints, risks to prioritize and an instruction to say when uncertain.
Related skills
Legacy Refactor
Refactor legacy code without changing external behavior by adding tests, finding seams and replacing in small steps.
Test Generation
Generate tests that catch real defects instead of happy-path ceremony.
Long-Form Blog Production
A repeatable pipeline from topic selection and research to a 3,000-word draft and fact-check.