Creating project rules for Amazon Q Developer in third-party platforms
You can build a library of project rules that you can use with Amazon Q Developer in GitLab or GitHub. These rules describe coding standards and best practices across your team. For example, you could have a rule that states that all Python code must use type hints, or that all Java code must use Javadoc comments. By storing these rules in your project, you can ensure consistency across developers, regardless of their experience level.
Project rules are defined in Markdown files in the project's
folder.project-root
/.amazonq/rules
Once you've created your project rules, Amazon Q Developer will automatically use them as context within your project, and will make sure to adhere to them when generating code for feature development.
To create a project rule using the file system
-
In your third-party repository, open your project's root folder.
-
In the project root folder, create the following folder:
project-root
/.amazonq/rulesThis folder holds all your project rules.
-
In
, create a project rule file. It must be a Markdown file. For example:project-root
/.amazonq/rulescdk-rules.md
-
Open your project rule Markdown file.
-
Add a detailed prompt to the file. For example:
All Amazon S3 buckets must have encryption enabled, enforce SSL, and block public access. All Amazon DynamoDB Streams tables must have encryption enabled. All Amazon SNS topics must have encryption enabled and enforce SSL. All Amazon SNS queues must enforce SSL.
-
Commit, review, and merge your changes.
-
(Optional) Add more project rule Markdown files.
You have now created one or more project rules. Amazon Q will use these rules as context automatically within your project.