> For the complete documentation index, see [llms.txt](https://docs.warp.dev/llms.txt).
> Markdown versions of each page are available by appending .md to any URL.

# Set coding best practices

Use Warp Rules to guide agents on coding style, TypeScript conventions, and documentation quality across AI-generated code.

Learn how to use Warp’s Rules to help agents follow your team’s coding conventions and documentation standards across projects.

![Setting coding best practices with rules video](https://i.ytimg.com/vi/AuM2OIvXlnY/sddefault.jpg)

* * *

## Intro

This tutorial teaches you how to create coding Rules that tell the agent your team’s **best practices**.  
  
Rules guide the agent; they don’t enforce formatting or guarantee correct code. Enforce requirements with formatters, linters, tests, permissions, and approval rules.

* * *

1.  #### The problem
    
    Developers often have different habits — formatting styles, TypeScript conventions, or comment quality.  
    Without clear rules, AI-generated code can be inconsistent or hard to maintain.
    
2.  #### The Rule setup
    
    Define Rules that guide the agent’s formatting, type choices, and documentation quality. Inspect the diff and check output to verify the result.
    
    **Example Rule**
    
    ```plaintext
    Rule: Code Authoring Standards
    - Always format and check work before returning results.
    - Prefer `types` over `interfaces` in TypeScript.
    - Apply concise, human-readable JS Docs using the Hemingway test.
    ```
    
    Note
    
    Use the **Hemingway test** to review comments for short sentences, active voice, and unnecessary complexity.
    
3.  #### Benefits
    
    -   Encourages readable, maintainable code
    -   Improves documentation clarity
    -   Helps reviewers identify style drift across AI contributions
