This content originally appeared on DEV Community and was authored by Santanu Bhattacharya
Few commands
q help
q settings
q whoami
Learn the Core Workflows
As a professional, you’ll use Q mostly for code assistance + AWS workflows.
Core commands you should master:
-
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
- Always run Q inside your project root so it reads your code.
- Be specific → “generate a Rails service object for sending user notification email” > “generate email code.”
- refine to refine the answer given by q, if you do not believe q in first instance
- 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
To be continued…
This content originally appeared on DEV Community and was authored by Santanu Bhattacharya