Skip to content

Update rules docs #6229

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 33 additions & 72 deletions docs/docs/customize/deep-dives/prompts.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,93 +5,54 @@ title: Prompts
Prompts are reusable instructions that can be referenced at any time during chat. They are especially useful as context for repetitive and/or complex tasks.

:::info
Visit the Hub to [explore prompts](https://hub.continue.dev/explore/prompts) or [create your own](https://hub.continue.dev/new?type=block&blockType=prompts)
Prompts were previously defined in a `.prompt` file format, but for consistency we now recommend using the same Markdown format as [rules](./rules.mdx) and adding `alwaysApply: false` to the frontmatter so that they are manually triggered.
:::

## Examples

Below are some examples to get you started.

### Security review

```text title="Security best practices review"
@open - Review these files for the following security best practices:
- Does the architecture follow security-by-design principles?
- Are there potential security vulnerabilities in the system design?
- Is sensitive data handled appropriately throughout the lifecycle?
```

### Reference best practice guides

```text title="Redux best practices review"
@https://redux.js.org/style-guide/
@currentFile
### Quick Start

Review this code for adherence to Redux best practices.
```
Below is a quick example of setting up a prompt file:

### Pull in commonly used files for tasks
1. Create a folder called `.continue/rules` at the top level of your workspace
2. Add a file called `review-prompt.md` to this folder.
3. Write the following contents to `review-prompt.md` and save.

```text title="Generate a new TypeORM entity"
@src/db/dataSource.ts @src/db/entity/SampleEntity.ts
```md title="review-prompt.md"
---
name: Redux best practices review
alwaysApply: false
---

Use these files to generate a new TypeORM entity based on the following requirements:
Review the currently open file for adherence to Redux best practices, as explained in their style guide at https://redux.js.org/style-guide/.
```

## Including Context Providers in your prompts

Many [context providers](../context-providers.mdx) can be referenced by typing "@" followed by the name of the context provider. The currently supported list is:

- `@terminal` - The contents of the terminal
- `@currentFile` - The currently active file
- `@open` - All open files
- `@os` - Information about the operating system
- `@problems` - Problems reported by the language server in the active file
- `@repo-map` - A map of files in the repository
- `@tree` - A tree view of the repository structure

Or you can directly type URLs and file paths:

- `@https://github.com/continuedev/continue` - The contents of a URL
- `@src/index.ts` - The contents of a file (VS Code only)

All references will be attached as context items, rather than injected directly inline.
Now to use this prompt, you can open Chat, type <kbd>/</kbd>, select the prompt, and type out any additional instructions you'd like to add.

## Local `.prompt` files
## Further Examples

In addition to Prompt blocks on the Hub, you can also define prompts in local `.prompt` files, located in the `.continue/prompts` folder at the top level of your workspace. This is useful for quick iteration on prompts to test them out before pushing up to the Hub.
Below are more examples to get you started. You can also visit the Hub to [explore prompts](https://hub.continue.dev/explore/prompts) or [create your own](https://hub.continue.dev/new?type=block&blockType=prompts).

### Quick Start

Below is a quick example of setting up a prompt file:

1. Create a folder called `.continue/prompts` at the top level of your workspace
2. Add a file called `test.prompt` to this folder.
3. Write the following contents to `test.prompt` and save.
### Security review

```.prompt
name: Current file prompt
description: A test prompt using the current file context provider
```md title="security-review.md"
---
name: Security best practices review
alwaysApply: false
---
@currentFile
```

Now to use this prompt, you can open Chat, type <kbd>/</kbd>, select the prompt, and add type out some additional text such as "Review the code for any issues".

### Format

The format is inspired by [HumanLoops's .prompt file](https://docs.humanloop.com/docs/prompt-file-format), with additional templating to reference files, URLs, and context providers.

:::info
The current state of this format is experimental and subject to change
:::
Review the changes in the current git diff for these security best practices:

### Preamble
- Does the architecture follow security-by-design principles?
- Are there potential security vulnerabilities in the system design?
- Is sensitive data handled appropriately throughout the lifecycle?
```

The "preamble" is everything above the `---` separator, and lets you specify model parameters. It uses YAML syntax and currently supports the following parameters:
### Pull in commonly used files for tasks

- `name` - The display title
- `description` - The description you will see in the dropdown
- `version` - Can be either "1" (for legacy prompt files) or "2" (this is the default and does not need to be set)
```md title="typeorm-entity-generator.md"
---
name: Generate a new TypeORM entity
alwaysApply: false
---

If you don't need any of these parameters, you can leave out the preamble and do not need to include the `---` separator.
Referencing `src/db/dataSource.ts` and `src/db/entity/SampleEntity.ts`, generate a new TypeORM entity based on the following requirements:
```
26 changes: 18 additions & 8 deletions docs/docs/customize/deep-dives/rules.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,25 @@ For example, you can say "Create a rule for this", and a rule will be created fo

Rules can also be added to an Assistant on the Continue Hub.

Explore available rules [here](https://hub.continue.dev/explore/rules), or [create your own](https://hub.continue.dev/new?type=block&blockType=rules) in the Hub. These blocks are defined using the [`config.yaml` syntax](../../reference.md#rules) and can also be created locally.
Explore available rules [here](https://hub.continue.dev), or [create your own](https://hub.continue.dev/new?type=block&blockType=rules) in the Hub.

### Syntax

:::info

Rules were originally defined in YAML format (demonstrated below), but we introduced Markdown for easier editing. While both are still supported, we recommend Markdown.

:::

Rules blocks can be simple text, written in YAML configuration files, or as Markdown (`.md`) files. They can have the following properties:

- `name` (**required** for YAML): A display name/title for the rule
- `globs` (optional): When files are provided as context that match this glob pattern, the rule will be included. This can be either a single pattern (e.g., `"**/*.{ts,tsx}"`) or an array of patterns (e.g., `["src/**/*.ts", "tests/**/*.ts"]`).
- `description` (optional): A description for the rule. Agents may read this description when `alwaysApply` is false to determine whether the rule should be pulled into context.
- `alwaysApply`: true - Always include the rule, regardless of file context
- `alwaysApply`: false - Included if globs exist AND match file context, or the agent decides to pull the rule into context based on it's description
- `alwaysApply`: undefined - Default behavior: include if no globs exist OR globs exist and match
- `alwaysApply`: Determines whether the rule is always included. Behavior is described below:
- `true`: Always included, regardless of file context
- `false`: Included if globs exist AND match file context, or the agent decides to pull the rule into context based on it's description
- `undefined` (default behavior): Included if no globs exist OR globs exist and match

<Tabs groupId="rules-example">
<TabItem value="md" label="Markdown">
Expand Down Expand Up @@ -96,10 +103,13 @@ Rules blocks can be simple text, written in YAML configuration files, or as Mark

```yaml title="doc-standards.yaml"
name: Documentation Standards
globs: docs/**/*.{md,mdx}
alwaysApply: false
version: 1.0.0
schema: v1

rules:
- name: Documentation Standards
globs: docs/**/*.{md,mdx}
alwaysApply: false
rule: >
- Follow Docusaurus documentation standards
- Include YAML frontmatter with title, description, and keywords
Expand Down Expand Up @@ -163,15 +173,15 @@ Whenever you are writing React code, make sure to

Continue includes a simple default system message for [Chat](../../chat/how-to-use-it.md) and [Agent](../../agent/how-to-use-it.md) requests, to help the model provide reliable codeblock formats in its output.

This can be viewed in the rules section of the toolbar (see above), or visit the source code [here](https://github.com/continuedev/continue/blob/main/core/llm/constructMessages.ts#L4)
This can be viewed in the rules section of the toolbar (see above), or in the source code [here](https://github.com/continuedev/continue/blob/main/core/llm/constructMessages.ts#L4).

Advanced users can override this system message for a specific model if needed by using `chatOptions.baseSystemMessage`. See the [`config.yaml` reference](../../reference.md#models).

### `.continuerules`

:::warning

`.contninuerules` will be deprecated in a future release. Please use the `.continue/rules` folder instead.
`.continuerules` will be deprecated in a future release. Please use the `.continue/rules` folder instead.

:::

Expand Down
Loading