> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getnao.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Rules

You can customize your nao agent's behavior by providing custom rules and guidelines. nao supports multiple ways to configure agent behavior:

.naorules File

The **`.naorules`** file is the primary way to customize your agent. Create this file at the root of your project and write your rules in plain English. These rules will be automatically applied to all conversations with the agent.

**What you can configure:**

* **Code style**: SQL formatting preferences, naming conventions, code structure
* **Agent behavior**: Language, tone, response style, documentation habits
* **Tool-specific rules**: Include your data stack documentation (Airflow, dbt, etc.)
* **Project standards**: Team conventions, best practices, domain-specific knowledge

**Example .naorules content:**

```
- Always use CTEs for complex SQL queries
- Use snake_case for all table and column names
- Include comments explaining business logic
- Prefer explicit JOINs over implicit joins
- Follow our dbt style guide for model structure
```

claude.md File

The agent can also read `claude.md` files in your repository. This works similarly to `.naorules` and provides another way to give project-specific guidelines to the agent. You can use both `.naorules` and `claude.md` files together - the agent will read and apply rules from both.

<Info>
  **Multiple Documentation Files**
  You can have multiple documentation files that the agent reads:

  * `.naorules` - Primary rules file (recommended)
  * `claude.md` - Alternative/additional rules file
  * Both files are read automatically if present in your project root
</Info>

Creating .naorules

> 1. Go on nao settings at top right
>    <img src="https://mintcdn.com/naolabs/Jdk7pfi2lni4_mb_/images/nao-ai/settings.png?fit=max&auto=format&n=Jdk7pfi2lni4_mb_&q=85&s=c93f2ff78ac8310c8bbec4e76cd7dec1" alt="nao settings" width="500" data-path="images/nao-ai/settings.png" />
> 2. Go to "Agent" section\
>    Scroll down to Chat -> Nao Rules. Click "+Add" to create .naorules at root folder
>    <img src="https://mintcdn.com/naolabs/Jdk7pfi2lni4_mb_/images/nao-ai/naorules_path.png?fit=max&auto=format&n=Jdk7pfi2lni4_mb_&q=85&s=1054b92f8df9e43f1b6a44c4bbc66518" alt="Create .naorules" width="500" data-path="images/nao-ai/naorules_path.png" />
> 3. Write in plain english your custom rules!
>    <img src="https://mintcdn.com/naolabs/Jdk7pfi2lni4_mb_/images/nao-ai/nao_rules2.png?fit=max&auto=format&n=Jdk7pfi2lni4_mb_&q=85&s=65c639a067140a29b1ba8d631fbdb4e8" alt="Write custom rules" width="500" data-path="images/nao-ai/nao_rules2.png" />

<Tip>
  **Best Practices**

  * Keep rules focused and well-organized
  * Use clear headings and sections for different rule categories
  * Include examples where helpful
  * Update rules as your standards evolve
  * Test rules by asking the agent to follow them in a conversation
</Tip>
