{"id":1134,"date":"2025-07-14T08:21:05","date_gmt":"2025-07-14T15:21:05","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/engineering-at-microsoft\/?p=1134"},"modified":"2025-07-15T08:05:48","modified_gmt":"2025-07-15T15:05:48","slug":"enhancing-code-quality-at-scale-with-ai-powered-code-reviews","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/engineering-at-microsoft\/enhancing-code-quality-at-scale-with-ai-powered-code-reviews\/","title":{"rendered":"Enhancing Code Quality at Scale with AI-Powered Code Reviews"},"content":{"rendered":"<p>At Microsoft, we are constantly looking for ways to improve developer productivity and code quality. One of our most impactful innovations in this space is <strong>AI-powered code review assistant<\/strong> \u2014 an AI tool that augments pull request (PR) reviews. This AI Assistant started as an internal experiment and now has scaled to support over 90% of PRs across the company impacting more than 600K pull requests per month. It helps our engineers catch issues faster, complete PRs sooner, and enforce consistent best practices \u2013 all within our standard development workflow. We built this capability in close collaboration with our Developer Division\u2019s Data &amp; AI team. The learning and experiences developed internally were incorporated into <a href=\"https:\/\/docs.github.com\/en\/copilot\/how-tos\/agents\/copilot-code-review\/using-copilot-code-review\">GitHub\u2019s AI-powered code review<\/a> offering and now benefit external customers. This is an example of how first-party (1P) innovation has shaped third-party (3P) products\u2014and how external usage continues to inform internal improvements.<\/p>\n<h3>Solving the real problems in PR reviews with AI<\/h3>\n<p>Pull requests (PRs) are a critical part of the development workflow\u2014but also there is some friction. Reviewers often spend time on low-value feedback like syntax issues or naming inconsistencies, while more meaningful concerns\u2014like architectural decisions or security implications\u2014can be overlooked or delayed. Authors, on the other hand, may struggle to provide enough context, especially when PRs are large or span multiple files. There is also the challenge of scale: with thousands of developers and repositories, ensuring every PR gets a timely and thorough review is hard. We have seen scenarios where PRs waited days and even weeks before getting merged, or where important feedback was missed. These pain points motivated us to try AI assistance in the review process. The goal was to let AI handle the repetitive or easily overlooked aspects of reviews, freeing human reviewers to focus on higher-level concerns.<\/p>\n<p>Our solution was to integrate an AI code reviewer into the existing PR workflow. Whenever a pull request is created, the AI assistant automatically kicks in as one of the reviewers. Here\u2019s what it does:<\/p>\n<ul>\n<li><strong>Automated Checks and Comments:<\/strong> AI reviews the code changes and leaves comments just like a human reviewer would. It flags a range of issues \u2013 from simple things like style inconsistencies and minor bugs, to more subtle concerns like a potential null reference or an inefficient algorithm. For example, if a developer introduces a method that does not properly handle an error condition, AI might comment on that specific diff line with a warning and an explanation. These comments show up in the PR discussion thread, so the author and other reviewers see them and can act (just as if a colleague had made the remarks). Each suggestion has a category associated with it e.g. exceptional handling, null check, sensitive data, which helps in understanding the associated impact. By catching such issues early, the AI reduces the review overhead for human peers and ensures that obvious problems are not missed <\/li>\n<li><strong>Suggested Improvements:<\/strong> Alongside reviews, the assistant even suggests specific code improvements. If it identifies a bug or a suboptimal code pattern, it proposes a corrected code snippet or an alternative implementation for the author to implement. While it is powerful, it is also designed with safeguards in mind. When AI suggests code changes, it does not commit them directly. The author remains in control\u2014reviewing, editing, and deciding whether to accept the suggestion by explicitly clicking \u2018apply change\u2019 option. All changes are attributed to the commit history, preserving accountability and transparency. <\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/engineering-at-microsoft\/wp-content\/uploads\/sites\/72\/2025\/07\/word-image-1134-1.png\" class=\"wp-image-1136\" alt=\"Screenshot of a pull request with suggestions from the AI code reviewer\" \/><\/p>\n<ul>\n<li><strong>PR Summary Generation:<\/strong> AI also generates a summary of the PR \u2013 essentially an AI-written description of what the code change is doing. This addresses a common issue of several PRs not having a well written description. The AI looks through the diffs and tries to explain the intent of the change and highlights key changes. Reviewers have found this extremely useful: it helps us to understand the big picture without having to manually decipher every file. <\/li>\n<\/ul>\n<p><img decoding=\"async\" width=\"1188\" height=\"447\" alt=\"Screenshot of a pull request AI generated summary of the changes\" src=\"https:\/\/devblogs.microsoft.com\/engineering-at-microsoft\/wp-content\/uploads\/sites\/72\/2025\/07\/a-screenshot-of-a-computer-ai-generated-content-m.png\" class=\"wp-image-1136\" srcset=\"https:\/\/devblogs.microsoft.com\/engineering-at-microsoft\/wp-content\/uploads\/sites\/72\/2025\/07\/a-screenshot-of-a-computer-ai-generated-content-m.png 1188w, https:\/\/devblogs.microsoft.com\/engineering-at-microsoft\/wp-content\/uploads\/sites\/72\/2025\/07\/a-screenshot-of-a-computer-ai-generated-content-m-300x113.png 300w, https:\/\/devblogs.microsoft.com\/engineering-at-microsoft\/wp-content\/uploads\/sites\/72\/2025\/07\/a-screenshot-of-a-computer-ai-generated-content-m-1024x385.png 1024w, https:\/\/devblogs.microsoft.com\/engineering-at-microsoft\/wp-content\/uploads\/sites\/72\/2025\/07\/a-screenshot-of-a-computer-ai-generated-content-m-768x289.png 768w\" sizes=\"(max-width: 1188px) 100vw, 1188px\" \/><\/p>\n<ul>\n<li><strong>Interactive Q&amp;A (\u201cAsk the AI\u201d):<\/strong> Reviewers can also engage the assistant in a conversation within the PR discussion. If something in the code is unclear, a reviewer can ask the AI questions about the code or request clarification. For example, \u201cWhy is this parameter needed here?\u201d or \u201cWhat\u2019s the impact of this change on module X?\u201d The AI can analyze the code and provide answers, acting like a knowledgeable co-reviewer available on demand. <\/li>\n<\/ul>\n<p>What makes using AI reviewer effective is how naturally it fits into existing workflows. It is treated just like any other reviewer\u2014no new UI to learn, no extra tools to install. Developers can engage with it conversationally, right within the PR thread, making it feel like a seamless extension of the team. It can even be configured to automatically engage the moment a PR is created, acting as the first reviewer\u2014always present, always ready. This frictionless integration has been key to its high adoption and impact.<\/p>\n<h3>Impact on quality and velocity<\/h3>\n<p>The adoption and impact of AI reviewer have been significant. Some benefits are:<\/p>\n<ul>\n<li><strong>Faster Review Cycles:<\/strong> With the AI doing an initial pass on each PR, teams have noticed that the overall time to complete a pull request has gone down. Per early experiments and data science studies, 5000 repositories onboarded to AI code reviewer observed 10 \u2013 20% median PR completion time improvements. AI often catches issues and suggests improvements within minutes of the PR\u2019s creation, which means authors can address those early, without waiting for a human reviewer\u2019s schedule. It also means fewer back-and-forth cycles for minor fixes, so PRs can get approved and merged more quickly. <\/li>\n<li><strong>Improved Code Quality:<\/strong>\u00a0It helps raise the baseline quality of code reviews by providing guidance around coding standards and best practices across the board. In several cases, AI flagged bugs that might have been overlooked \u2013 for example, spotting a missing null-check or an incorrectly ordered API call that could have caused a runtime error. By catching such problems before the code is merged, we prevent potential incidents downstream. <\/li>\n<li><strong>Developer Learning:<\/strong> It can act like a mentor who reviews every line of the code and explains possible improvements. Especially for new hires it can serve as a useful guide, accelerating onboarding and learning of best practices. <\/li>\n<\/ul>\n<h3>Customization: tailoring review for your team<\/h3>\n<p>One of the powerful features offered is its configurability and extensibility. Teams can customize the experience to provide repository specific guidelines. Also, teams can define custom review prompts that are specific to their scenarios. Teams across the company are leveraging these customizations to perform specialized reviews, like identifying regressions based on historical crash patterns or ensuring flight and change gates are in place.<\/p>\n<p><img decoding=\"async\" width=\"1339\" height=\"372\" src=\"https:\/\/devblogs.microsoft.com\/engineering-at-microsoft\/wp-content\/uploads\/sites\/72\/2025\/07\/word-image-1134-3.png\" class=\"wp-image-1137\" alt=\"Screenshot of pull request code review with customized review\" srcset=\"https:\/\/devblogs.microsoft.com\/engineering-at-microsoft\/wp-content\/uploads\/sites\/72\/2025\/07\/word-image-1134-3.png 1339w, https:\/\/devblogs.microsoft.com\/engineering-at-microsoft\/wp-content\/uploads\/sites\/72\/2025\/07\/word-image-1134-3-300x83.png 300w, https:\/\/devblogs.microsoft.com\/engineering-at-microsoft\/wp-content\/uploads\/sites\/72\/2025\/07\/word-image-1134-3-1024x284.png 1024w, https:\/\/devblogs.microsoft.com\/engineering-at-microsoft\/wp-content\/uploads\/sites\/72\/2025\/07\/word-image-1134-3-768x213.png 768w\" sizes=\"(max-width: 1339px) 100vw, 1339px\" \/><\/p>\n<h3>Co-evolution of 1P &amp; 3P solutions<\/h3>\n<p>A natural question is: How does Microsoft\u2019s internal AI review benefit the broader developer community? Being the first adopters and internal testers of AI-powered code reviews gave us an early exposure, allowing us to rapidly iterate on review quality, usability, and developer trust\u2014based on direct feedback from our engineering teams. The insights, patterns, and success we saw internally not only validated the value of AI-assisted reviews but also helped define the experiences like inline suggestions, and human in the loop review flows. This feedback loop became a significant contributor in GitHub\u2019s launch of <a href=\"https:\/\/github.blog\/changelog\/2025-04-04-copilot-code-review-now-generally-available\/?utm_source=chatgpt.com\">Copilot for Pull Request Reviews<\/a>, which reached general availability in April 2025, bringing these innovations to millions of developers worldwide.<\/p>\n<p>At the same time, learnings gathered using GitHub Copilot for Pull Request Reviews are being incorporated back into Microsoft\u2019s internal development process. This co-evolution ensures that Microsoft\u2019s developers and the broader developer community both benefit from AI advancements in code review.<\/p>\n<h3>Final thoughts<\/h3>\n<p>AI powered code reviews are a catalyst for transforming how we approach code reviews at scale. By combining the power of large language models with the rigor of human workflows, it empowers developers to write better code faster. Reviewers gain deeper insights, authors get actionable feedback, and teams move with greater confidence.<\/p>\n<p>And this is just the beginning. With ongoing investments in customization and quality, AI is poised to redefine the developer experience across Microsoft. Looking ahead, we are focused on deepening its contextual awareness\u2014bringing in repository-specific guidance, referencing past PRs, and learning from human review patterns to deliver insights that align more closely with team norms and expectations. This will enable reviewers to focus entirely on high-value feedback while AI handles major routine checks, streamlining the review process and elevating both speed and consistency. That\u2019s a future we are excited about \u2013 one where shipping high-quality code is easier and faster, supported by AI every step of the way.<\/p>\n<p>Whether you are at Microsoft or contributing from the broader dev community, AI can help code smarter. <a href=\"https:\/\/docs.github.com\/en\/copilot\/how-tos\/agents\/copilot-code-review\/using-copilot-code-review\">Try GitHub Copilot\u2019s code review<\/a> and bring AI into your workflow.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Microsoft\u2019s AI-powered code review assistant has transformed pull request workflows by automating routine checks, suggesting improvements, and enabling conversational Q&#038;A, leading to faster PR completion, improved code quality, and enhanced developer onboarding. Its seamless integration and customizability have driven widespread adoption within Microsoft<\/p>\n","protected":false},"author":192263,"featured_media":1018,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[56,60,54,59,58,57],"class_list":["post-1134","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-engineering-at-microsoft","tag-ai","tag-ai-agent","tag-ai-apps","tag-code-quality","tag-code-reviews","tag-developer-productivity"],"acf":[],"blog_post_summary":"<p>Microsoft\u2019s AI-powered code review assistant has transformed pull request workflows by automating routine checks, suggesting improvements, and enabling conversational Q&#038;A, leading to faster PR completion, improved code quality, and enhanced developer onboarding. Its seamless integration and customizability have driven widespread adoption within Microsoft<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/engineering-at-microsoft\/wp-json\/wp\/v2\/posts\/1134","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/engineering-at-microsoft\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/engineering-at-microsoft\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/engineering-at-microsoft\/wp-json\/wp\/v2\/users\/192263"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/engineering-at-microsoft\/wp-json\/wp\/v2\/comments?post=1134"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/engineering-at-microsoft\/wp-json\/wp\/v2\/posts\/1134\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/engineering-at-microsoft\/wp-json\/wp\/v2\/media\/1018"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/engineering-at-microsoft\/wp-json\/wp\/v2\/media?parent=1134"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/engineering-at-microsoft\/wp-json\/wp\/v2\/categories?post=1134"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/engineering-at-microsoft\/wp-json\/wp\/v2\/tags?post=1134"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}