Skip to content

Rules

You can set up rules to regulate the behavior of AI in Trae IDE.

Rule types

Trae IDE supports the following types of rules:

Rule TypeDescription
User rulesUser rules are your customized guidelines for AI based on your personal habits and needs, aimed at making AI's outputs more aligned with your personalized requirements. User rules work in all projects. For example:
• Language style: Preference for concise, formal, or humorous expressions.
• Operating system: Providing answers specific to Windows or macOS operating system.
• Content style: Whether detailed explanations and examples are needed, or just conclusions.
• Interaction method: Preference for direct answers versus guided questioning.
Project rulesProject rules are guidelines that the AI must follow for the current project. Project rules work only in the project that they are added to. For example:
• Code style: Indentation (spaces/tabs), naming conventions (camelCase/snake_case), and more.
• Languages and frameworks: Preferred programming languages (for example, Python/JavaScript) or frameworks (for example, React/Django).
• API restrictions: Avoid using certain APIs.

Create user rules

Based on your personal preferences, create the rules that AI must follow in all projects.

  1. At the top right of the side chat box, click the Settings icon > Rules.

  2. The Rules window appears.

  3. In the User Rules section, click the + Create user_rules.md button.

  4. The system automatically creates the user_rules.md file and opens it in the editor.

    Create user rules

  5. In the user_rules.md file, put down the rules that AI must follow.

  6. Save your settings.

Your rules will be applied to AI across all projects.

Create project rules

Create the rules that AI must follow in a specified project.

  1. Open a project.

  2. At the top right of the side chat box, click the Settings icon > Rules.

  3. The Rules window appears.

  4. In the Project Rules section, click the + Create project_rules.md button.

  5. The system automatically creates the .trae/rules folder in your project's directory and creates the project_rules.md file in that folder.

    Create project rules

  6. In the project_rules.md file, put down the rules that AI must follow.

  7. Save your settings.

Your rules will be applied to AI in this project.

Manage rules

In the Rules window, you can modify user rules and project rules, as well as delete rule files.

  • After modifying the rules, the AI will follow the new rules.
  • Deleting a rule file will invalidate all previously defined rules.

Manage rules

Your Ultimate AI-Powered IDE Learning Guide