# Rules For AI

This page is your cheat sheet for getting AI tools to generate code that fits the Gravity architecture.

Whether you're building views, setting up routes, styling with Tailwind, or wiring API calls, these rules ensure the AI follows the same patterns used across the codebase so everything stays consistent.

### Supported AI Tools

Gravity includes pre-configured rules for multiple AI environments:

* **Cursor** → `.cursorrules`
* **Claude** → `claude.md`
* **Agents (multi-step workflows)** → `agents.md`
* **GitHub Copilot** → `copilot-instructions.md`
* **Windsurf** → `windsurf.rules`

Each file is tailored to how that tool reads instructions, but they all enforce the same core patterns.

#### Domain-Specific Rules

On top of tool-specific configs, Gravity includes **domain-specific rules** that define:

* Project structure
* Naming conventions
* Component and view patterns
* API and data-fetching patterns

These ensure that regardless of the AI tool you use, the output aligns with how Gravity is built.

#### By Architecture

**Next.js**&#x20;

* Unified rule system for frontend + backend
* Covers routing, server actions, and co-located logic

**Node.js**&#x20;

* Rules are split across:
  * Server (API, services, DB)
  * Web (React client)


---

# 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.usegravity.app/rules-for-ai.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.
