{"id":39436,"date":"2025-08-02T07:11:06","date_gmt":"2025-08-02T07:11:06","guid":{"rendered":"https:\/\/www.newsbeep.com\/au\/39436\/"},"modified":"2025-08-02T07:11:06","modified_gmt":"2025-08-02T07:11:06","slug":"ai-code-review-the-right-way","status":"publish","type":"post","link":"https:\/\/www.newsbeep.com\/au\/39436\/","title":{"rendered":"AI Code Review The Right Way"},"content":{"rendered":"<p>Do you use a spell checker? We\u2019ll guess you do. Would you use a button that just said \u201ccorrect all spelling errors in document?\u201d Hopefully not. Your word processor probably doesn\u2019t even offer that as an option. Why? Because a spellchecker will reject things not in its dictionary (like Hackaday, maybe). It may guess the wrong word as the correct word. Of course, it also may miss things like \u201ctoo\u201d vs. \u201ctwo.\u201d So why would you just blindly accept AI code review? You wouldn\u2019t, and that\u2019s [Bill Mill\u2019s] point with his recent <a href=\"https:\/\/notes.billmill.org\/blog\/2025\/07\/An_AI_tool_I_find_useful.html\" target=\"_blank\" rel=\"nofollow noopener\">tool made to help him do better code reviews<\/a>.<\/p>\n<p>He points out that he ignores most of the suggestions the tool outputs, but that it has saved him from some errors. Like a spellcheck, sometimes you just hit ignore. But at least you don\u2019t have to check every single word.<\/p>\n<p>The basic use case is to evaluate PRs (pull requests) before sending them or when receiving them. He does mention that it would be rude to simply dump the tool\u2019s comments into your comments on a PR. This really just flags places a human should look at with more discernment.<\/p>\n<p>The program uses a <a href=\"https:\/\/github.com\/simonw\/llm\" target=\"_blank\" rel=\"nofollow noopener\">command-line interface<\/a> to your choice of LLM. You can use local models or select among remote models if you have a key. For example, you can get a free key for Google Gemini and set it up according to the instructions for the llm program. Of course, many people will be more interested in running it locally so you don\u2019t share your code with the AI\u2019s corporate overlords. Of course, too, if you don\u2019t mind sharing, there are plenty of tools like GitHub Copilot that will happily do the same thing for you.<\/p>\n<p>The review tool is <a href=\"https:\/\/github.com\/llimllib\/personal_code\/blob\/032c597d4c1f805a0fb6030723e22fcf4349b2ef\/homedir\/.local\/bin\/review\" target=\"_blank\" rel=\"nofollow noopener\">just a bash script<\/a>, so it is easy to change, including the system prompt, which you could tweak to your liking:<\/p>\n<p>Please review this PR as if you were a senior engineer.<\/p>\n<p>## Focus Areas<br \/>\u2013 Architecture and design decisions<br \/>\u2013 Potential bugs and edge cases<br \/>\u2013 Performance considerations<br \/>\u2013 Security implications<br \/>\u2013 Code maintainability and best practices<br \/>\u2013 Test coverage<\/p>\n<p>## Review Format<br \/>\u2013 Start with a brief summary of the PR purpose and changes<br \/>\u2013 List strengths of the implementation<br \/>\u2013 Identify issues and improvement opportunities (ordered by priority)<br \/>\u2013 Provide specific code examples for suggested changes where applicable<\/p>\n<p>Please be specific, constructive, and actionable in your feedback. Output the review in markdown format.<\/p>\n<p>Will you use a tool like this? Will you change the prompt? Let us know in the comments. If you want to play more with local LLMs (and you have a big graphics card), check out <a href=\"https:\/\/hackaday.com\/2025\/01\/08\/running-ai-locally-without-spending-all-day-on-setup\/\" rel=\"nofollow noopener\" target=\"_blank\">msty<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"Do you use a spell checker? We\u2019ll guess you do. Would you use a button that just said&hellip;\n","protected":false},"author":2,"featured_media":39437,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[256,254,255,64,63,105],"class_list":{"0":"post-39436","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-artificial-intelligence","8":"tag-ai","9":"tag-artificial-intelligence","10":"tag-artificialintelligence","11":"tag-au","12":"tag-australia","13":"tag-technology"},"_links":{"self":[{"href":"https:\/\/www.newsbeep.com\/au\/wp-json\/wp\/v2\/posts\/39436","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.newsbeep.com\/au\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.newsbeep.com\/au\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.newsbeep.com\/au\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.newsbeep.com\/au\/wp-json\/wp\/v2\/comments?post=39436"}],"version-history":[{"count":0,"href":"https:\/\/www.newsbeep.com\/au\/wp-json\/wp\/v2\/posts\/39436\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.newsbeep.com\/au\/wp-json\/wp\/v2\/media\/39437"}],"wp:attachment":[{"href":"https:\/\/www.newsbeep.com\/au\/wp-json\/wp\/v2\/media?parent=39436"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.newsbeep.com\/au\/wp-json\/wp\/v2\/categories?post=39436"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.newsbeep.com\/au\/wp-json\/wp\/v2\/tags?post=39436"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}