AI prompts
AI code review — prompt templates that catch real bugs
Six prompts that consistently surface real issues during code review. Paste the patch or PR diff after the prompt. ## 1. Bug + edge-case scan ``` Read this patch and list every potential bug, edge case, or off-by-one. Rank by severity (high/medium/low). For each, quote the line and explain what fails. ``` ## 2. Security review ``` Review this patch for security issues: injection, auth/authz, data exposure, secrets, unsafe deserialization, SSRF, race conditions. For each finding give the line, the threat, and a one-line fix suggestion. ``` ## 3. Test-coverage gap finder ``` List every behavior change in this patch that should have a test but doesn't. Quote the line that introduces the behavior. ``` ## 4. Naming + readability ``` Suggest renames for variables/functions in this patch that would make intent clearer to a reviewer who hasn't seen this file before. Show "before -> after" pairs only. ``` ## 5. Performance + complexity ``` Flag any new code in this patch with worse than O(n) complexity or that adds an extra DB/network round-trip. For each, propose a cheaper alternative. ``` ## 6. "What would a senior reviewer say?" ``` You are a senior engineer reviewing this patch in 5 minutes. Write the top 3 review comments you'd leave, in the tone of a constructive code review. No filler. ``` ## Tip Run prompts 1 + 2 + 3 together for high-risk PRs. Run 6 alone for fast review of small PRs.