> ## 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 Library

> Collection of .naorules examples and templates to customize your nao agent

## Rules Library

The Rules Library provides examples and templates for creating `.naorules` files to customize your nao agent's behavior. Use these as starting points and adapt them to your team's needs.

## SQL Style Rules

### Standard SQL Formatting

```
- Always use CTEs for complex queries
- Use snake_case for all table and column names
- Include comments explaining business logic
- Prefer explicit JOINs over implicit joins
- Use meaningful aliases for tables
```

### dbt-Specific Rules

```
- Follow dbt style guide for model structure
- Always include model documentation
- Use ref() instead of direct table references
- Group related models in the same folder
- Include tests for critical models
```

## Code Style Rules

### Python Style

```
- Follow PEP 8 style guide
- Use type hints for function parameters
- Include docstrings for all functions
- Maximum line length: 100 characters
```

### General Code Rules

```
- Write self-documenting code
- Keep functions focused and small
- Use descriptive variable names
- Comment complex business logic
```

## Team-Specific Rules

### Documentation Standards

```
- Always include README.md in new projects
- Document all environment variables
- Keep changelog updated
- Write clear commit messages
```

### Workflow Rules

```
- Create feature branches for all changes
- Run tests before committing
- Review code before merging
- Update documentation with code changes
```

## Domain-Specific Rules

### Data Quality Rules

```
- Always validate data types
- Check for null values in critical columns
- Include data quality tests in dbt models
- Document data sources and transformations
```

### Analytics Rules

```
- Use consistent metric definitions
- Document calculation methods
- Include time zone information in date fields
- Validate results against known benchmarks
```

## Getting Started

1. Copy a template that matches your needs
2. Customize it for your team's standards
3. Save it as `.naorules` in your project root
4. The agent will automatically use these rules

<Tip>
  **Best Practices**

  * Start with a few key rules and expand over time
  * Review and update rules regularly
  * Share rules with your team for consistency
  * Test rules by asking the agent to follow them
</Tip>
