# Using Your Project as Context to Set Up .dinorules

Creating effective [.dinorules](/app-help/documentation/dino-ai/dino-rules.md) from scratch can be challenging when you don't know what standards to define or how to articulate your team's existing patterns. Rather than starting with a blank file, you can analyze your current dbt™ project to identify established conventions and use those insights to build comprehensive rules.

DinoAI Agent can examine your existing models, YAML files, and project structure to automatically generate .dinorules that capture your team's actual practices.

{% embed url="<https://www.youtube.com/watch?v=UnugV57KKlE>" %}

#### Example Prompt

> Analyze my selected dbt™ project files and create a .dinorules that capture my existing SQL formatting, naming conventions, folder structure, and documentation patterns.

<figure><img src="/files/IYCgF5EceffI0rAG0xON" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
**Recommended**: Add [context](/app-help/documentation/dino-ai/context.md) by selecting multiple files that represent your best practices. include well-structured models from different folders (staging, marts), your dbt\_project.yml, and existing schema files. This gives DinoAI a comprehensive view of your standards.
{% endhint %}

### How to use

To generate a .dinorules file that matches your team standards, do the following:

1. **Open DinoAI** by clicking the DinoAI icon (🪄) in the right panel
2. **Enter prompt** - You can use the [above example](#example-prompt) or create your own
3. **Add files as context** using the "@" icon in the DinoAI panel. Select representative files from different folders.
   1. **Examples**: staging models, intermediate models, marts models, your dbt\_project.yml, and schema.yml files

### How It Works

After you enter your prompt:

1. DinoAI analyzes the structure and patterns in your selected files
2. It identifies consistent naming conventions, SQL formatting styles, and organizational patterns
3. It examines your folder structure and materialization strategies
4. It creates a [.dinorules](/app-help/documentation/dino-ai/dino-rules.md) file that codifies these discovered patterns
5. The generated rules ensure future AI-generated code matches your established standards

#### Example Output

DinoAI will generate a comprehensive .dinorules file like this:

<details>

<summary>Example .dinorules file</summary>

```
Project Context
- Domain: E-commerce analytics
- Data Stack: dbt™ with Snowflake
- Project Structure: source → staging → intermediate → marts hierarchy

SQL Formatting Standards (Based on Analyzed Files)
- Keywords: Always uppercase (SELECT, FROM, WHERE, etc.)
- Indentation: 4 spaces, no tabs
- Comma Style: Trailing commas in SELECT statements
- Aliasing: Always alias tables (use 'u' for users, 'o' for orders)
- CTEs: Prefer CTEs over subqueries for readability
- Comments: Add comments for complex business logic

Naming Conventions (Extracted from Current Models)
- Models: snake_case with prefixes (stg_, int_, dim_, fct_)
- Columns: snake_case, descriptive names
- Tables: Singular nouns (user, not users)
- Primary Keys: Always end with '_id' (user_id, order_id)

Folder Structure and Materializations
- staging/: Views only, basic transformations
- intermediate/: Views, complex business logic
- marts/: Tables or incremental, final business models
- All models tagged by domain and layer

Documentation Requirements
- All models require descriptions
- Business-critical columns need descriptions
- Primary keys need unique and not_null tests
- Foreign keys need relationships tests

Business Logic Patterns
- Always use UTC for timestamps
- Standardize null handling with COALESCE
- Use consistent date formatting (YYYY-MM-DD)
- Apply consistent rounding rules (2 decimal places for currency)

Quality Standards
- All models must compile without warnings
- Use consistent test patterns across similar model types
- Maintain referential integrity through proper testing
```

</details>

### Key Benefits

* **Consistency**: Ensures all future AI-generated code matches your existing standards
* **Discovery**: Reveals patterns you may not have consciously documented
* **Team Alignment**: Codifies implicit knowledge that experienced team members understand
* **Efficiency**: Creates comprehensive rules without starting from scratch
* **Accuracy**: Based on your actual codebase rather than generic best practices

### When to Use This

* When setting up .dinorules for the first time
* When your project has evolved organically and you want to formalize conventions
* Before major refactoring efforts to ensure consistency
* When preparing to scale your team and need documented standards


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.paradime.io/app-help/guides/paradime-101/getting-started-with-the-paradime-ide/dinoai-accelerating-your-analytics-engineering-workflow/dinoai-agent/using-.dinorules-to-tailor-your-ai-experience/using-your-project-as-context-to-set-up-.dinorules.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
