Developing software with the Amazon Q Developer Agent for software development
The Amazon Q Developer Agent for software development can help you develop code features or make code changes to projects in your integrated development environment (IDE). You explain the task you want to accomplish, and Amazon Q uses the context of your current project or workspace to generate code to implement the changes. Amazon Q can help you build AWS projects or your own applications.
You can start an entirely new project, or work on an open project in your IDE. When you
develop in an existing project, Amazon Q uses all relevant files in your workspace root as
context to generate code. Amazon Q filters out files or folders defined in
a .gitignore
file, and only uses supported file types to generate code. For a
list of supported file types, see the following GitHub links for your IDE:
-
Supported file types for JetBrains IDEs – https://github.com/aws/aws-toolkit-jetbrains/blob/main/plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/services/telemetry/TelemetryUtils.kt
-
Supported file types for Visual Studio Code – https://github.com/aws/aws-toolkit-vscode/blob/master/packages/core/src/shared/filetypes.ts
To get started, open up a new or existing project and enter /dev
in
the Amazon Q chat panel. A new chat tab opens where you interact with the Agent for software development to generate new
code for your feature.
Topics
Develop features with /dev
To work on a task with the Agent for software development in your IDE, complete the following steps.
-
In your IDE, open a new or existing project or workspace where you want to develop features.
-
Choose the Amazon Q icon to open the Amazon Q chat panel.
-
Enter
/dev
in the Amazon Q chat panel followed by a description of the task you want to accomplish or the issue you want to resolve. You can provide a brief overview of a task, or add more details. Amazon Q uses your description and the code in your project to generate code.Following is an example of a code change you can ask Amazon Q to implement:
/dev Create a new REST API endpoint /api/authenticate to handle user authentication. This endpoint should accept POST requests with user credentials and return a JWT token upon successful authentication. Additionally, update the user management system to integrate with the new authentication endpoint and enforce authentication for relevant API endpoints.
You can also enter
/dev
only to see example tasks. -
A new tab opens. If you haven't already, enter a description of your task or issue.
-
Amazon Q begins to generate code for the task you've described. During the code generation, Amazon Q provides a summary of the steps it's taking and the files it's using or updating to suggest new code. This step can take a few minutes.
If you want Amazon Q to stop generating code, choose Stop. The incomplete code generation will count towards the code generation quota for this task. After you stop a generation, you have the option to enter another task description to keep working on your task.
-
After Amazon Q has generated code for your task, it provides a list of files with suggested changes. Choose a file to view a file diff with the changes.
-
To update your files with all of the suggested code changes, choose Accept all changes. You can also accept and reject changes to individual files. To accept an individual file change, hover your cursor over a file name and choose the green check mark. To reject a change, choose the red X. You can also choose Accept remaining changes to apply any changes you haven't accepted yet.
Once you accept a code change, you can't undo it. If you reject a code change, you can revert it by hovering over the file name and choosing the arrow. You then have the option to accept or reject the code change again.
-
If you aren’t satisfied with the proposed changes, you can provide feedback on what can be improved. Choose Provide feedback & regenerate, and then describe the changes that you'd like Amazon Q to make.
Amazon Q generates new code based on your feedback. When the generated code meets your requirements, choose Accept all changes or accept individual files to update the code in your project or workspace.
-
After you've updated your code, Amazon Q prompts you to start working on a new task.
To start working on another task in your project or workspace, choose Yes, I have another task. Your previous conversation and generated code aren't used as context for the new task.
To end the session with the Amazon Q Developer Agent for software development, choose No, thanks. To keep chatting or initiate another workflow with Amazon Q, open a new chat tab.
Best practices
To make the most out of the Amazon Q Developer Agent for software development, follow these best practices:
-
Provide a detailed description of the new feature or code changes you want to make, including the specifics of what the code should achieve. This allows Amazon Q to propose comprehensive and implementable code changes. For examples, see Example tasks.
-
Your feature shouldn’t require updates to more than 5 files at a time. Asking Amazon Q to make larger changes might impact the quality and manageability of the implementation of your feature. If your file diff includes changes to many files, try reducing the scope of your feature description.
Example tasks
Following are example feature development tasks you can ask the Amazon Q Developer Agent for software development to perform, with the corresponding description you might provide.
-
Update CSS Styles for Responsive Layout: Enhance the responsiveness of the application's layout by updating CSS styles. Focus on adjusting the layout for different screen sizes, ensuring optimal display across various devices.
-
Fix User Profile Image Upload: Resolve the issue preventing users from uploading profile images. Investigate the file upload process, ensure proper file type validation, and address any server-side errors preventing successful uploads.
-
Refactor Code for Code Readability: Improve the readability of a specific code module by refactoring it. Break down complex functions into smaller, more manageable units, and apply meaningful variable and function names for better clarity.
-
Implement Input Validation for Contact Form: Add client-side and server-side input validation to the contact form to prevent submission of empty or invalid data. Display appropriate error messages to users for any validation failures.
-
Resolve Broken Links in Navigation Menu: Investigate and fix broken links in the navigation menu of the application. Update the URLs or routes to ensure all navigation links lead to the correct pages.
-
Optimize Image Loading for Faster Page Loads: Optimize image loading on key pages of the application to reduce page load times. Implement lazy loading or asynchronous loading techniques to prioritize the display of visible content.
-
Add Error Logging for Critical API Endpoints: Enhance error handling by implementing logging for critical API endpoints. Log relevant error details such as request parameters and stack traces to facilitate debugging and troubleshooting.
-
Update Documentation for API Endpoints: Review and update the documentation for existing API endpoints to reflect recent changes or additions. Ensure accuracy and completeness of information for developers consuming the API.
-
Refactor Database Queries for Efficiency: Analyze and optimize database queries to improve efficiency and reduce resource consumption. Identify and eliminate redundant queries, optimize indexing, and consider caching strategies where applicable.
Quotas
The Amazon Q Developer Agent for software development maintains the following quotas:
-
Code generations per task – The number of times the Agent for software development can generate code for a given development task, including the initial code generation.
-
Code project size – The maximum size of the code file or folder that the Agent for software development can use as context to generate new code.
Resource | Quota |
---|---|
Code generations per task | 3 |
Code project size | 200 MB uncompressed 50 MB compressed |