# Set coding best practices

> Use Warp Rules to enforce coding style, TypeScript conventions, and documentation quality across AI-generated code.

- 网址：https://funcoding.ai/agents/warp/guides/configuration/how-to-set-coding-best-practices/
- 来源：Warp 官方文档原文（英文），MIT 许可，同步于 2026-10-11
- 官方原文：https://docs.warp.dev/guides/configuration/how-to-set-coding-best-practices/

---
Learn how to use Warp’s Rules to enforce coding style, documentation quality, and consistency across projects.

---

## Intro

This tutorial teaches you how to create coding Rules that make AI follow your team’s **best practices** automatically.\
\
By specifying formatting, style preferences, and documentation standards, Warp ensures consistent, high-quality code across your repositories.

---

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 enforce formatting, type preferences, and doc quality.

   **Example Rule**

   ```
   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.
   ```

<div class="callout callout-note">

The **Hemingway test** ensures code comments are simple and clear — short sentences, active voice, and no unnecessary complexity.

</div>

3. #### Benefits

   * Encourages readable, maintainable code
   * Improves documentation clarity
   * Prevents style drift across AI contributions
