AWS Logo
Menu

Pull Request Code Suggestions with Amazon Q Developer

Using the /review workflow put code suggestions on your GitHub pull requests!

Published Mar 20, 2025
Amazon Q Developer comes with many powerful commands, and one of the most useful is the /review command. This feature allows Amazon Q Developer to review and fix code directly in your IDE before you commit changes. However, as demonstrated in a previous post, it can also be integrated into CI/CD pipelines to automatically comment on pull requests—providing valuable feedback on code changes.

Automated PR Reviews with Amazon Q Developer

One of the standout features is that Amazon Q Developer can analyze diffs and leave comments on pull requests. This means developers can get automated feedback on their code before merging changes, improving collaboration and code quality.

Sample Prompt for Structured Code suggestions.

To achieve this, I structured the review comments in JSON format and used GitHub’s Octokit library to post them on the pull request. Here’s the prompt I used to generate the structured review comments:
This prompt instructs Amazon Q Developer to review the files listed in changes.txt and flag any CRITICAL or HIGH issues, outputting review comments in the amazon-q/review directory. It works pretty well!

Implementation Details

I didn't have much success getting Q to put the diffs on the Pull request for me, so to implement this, I extended my existing Amazon Q code review pipeline by:
  • Installing Node.js and Octokit.
  • Running a script to parse the Amazon Q Developer review output and post the comments to the pull request.

here's the script!

 

Comments