Skip to content

Commit cb71da7

Browse files
Merge pull request #6049 from continuedev/bdougie/markdown-first-rules
docs: markdown first rules
2 parents 3f595ec + 7f99cbc commit cb71da7

File tree

6 files changed

+92
-56
lines changed

6 files changed

+92
-56
lines changed

docs/docs/agent/how-to-customize.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ sidebar_position: 5
99

1010
Adding Rules can be done in your assistant locally or in the Hub.
1111

12-
[Explore Rules on the Hub](https://hub.continue.dev/explore/rules) and see the [Rules deep dive](../customize/deep-dives/rules.md) for more details and tips on creating rules.
12+
[Explore Rules on the Hub](https://hub.continue.dev/explore/rules) and see the [Rules deep dive](../customize/deep-dives/rules.mdx) for more details and tips on creating rules.
1313

1414
## Add MCP tools
1515

docs/docs/blocks/rules.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ Your assistant detects rule blocks and applies the specified rules while in [Age
2222

2323
## Learn More
2424

25-
Learn more in the [rules deep dive](../customize/deep-dives/rules.md), and view [`rules`](../reference.md#rules) in the YAML Reference for more details.
25+
Learn more in the [rules deep dive](../customize/deep-dives/rules.mdx), and view [`rules`](../reference.md#rules) in the YAML Reference for more details.

docs/docs/chat/how-to-customize.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ sidebar_position: 5
77

88
There are a number of different ways to customize Chat:
99

10-
- You can add a [`rules` block](../hub/blocks/block-types.md#rules) to your assistant to give the model persistent instructions through the system prompt. See the [rules deep dive](../customize/deep-dives/rules.md) for more information.
10+
- You can add a [`rules` block](../hub/blocks/block-types.md#rules) to your assistant to give the model persistent instructions through the system prompt. See the [rules deep dive](../customize/deep-dives/rules.mdx) for more information.
1111
- You can configure [`@Codebase`](../customize/deep-dives/codebase.mdx)
1212
- You can configure [`@Docs`](../customize/deep-dives/docs.mdx)
1313
- You can [build your own context provider](../customize/tutorials/build-your-own-context-provider.mdx)

docs/docs/customize/deep-dives/rules.md renamed to docs/docs/customize/deep-dives/rules.mdx

Lines changed: 87 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ description: Rules are used to provide instructions to the model for Chat, Edit,
33
keywords: [rules, .continuerules, system, prompt, message]
44
---
55

6+
import TabItem from "@theme/TabItem";
7+
import Tabs from "@theme/Tabs";
8+
69
# Rules
710

811
Rules provide instructions to the model for [Chat](../../chat/how-to-use-it.md), [Edit](../../edit/how-to-use-it.md), and [Agent](../../agent/how-to-use-it.md) requests.
@@ -23,15 +26,15 @@ To form the system message, rules are joined with new lines, in the order they a
2326
Below is a quick example of setting up a new rule file:
2427

2528
1. Create a folder called `.continue/rules` at the top level of your workspace
26-
2. Add a file called `pirates-rule.yaml` to this folder.
27-
3. Write the following contents to `pirates-rule.prompt` and save.
29+
2. Add a file called `pirates-rule.md` to this folder.
30+
3. Write the following contents to `pirates-rule.md` and save.
2831

29-
```yaml title=".continue/rules/pirates-rule.yaml"
32+
```md title=".continue/rules/pirates-rule.md"
33+
---
3034
name: Pirate rule
31-
version: 0.0.1
32-
schema: v1
33-
rules:
34-
- Talk like a pirate.
35+
---
36+
37+
- Talk like a pirate.
3538
```
3639

3740
Now test your rules by asking a question about a file in chat.
@@ -58,68 +61,101 @@ Explore available rules [here](https://hub.continue.dev/explore/rules), or [crea
5861

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

61-
- `name` (**required**): A display name/title for the rule
62-
- `rule` (**required**): The text content of the rule
63-
- `schema` (**required**): The schema version of the YAML file (e.g., `v1`)
64+
- `name` (**required** for YAML): A display name/title for the rule
6465
- `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"]`).
65-
66-
```yaml title=".config.yaml"
67-
rules:
68-
- Always annotate Python functions with their parameter and return types
69-
70-
- name: TypeScript best practices
71-
rule: Always use TypeScript interfaces to define shape of objects. Use type aliases sparingly.
72-
globs: "**/*.{ts,tsx}"
73-
74-
- name: TypeScript test patterns
75-
rule: In TypeScript tests, use Jest's describe/it pattern and follow best practices for mocking.
76-
globs:
77-
- "src/**/*.test.ts"
78-
- "tests/**/*.ts"
79-
80-
- uses: myprofile/my-mood-setter
81-
with:
82-
TONE: concise
83-
```
66+
- `alwaysApply`: true - Always include the rule, regardless of file context
67+
- `alwaysApply`: false - Only include if globs exist AND match file context
68+
- `alwaysApply`: undefined - Default behavior: include if no globs exist OR globs exist and match
69+
70+
<Tabs groupId="rules-example">
71+
<TabItem value="md" label="Markdown">
72+
```yaml title="doc-standards.md"
73+
---
74+
name: Documentation Standards
75+
globs: docs/**/*.{md,mdx}
76+
alwaysApply: false
77+
description: Standards for writing and maintaining Continue Docs
78+
---
79+
80+
# Continue Docs Standards
81+
82+
- Follow Docusaurus documentation standards
83+
- Include YAML frontmatter with title, description, and keywords
84+
- Use consistent heading hierarchy starting with h2 (##)
85+
- Include relevant Admonition components for tips, warnings, and info
86+
- Use descriptive alt text for images
87+
- Include cross-references to related documentation
88+
- Reference other docs with relative paths
89+
- Keep paragraphs concise and scannable
90+
- Use code blocks with appropriate language tags
91+
92+
````
93+
</TabItem>
94+
<TabItem value="yaml" label="YAML">
95+
96+
```yaml title="doc-standards.yaml"
97+
name: Documentation Standards
98+
globs: docs/**/*.{md,mdx}
99+
alwaysApply: false
100+
rules:
101+
- name: Documentation Standards
102+
rule: >
103+
- Follow Docusaurus documentation standards
104+
- Include YAML frontmatter with title, description, and keywords
105+
- Use consistent heading hierarchy starting with h2 (##)
106+
- Include relevant Admonition components for tips, warnings, and info
107+
- Use descriptive alt text for images
108+
- Include cross-references to related documentation
109+
- Reference other docs with relative paths
110+
- Keep paragraphs concise and scannable
111+
- Use code blocks with appropriate language tags
112+
````
113+
114+
</TabItem>
115+
116+
</Tabs>
84117
85118
### `.continue/rules` folder
86119

87120
You can create project-specific rules by adding a `.continue/rules` folder to the root of your project and adding new rule files.
88121

89-
```yaml title=".continue/rules/new-rule.yaml"
122+
```md title=".continue/rules/new-rule.md"
123+
---
90124
name: New rule
91-
version: 0.0.1
92-
schema: v1
93-
rules:
94-
- Always give concise responses
125+
---
126+
127+
Always give concise responses
95128
```
96129

97-
This is also done when selecting "Add Rule" in the Assistant settings. This will create a new folder in `.continue/rules` with a default file named `new-rule.yaml`.
130+
This is also done when selecting "Add Rule" in the Assistant settings. This will create a new folder in `.continue/rules` with a default file named `new-rule.md`.
98131

99132
### Examples
100133

101134
If you want concise answers:
102135

103-
```yaml title=".continue/rules/concise-rule.yaml"
104-
rules:
105-
- name: Always give concise answers
106-
rule: |
107-
Please provide concise answers. Don't explain obvious concepts.
108-
You can assume that I am knowledgable about most programming topics.
136+
```md title=".continue/rules/concise-rule.md"
137+
---
138+
name: Always give concise answers
139+
---
140+
141+
Please provide concise answers. Don't explain obvious concepts.
142+
You can assume that I am knowledgable about most programming topics.
109143
```
110144

111145
If you want to ensure certain practices are followed, for example in React:
112146

113-
```yaml title=".continue/rules/functional-rule.yaml"
114-
rules:
115-
- name: Always use functional components
116-
rule: |
117-
Whenever you are writing React code, make sure to
118-
- use functional components instead of class components
119-
- use hooks for state management
120-
- define an interface for your component props
121-
- use Tailwind CSS for styling
122-
- modularize components into smaller, reusable pieces
147+
```md title=".continue/rules/functional-rule.md"
148+
---
149+
name: Always use functional components
150+
---
151+
152+
Whenever you are writing React code, make sure to
153+
154+
- use functional components instead of class components
155+
- use hooks for state management
156+
- define an interface for your component props
157+
- use Tailwind CSS for styling
158+
- modularize components into smaller, reusable pieces
123159
```
124160

125161
### Chat System Message

docs/docs/hub/blocks/block-types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Learn more in the [MCP deep dive](../../customize/deep-dives/mcp.mdx), and view
3535

3636
Rules blocks are instructions that your custom AI code assistant will always keep in mind - the contents of rules are inserted into the system message for all Chat requests. [Explore rules](https://hub.continue.dev/explore/rules) on the hub.
3737

38-
Learn more in the [rules deep dive](../../customize/deep-dives/rules.md), and view [`rules`](../../reference.md#rules) in the YAML Reference for more details.
38+
Learn more in the [rules deep dive](../../customize/deep-dives/rules.mdx), and view [`rules`](../../reference.md#rules) in the YAML Reference for more details.
3939

4040
## Prompts
4141

docs/docs/reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ context:
296296

297297
List of rules that the LLM should follow. These are concatenated into the system message for
298298
all [Chat](./chat/how-to-use-it.md), [Edit](./edit/how-to-use-it.md), and [Agent](./agent/how-to-use-it.md) requests.
299-
See the [rules deep dive](./customize/deep-dives/rules.md) for details.
299+
See the [rules deep dive](./customize/deep-dives/rules.mdx) for details.
300300

301301
Explicit rules can either be simple text or an object with the following properties:
302302

0 commit comments

Comments
 (0)