Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

Creating project rules for use with Amazon Q Developer chat

Focus mode
Creating project rules for use with Amazon Q Developer chat - Amazon Q Developer

You can build a library of project rules that you can use when chatting with Amazon Q in the IDE. 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 project-root/.amazonq/rules folder.

Once you've created your project rules, Amazon Q will automatically use them as context whenever a developer chats with Amazon Q within your project, and will make sure to adhere to them when generating answers. For more information about adding context to the chat, see Adding context to Amazon Q Developer chat in the IDE.

To create a project rule
  1. In your IDE, open the project's root folder.

  2. In the project root folder, create the following folder:

    project-root/.amazonq/rules

    This folder holds all your project rules.

  3. In project-root/.amazonq/rules, create a project rule file. It must be a Markdown file. For example:

    cdk-rules.md

  4. Open your project rule Markdown file.

  5. 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.
  6. Save the file.

  7. (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 whenever a developer chats with Amazon Q within your project.

PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.