DEV Community

Cover image for Amazon Q developer cheatsheet learnt
Santanu Bhattacharya
Santanu Bhattacharya

Posted on

Amazon Q developer cheatsheet learnt

Amazon Q Developer is a generative UI-powered tool for project development. Based on my use, I try to prepare some quick notes for future use. I am using Q cli versioned 1.14.1.

It is not entirely free, you will have some free credits every month, you can get the price details here https://aws.amazon.com/q/developer/pricing/?p=qdev&z=subnav&loc=7

From our experience, this tool helped us complete 4 days’ worth of work in just 1 day. That’s the level of productivity boost it can bring!

AI Big picture in simple form

Few commands

q help
q settings
q whoami
Enter fullscreen mode Exit fullscreen mode

Learn the Core Workflows

As a professional, you’ll use Q mostly for code assistance + AWS workflows.

Core commands you need to know:

  • q generate → generate or refactor code
  • q explain → explain existing code
  • q test → write or improve unit tests
  • q run → execute code
  • q fix → debug/resolve errors
  • q ask → general-purpose Q&A (like ChatGPT but AWS/dev focused)

You can check the usage

  • /usage => Shows a summary of your current usage of Q.
  • /compact => Compacts the session history by summarizing previous prompts + responses. Keeps the conversation lighter and prevents Q from hitting context/token limits.
  • /quit => Ends the current Q session in your terminal.
  • /clear => Clears the current conversation history with Q
  • /save => Saves the current conversation to a file for later use.

q chat --resume

==> It will start from where you finished.

explain app/models/user.rb

generate rspec tests for app/models/mev.rb

ask "list all s3 buckets in my account"

test app/models/user.rb

fix "DB connection error in database.yml file"

ask "where in this project do we send emails?"

Go deeper

  1. Always run Q inside your project root so it reads your code.
  2. Be specific → “generate a Rails service object for sending user notification email” > “generate email code.”
  3. refine to refine the answer given by q, if you do not believe q in first instance
  4. Security mindset: Do not copy blindly

AWS Pro Workflows

Q to speed up AWS development:

Infra as Code (Pulumi/CDK/Terraform)

q chat --resume

| ask "command to list all ec2 instances in ap-southeast-1"

will give the bash command for using with aws-cli

| generate pulumi code in yaml for listing all ec2 instances in ap-southeast-1

Will create the Pulumi.dv.yaml

Now pulumi up will help to list down the instances

NB: When you give prompt, explain more to get more accurate result, q will behave like a senior developer

Example:

generate s3 upload code
vs

generate rails service object UploadFileService with method call(file:, bucket:) using aws-sdk-s3 gem, include unit tests with rspec

What is Project Intelligence?

It is from Promptz.dev. It transforms Amazon Q Developer from a stateless assistant into a persistent development partner. That means it remembers and understands your project over time, not just for a session.

You need to add the rules in the markdown file.
.amazonq/rules/*;
Once you add the rules, you can type: Initialize Project Intelligence

It will automatically create some markdown files and maintain this small set of Markdown files that help Amazon Q understand and remember your project.

You will get the list of markdown files and their use here in detail: https://www.promptz.dev/rules/rule/project-intelligence-dbd52e23

Top comments (0)