Searching for trae ai rules examples (or “user / project rules”, project_rules.md) usually means you want durable repo contracts the TRAE coding agent will load—not another Settings walkthrough. This page shows illustrative layouts under a typical .trae/rules/ tree, short copy-ready snippets, a clear user vs project split, and a practical division of labor with root AGENTS.md. Treat every path as illustrative—TRAE builds change discovery—so re-check official product docs on your installed build. We deliberately skip Settings panels, account login, and install steps; those belong upstream.

01

Independence note

02

What TRAE rules are for (vs AGENTS.md & prompts)

Project and user rules encode coding standards and team contracts that should stay true across sessions. Put durable house style in rules; put this ticket’s goal in the chat brief; keep secrets out of both.

  • Project rules: repo-committed standards the agent should load for this codebase (language defaults, test commands, forbidden paths).
  • User rules: personal preferences that travel with you across repos (tone, preferred editors, private shortcuts)—usually not committed.
  • AGENTS.md: portable root agent brief many tools also read—good for cross-tool contracts. See how to write AGENTS.md.
  • Session prompts: this ticket’s objective, acceptance checks, and temporary non-goals.
  • Neither: API keys, production credentials, or one-off customer data.

Prefer one clear statement of each convention. Thin TRAE-specific deltas in project rules; shared multi-tool facts in AGENTS.md. Compare packaging with JetBrains AI rules examples, Kiro steering examples, Augment rules examples, Amazon Q rules examples, Cline rules examples, Cursor rules examples, and Kilo code rules examples. Multi-file choice notes live in AGENTS.md vs CLAUDE.md vs Cursor rules.

03

User rules vs project rules

Searching for trae ai user rules vs project rules is the same fork other IDEs face:

  • Project rules (project_rules.md or a project rules directory): commit with the repo so every teammate and CI-facing agent session sees the same contracts.
  • User rules (user_rules.md or a user-level store): personal taste—verbosity, preferred languages, private non-goals. Do not commit secrets or company-wide policy into user rules if teammates need the same sentence.

04

File layout & relationship to AGENTS.md

Community and product docs often show Markdown under a .trae/rules/ tree, or named files such as project_rules.md / user_rules.md. Prefer one concern per file when you split. Exact auto-load behavior can differ between chat, inline, and agent modes—confirm on your build.

project/
  AGENTS.md                  # portable cross-tool brief (optional but useful)
  .trae/
    rules/
      project_rules.md       # always-on house style for this repo
      02-tests.md            # how to run and structure tests
      03-no-deploy.md        # forbid prod changes unless asked
  # user_rules.md typically lives in a user-level location—not committed
  src/
  ...

AGENTS.md division of labor: keep facts that every coding agent should know (package manager, test command, forbidden paths) in a short root AGENTS.md. Keep TRAE-flavored or IDE-stack specifics in project rules. When teammates also use Cursor, Cline, or JetBrains, put the canonical sentence in AGENTS.md once and keep IDE rules as thin deltas. Deeper comparison: AGENTS.md vs rules.

This page does not walk through TRAE Settings toggles, account login, or marketplace install—those change often and are covered by official product Help.

05

Copy-ready TRAE AI rules examples

Adapt these templates. Replace stack names, commands, and non-goals with your repo’s truth. Keep them short enough that a human will maintain them.

project_rules.md — always-on project conventions

# Project conventions (TRAE)

- Prefer extending an existing module pattern over inventing a parallel layout.
- Run the project’s documented test / build command before claiming done.
- Do not change production deploy pipelines, DNS, or payment config unless the user explicitly asks.
- Never print or commit secrets, access keys, or session tokens.
- Indent and naming: match the nearest sibling files; do not reformat unrelated trees.

Tests

# Tests

- Prefer adding or updating tests next to the changed behavior; mirror existing fixture style.
- Name tests by behavior, not by implementation class alone.
- Do not disable or skip failing tests to make the build green unless the user asks.
- Prefer the project’s existing test framework; do not introduce a second runner without asking.

Safety / no-prod-change

# Deploy and secrets

- Do not run production deploys, mutate live cloud accounts, or edit payment / DNS config unless asked.
- Never commit .env, credentials.json, or long-lived tokens into rules or chat history.
- Prefer short-lived roles and documented secret managers over pasting keys into the session.

user_rules.md — personal (usually not committed)

# Personal preferences (user rules)

- Prefer concise answers with a short plan before large edits.
- Default language for explanations: English unless the user writes Chinese.
- Ask before deleting files or rewriting public APIs.
- Do not put company secrets or shared team policy here—those belong in project rules / AGENTS.md.

When tools live outside the IDE, pair rules with a clear tool policy in the prompt. For MCP host pitfalls, see the MCP server tutorial and MCP server best practices.

06

Writing patterns that stick

  1. Imperative and testable. “Run pnpm test” beats “ensure quality.”
  2. Name artifacts. Paths, package managers, and CI jobs beat vibes.
  3. State non-goals. Forbid prod deploys, drive-by refactors, and secret echo.
  4. One concern per file when you split; keep project_rules.md short if it is the only file.
  5. Separate AGENTS.md from TRAE rules. Shared facts once; IDE-specific deltas thin.
  6. Keep user rules personal—do not smuggle team policy into a private file teammates never see.
  7. Point at exemplars. “Match the existing repository layer” beats reinventing access patterns.

Rules degrade when they become a wishlist. If the agent still violates a rule after two sessions, either the rule is vague, the file is outside the discovered project-rules path, AGENTS.md was assumed loaded when it was not, or a stronger nearby example is missing—verify discovery on your TRAE surface first.

07

Anti-patterns

  • Novel-length always-on rules: crowd context and get sampled inconsistently.
  • Mirroring Settings / install steps inside rules: install paths belong in Help docs, not committed contracts.
  • Contradictions: “always open network” next to “least privilege.”
  • Secrets in rules: rules are often committed; use secret managers instead.
  • Copying Cursor / Cline / JetBrains rules wholesale without remapping: wrong directory, wrong host assumptions.
  • Duplicating the same wall into AGENTS.md, project_rules, and user_rules: sync cost explodes; pick one canonical layer per concern.
  • Assuming user and project rules are interchangeable: commit project rules; keep personal prefs out of the shared tree.

Related reading: JetBrains AI rules examples · Kiro steering examples · Augment rules examples · How to write AGENTS.md · AGENTS.md vs CLAUDE.md vs Cursor rules · Amazon Q rules examples · Kilo code rules examples · Cursor rules examples · Windsurf rules examples · Cline rules examples · Junie guidelines examples · copilot-instructions.md examples · How to write CLAUDE.md · Good agent prompts · Agent engineering notes

08

FAQ

Where should I put TRAE AI rules examples in a repo?

Most teams use a project-rules file or directory under .trae/rules/ (for example project_rules.md) at the project root. Exact auto-load behavior depends on your TRAE version—confirm in current product docs. This site’s examples are unofficial templates, not a product catalog.

User rules vs project rules—how do I choose?

Commit shared contracts as project rules; keep personal taste in user rules. Team-wide policy that every agent must see belongs in project rules or AGENTS.md, not only in a private user file. See user vs project above.

How should TRAE rules relate to AGENTS.md?

Put portable, cross-tool contracts in AGENTS.md and keep TRAE-specific deltas in project rules. Multi-tool teams often keep a short root AGENTS.md and thinner IDE rules. See AGENTS.md vs CLAUDE.md vs Cursor rules.

Is this a TRAE Settings or install guide?

No. This page only covers copy-ready rule writing, user vs project scope, and AGENTS.md division of labor. Settings panels and install steps belong in official TRAE Help—re-check those after upgrades.

Is this official TRAE documentation?

No. Unofficial practice notes from 墨码 / codemo.fun—not affiliated with TRAE. Treat templates as starting points and re-verify paths after upgrades.