> ## Documentation Index
> Fetch the complete documentation index at: https://rules.so/llms.txt
> Use this file to discover all available pages before exploring further.

# Rules CLI

<Tip>
  **tl;dr:** `npm i -g rules-cli` then `rules add starter/nextjs-rules`
</Tip>

`rules` is a CLI built for managing rules across any AI IDE. Rules are markdown files that encode workflows, preferences, tech stack details, and more in plain natural language so you can get better help from LLMs.

## Install `rules`

The `rules` CLI can be installed using NPM:

```bash theme={null}
npm i -g rules-cli
```

## Add rules

To download rules to your repository you can use `rules add`. For example:

```bash theme={null}
rules add starter/nextjs-rules
```

This will add them to your project in a local `.rules` folder.

You can also download from GitHub rather than the rules registry:

```bash theme={null}
rules add gh:continuedev/awesome-rules/ruby
```

## Render rules

To use rules with your AI IDE of choice, you can "render" them to the necessary format and location using `rules render`. For example,

```bash theme={null}
rules render cursor
```

will copy all of the `.rules/` into a `.cursor/rules/` folder. `rules` currently supports the following formats:

* **continue** - `.continue/rules/*.md` (Continue Dev rules)
* **cursor** - `.cursor/rules/*.mdc` (Cursor rules)
* **windsurf** - `.windsurf/rules/*.md` (Windsurf rules)
* **claude** - `CLAUDE.md` (Claude Code single file)
* **copilot** - `.github/instructions/*.instructions.md` (GitHub Copilot instructions)
* **codex** - `AGENT.md` (Codex single file)
* **cline** - `.clinerules/*.md` (Cline rules)
* **cody** - `.sourcegraph/*.rule.md` (Sourcegraph Cody rules)
* **amp** - `AGENT.md` (Amp single file)

## Publish rules

To make your rules available to others, you can publish using `rules publish`:

```bash theme={null}
# Login
rules login

# Create a rules.json
rules init

# Create a rule
rules create

# Publish
rules publish
```

This would make your rules available to download with `rules add <name-of-rules>`.

You can use our [template repository](https://github.com/continuedev/rules-template) to automate publishing with GitHub Actions.

## Helping users use your rules

If you are building a developer tool and want to optimize how AI IDEs work with your tool, `rules` makes it easy to give your users the best experience.

1. Make your account on the [registry](https://hub.continue.dev/signup) and create an organization
2. [Publish your rules](#publish-rules)
3. Mention the corresponding `rules add <name-of-rules>` command in your documentation

### Contributing

[`rules` is open-sourced](https://github.com/continuedev/rules) under the Apache 2.0 license. If you're interested in contributing, learn more [here](https://github.com/continuedev/rules/blob/main/CONTRIBUTING.md).
