AWS Logo
Menu
Amazon Q Guide: AI-Powered Development with Examples

Amazon Q Guide: AI-Powered Development with Examples

Learn Amazon Q’s AI tools for coding: /dev, /test, /review, /doc, /transform. A hands-on guide for developers to enhance productivity!

Dinesh Besiahgari
Amazon Employee
Published Mar 8, 2025
Amazon Q is the most recent entry into the realm of developer tools from Amazon and serves as  Amazon’s generative AI-powered assistant that is set to transform the way software is developed. Designed by the  creative people of Amazon Web Services (AWS), Amazon Q is not just a tool; it is a  loyal companion that increases productivity, improves code quality, and decreases project time. This AI-driven assistant is  integrated seamlessly into popular development environments such as IntelliJ, Visual Studio Code, and other IDE's, and  it uses advanced natural language processing and machine learning to understand the intent of developers and suggest context-aware suggestions  and automation. Its capabilities extend from writing code and creating unit tests, to reviewing code for  issues, generating documentation, to even rewriting legacy projects to match current standards. Amazon Q is designed to support  the developer at every stage of the development life cycle, whether they are creating new features, maintaining existing  systems, or upgrading to new technologies. Because of its ability to work with different programming languages and  frameworks, it is a valuable tool for both beginners and professionals in the ever dynamic tech ecosystem. This article delves into the specifics of the solutions that Amazon Q offers, and how these five key commands  (/dev, /test, /review, /doc, and /transform) can help developers get the  most out of the tool.

1. /dev: Generate Code to Make Changes in Your Project.

The /dev command is one of the foundational commands in the Amazon Q and Framework, which enables you to generate code  snippets or actually implement changes within your projects. It is most useful for rapid application development or quickly building  new features. 
For instance, if you require a Python function to calculate the factorial of a number
Prompt: /dev Generate a Python function to calculate the factorial of a number.
Generate a Python function to calculate the factorial of a number
Prompt to generate a Python function to calculate the factorial of a number
Generated Python function to calculate the factorial of a number by AmazonQ
Generated Python function to calculate the factorial of a number by AmazonQ
 This feature helps save time by creating functional code that you can later use in your project and continue  to develop further. 

2. /test: Generate Unit Tests (Python & Java) for Selected  Code 

 Testing is important and the Amazon Q /test command facilitates this process. If you have  the factorial function above and you want to check if it is correct you can ask. 
Prompt: /test Generate unit tests for the factorial function in Python
Generated unit tests for the factorial function in Python
Generated unit tests for the factorial function in Python
This yields  a test suite so that you can check your code with little or no effort and is perfect for ensuring quality  in rapid development workflows. 

 3. /review: Detecting and Solving Code Problems

 Before Committing /review enables you to discover and rectify issues before posting the code. For instance, you have a buggy Java method:
Prompt: /review 
  • When /review is selected it will ask if you need Amazon Q to look for issues in the entire workspace or the active file.. 
  • If a review workspace is selected it will review the entire workspace. If the review active file is selected then Amazon Q will review the active file tab in the VS code and identifies the issues accordingly.
AmazonQ reviewing the active file
AmazonQ reviewing the active file
AmazonQ explains the issues and fixes in the code
AmazonQ explains the issues and fixes in the code
 This proactive review ensures that there are cleaner commits and less time is spent in debugging. 

4. /doc: Generate Documentation  

A clear documentation is often under emphasized, but Amazon Q  /doc command simplifies it. You can request for e.g.: This auto generated  doc string improves on code readability and also helps in collaboration with the team.
Prompt: /doc
  • when selected Amazon Q asks if it needs to create a new README.md or updating an existing README.md file.
  • After generating the document it would ask to Accept or regenerate it.
AmazonQ generates the document for the workspace
AmazonQ generates the document for the workspace

5. /transform: Transform Your Java Project from Java 8 to Java 17/21

The  /transform is a game changer and the command facilitates large-scale project upgrades, such as migrating a Java project to a newer version. This transformation will align your project  with the current Java standards and thus enhance type safety and maintainability. 

 Transformation Process

When I called the /transform command, Amazon Q started a guided upgrade process: 
  1. Source Version Identification: Amazon Q could determine the source JDK version to be 8 from the  pom.xml. 
  2. Target Version Selection: It prompted me to select the target JDK version, and I chose  17. 
  3. Unit Test Conversion: The tool asked whether it should attempt to convert existing unit  tests. I decided to skip this as there were no tests supplied in this example. 
  4. Diff Format: It  then asked whether to show changes as one big diff or many. I went with the single diff for  simplicity. 
  5. JDK 8 Path: The last step was to provide the path to JDK8. After  following the instruction to run /usr/libexec/java_home -v 1.8 in a new  terminal, then enter the JAVA 8 path and Amazon Q successfully detected the path  and proceeded with the transformation. 
This proves how the tool is designed to adapt its process based on input  and feedback, ensuring a smooth, tailored experience for users.
Transformed Java code from JDK 8 to JDK 17
Transformed Java code from JDK 8 to JDK 17

Successful Transformed Example

 In Java 17, it is suggested to use generics to exclude raw types and strengthen the type  safety. Moreover, Java 17 has brought var for local variable type inference though it is not necessary. 

Why Amazon Q Matters ?

 Amazon Q's capabilities, which include code generation, testing, review, documentation, and transformation, make Amazon Q  a versatile tool for developers. Whether you are a sole coder or a part of a large team,  this tool increases the development rate, reduces mistakes, and enforces the best practices. As the AI  continues to evolve, Amazon Q is notable for providing actionable and context-oriented suggestions that are relevant to the  developer’s workflow. 
 Want to give it a try? Begin with a small project, try these  commands and see your efficiency increase. For more information, use the /help command in Amazon Q to  find more details about its help resources.
 
References:
https://aws.amazon.com/developer/generative-ai/amazon-q
https://aws.amazon.com/q/developer/pricing/
https://aws.amazon.com/blogs/aws/amazon-q-developer-now-generally-available-includes-new-capabilities-to-reimagine-developer-experience/
 

Any opinions in this post are those of the individual author and may not reflect the opinions of AWS.

Comments