You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Roo Code allows you to customize its behavior using custom instructions at both global and workspace levels. These instructions are added to the system prompt and influence how Roo Code responds to your requests. You can define:
3
+
Roo Code allows you to customize its behavior using custom instructions and rules at both global and workspace levels. These customizations are added to the system prompt and influence how Roo Code responds to your requests.
4
+
5
+
## Types of Customization
6
+
7
+
Roo Code offers two complementary approaches to customization:
8
+
9
+
1.**Custom Instructions**: General guidelines that shape how Roo interacts with you
10
+
2.**Custom Rules**: Structured technical guidelines for code standards and practices
11
+
12
+
| Feature | Custom Instructions | Custom Rules |
13
+
|---------|---------------------|--------------|
14
+
|**Primary Purpose**| General behavioral guidance | Specific technical guidelines |
15
+
|**Format**| Free-form text | Structured markdown format |
16
+
|**Configuration Method**| UI (Prompts Tab) or rules files | Rules files in project root |
17
+
|**Scope**| Global or workspace-specific | Global or mode-specific |
Both approaches complement each other - you can use custom instructions for general guidance and custom rules for specific technical requirements.
21
+
22
+
## Custom Instructions Configuration
23
+
24
+
You can define custom instructions at various levels:
4
25
5
26
***Global Custom Instructions:** Apply across all workspaces
6
27
***Workspace-Level Instructions:**
7
28
***Workspace-Wide:** Apply to all modes in the workspace through `.clinerules` files
8
29
***Mode-Specific:** Apply to specific modes in the workspace through files like `.clinerules-code`
9
30
10
-
## Preferred Language
31
+
###Preferred Language
11
32
12
-
You can specify a preferred language for Roo Code to use. When set, this appears at the start of your custom instructions and directs Roo Code to communicate in your chosen language. You can set this in the **Prompts** tab.
33
+
You can specify a preferred language for Roo Code to use. When set, this appears at the start of your custom instructions and directs Roo Code to communicate in your chosen language. You can set this in the **Prompts** tab. For more details on managing this and other settings, see [Managing Preferences and Settings](managing-preferences).
13
34
14
-
## Global Custom Instructions
35
+
### Setting Global Custom Instructions
15
36
16
37
These instructions apply across all workspaces. They're useful for setting preferences that you want to maintain regardless of which project you're working on.
17
38
18
39
**How to set them:**
19
40
20
-
1.**Open Prompts Tab:** Click the <Codiconname="notebook" /> icon in the Roo Code top menu bar
21
-
2.**Find Section:** Find the "Custom Instructions for All Modes" section
22
-
3.**Enter Instructions:** Enter your instructions in the text area
23
-
4.**Save Changes:** Click "Done" to save your changes
41
+
1.**Open Prompts Tab:** Click the <Codiconname="notebook" /> icon in the Roo Code top menu bar
42
+
2.**Find Section:** Find the "Custom Instructions for All Modes" section
43
+
3.**Enter Instructions:** Enter your instructions in the text area
44
+
4.**Save Changes:** Click "Done" to save your changes
24
45
25
-
## Workspace-Level Instructions
46
+
### Setting Workspace-Level Instructions
26
47
27
48
These instructions only apply within your current workspace, allowing you to customize Roo Code's behavior for specific projects.
28
49
29
-
### Workspace-Wide Instructions
50
+
####Workspace-Wide Instructions
30
51
31
52
Workspace-wide instructions are defined through rule files in your workspace root, primarily using `.clinerules`. Additional support for `.cursorrules` and `.windsurfrules` is available for editor compatibility.
32
53
33
-
### Mode-Specific Instructions
54
+
####Mode-Specific Instructions
34
55
35
56
Mode-specific instructions can be set in two independent ways that can be used simultaneously:
36
57
37
-
1.**Using the Prompts Tab:**
38
-
***Open Tab:** Click the <Codiconname="notebook" /> icon in the Roo Code top menu bar
39
-
***Select Mode:** Under the Modes heading, click the button for the mode you want to customize
40
-
***Enter Instructions:** Enter your instructions in the text area under "Mode-specific Custom Instructions (optional)"
41
-
***Save Changes:** Click "Done" to save your changes
58
+
1.**Using the Prompts Tab:**
59
+
***Open Tab:** Click the <Codiconname="notebook" /> icon in the Roo Code top menu bar
60
+
***Select Mode:** Under the Modes heading, click the button for the mode you want to customize
61
+
***Enter Instructions:** Enter your instructions in the text area under "Mode-specific Custom Instructions (optional)"
62
+
***Save Changes:** Click "Done" to save your changes
42
63
43
-
2.**Using Rule Files:** Create a `.clinerules-[mode]` file in your workspace root (e.g., `.clinerules-code`)
64
+
2.**Using Rule Files:** Create a `.clinerules-[mode]` file in your workspace root (e.g., `.clinerules-code`)
44
65
45
66
When both tab instructions and rule files are set for a mode, both sets of instructions will be included in the system prompt.
46
67
47
-
### How Instructions are Combined
68
+
## Custom Rules
69
+
70
+
Custom rules provide more structured guidelines stored in special files in your project's root directory. They tell Roo how to approach various aspects of your codebase, such as:
71
+
72
+
- Coding style and formatting preferences
73
+
- Documentation requirements
74
+
- Testing practices
75
+
- Error handling approaches
76
+
- Project-specific conventions
77
+
78
+
### Rule File Types
79
+
80
+
Roo Code supports several rule file formats:
81
+
82
+
| File Name | Purpose |
83
+
|-----------|---------|
84
+
|`.clinerules`| Primary rule file for all modes |
85
+
|`.clinerules-code`| Rules specific to Code mode |
86
+
|`.clinerules-architect`| Rules specific to Architect mode |
87
+
|`.clinerules-[mode]`| Rules for any custom mode |
88
+
|`.cursorrules`| Alternative format (compatible with Cursor AI) |
89
+
|`.windsurfrules`| Alternative format (compatible with Windsurf) |
90
+
91
+
All rule files should be placed in your project's root directory.
92
+
93
+
### Rule File Format
94
+
95
+
Rule files use a simple, markdown-based format that's easy to read and write:
96
+
97
+
```markdown
98
+
# Category Title
99
+
100
+
1. Rule Group Title:
101
+
- Specific guideline
102
+
- Another guideline
103
+
- Technical requirement
104
+
105
+
2. Another Rule Group:
106
+
- Guideline one
107
+
- Guideline two
108
+
```
109
+
110
+
This format makes rules easy to read for both humans and AI.
111
+
112
+
### Global vs. Mode-Specific Rules
113
+
114
+
Roo Code allows you to create both global rules and mode-specific rules:
115
+
116
+
-**Global Rules** (`.clinerules`) apply to all modes
117
+
-**Mode-Specific Rules** (`.clinerules-[mode]`) only apply when using that specific mode
118
+
119
+
When both exist, mode-specific rules take priority, but global rules still apply if they don't conflict.
120
+
121
+
## How Instructions and Rules are Combined
48
122
49
123
Instructions are placed in the system prompt in this exact format:
50
124
@@ -70,7 +144,9 @@ Rules:
70
144
***Source Headers:** Each rule file's contents are included with a header indicating its source
71
145
***Rule Interaction:** Mode-specific rules complement global rules rather than replacing them
72
146
73
-
## Examples of Custom Instructions
147
+
## Examples and Best Practices
148
+
149
+
### Example Custom Instructions
74
150
75
151
* "Always use spaces for indentation, with a width of 4 spaces"
76
152
* "Use camelCase for variable names"
@@ -80,4 +156,211 @@ Rules:
80
156
* "Prioritize using the most common library in the community"
81
157
* "When adding new features to websites, ensure they are responsive and accessible"
82
158
83
-
By using custom instructions, you can tailor Roo Code's behavior to match your coding style, project requirements, and personal preferences.
159
+
### Example Rule Categories
160
+
161
+
#### Code Style Rules
162
+
163
+
```markdown
164
+
# Code Style
165
+
166
+
1. Formatting:
167
+
- Use 2-space indentation for all files
168
+
- Keep line length under 100 characters
169
+
- Place opening braces on the same line
170
+
- Use trailing commas in multi-line arrays and objects
171
+
172
+
2. Naming Conventions:
173
+
- Use camelCase for variables and functions
174
+
- Use PascalCase for classes and components
175
+
- Use UPPER_SNAKE_CASE for constants
176
+
- Prefix private methods with underscore
177
+
```
178
+
179
+
#### Testing Rules
180
+
181
+
```markdown
182
+
# Testing Requirements
183
+
184
+
1. Test Coverage:
185
+
- Write tests for all new functions
186
+
- Maintain at least 80% code coverage
187
+
- Test both success and error paths
188
+
- Use descriptive test names
189
+
190
+
2. Test Structure:
191
+
- Organize tests by feature or component
192
+
- Use setup and teardown for common operations
193
+
- Mock external dependencies
194
+
- Test edge cases explicitly
195
+
```
196
+
197
+
#### Documentation Rules
198
+
199
+
```markdown
200
+
# Documentation Standards
201
+
202
+
1. Code Documentation:
203
+
- Document all public functions with JSDoc
204
+
- Explain complex algorithms with comments
205
+
- Include examples for APIs
206
+
- Document parameters and return values
207
+
208
+
2. Project Documentation:
209
+
- Keep README up-to-date
210
+
- Document setup steps
211
+
- Include troubleshooting guidance
212
+
- Add comments for non-obvious code
213
+
```
214
+
215
+
### Project-Specific Rule Examples
216
+
217
+
#### Web Development Project
218
+
219
+
```markdown
220
+
# Web Project Rules
221
+
222
+
1. Accessibility:
223
+
- Use semantic HTML elements
224
+
- Include alt text for images
225
+
- Ensure keyboard navigation works
226
+
- Maintain WCAG AA compliance
227
+
228
+
2. Performance:
229
+
- Keep bundle size under 500KB
230
+
- Optimize images before adding
231
+
- Implement code splitting
232
+
- Lazy load non-critical resources
233
+
```
234
+
235
+
#### Data Science Project
236
+
237
+
```markdown
238
+
# Data Science Rules
239
+
240
+
1. Data Management:
241
+
- Document data sources
242
+
- Version control datasets
243
+
- Include data cleaning steps
244
+
- Note missing value handling
245
+
246
+
2. Models:
247
+
- Document training parameters
248
+
- Include accuracy metrics
249
+
- Validate against test data
250
+
- Explain feature importance
251
+
```
252
+
253
+
## Best Practices for Effective Customization
254
+
255
+
### Be Specific and Clear
256
+
257
+
Vague instructions can lead to inconsistent results. Be as specific as possible:
258
+
259
+
**Good Example:**
260
+
"Use TypeScript's strict mode and provide type annotations for all function parameters and return values."
261
+
262
+
**Less Effective:**
263
+
"Make sure to use types properly."
264
+
265
+
For rules files, write clear, actionable guidelines rather than vague principles:
266
+
267
+
**Good:**
268
+
```markdown
269
+
- Validate all user inputs before processing
270
+
- Log errors with stack traces and context
271
+
- Use parameterized queries for database operations
272
+
```
273
+
274
+
**Not as helpful:**
275
+
```markdown
276
+
- Make sure code is secure
277
+
- Handle errors properly
278
+
- Be careful with databases
279
+
```
280
+
281
+
### Organize Logically
282
+
283
+
Group related rules together under clear categories:
284
+
285
+
```markdown
286
+
# Security
287
+
288
+
1. Input Validation:
289
+
- Validate all user inputs
290
+
- Sanitize data before use
291
+
- Reject unexpected values
292
+
293
+
2. Authentication:
294
+
- Require strong passwords
295
+
- Implement account lockouts
296
+
- Log authentication attempts
297
+
```
298
+
299
+
### Prioritize Important Guidelines
300
+
301
+
Put the most important instructions first, as they'll receive more attention:
302
+
303
+
```
304
+
1. Always handle errors and edge cases explicitly
305
+
2. Include JSDoc comments for all public functions
306
+
3. Follow the repository's existing code style
307
+
```
308
+
309
+
### Balance Flexibility and Constraint
310
+
311
+
Too many rigid instructions can limit Roo's ability to help, while too few may lead to inconsistent results:
312
+
313
+
**Balanced Approach:**
314
+
"Follow the existing code style in the project, but feel free to suggest improvements where patterns are unclear or could be more efficient."
315
+
316
+
### Keep Rules Updated
317
+
318
+
Review and update your rules as your project evolves:
319
+
320
+
- Remove outdated guidelines
321
+
- Add rules for new technologies
322
+
- Refine based on project learnings
323
+
324
+
## Advanced Usage
325
+
326
+
### Combining Rules with Custom Modes
327
+
328
+
For an even more tailored experience, you can:
329
+
330
+
1. Create a [custom mode](custom-modes) with specific capabilities
331
+
2. Create matching `.clinerules-[mode]` file
332
+
3. Get specialized assistance that follows your guidelines
333
+
334
+
For example, you might create a "security-auditor" mode with a `.clinerules-security-auditor` file containing security-focused rules.
335
+
336
+
### Testing Your Customizations
337
+
338
+
To verify your customizations are working:
339
+
340
+
1. Create your rule file in the project root
341
+
2. Switch to the appropriate mode if using mode-specific rules
342
+
3. Ask Roo to perform a task related to your rules
343
+
4. Check if the response follows your guidelines
344
+
345
+
For example, after adding code style rules, ask Roo to write a new function and see if it follows your specified style.
346
+
347
+
## When to Use Each Approach
348
+
349
+
Here's guidance on when to use each customization approach:
350
+
351
+
**Use Custom Instructions when:**
352
+
- Setting general preferences that apply across projects
353
+
- Specifying how Roo should communicate with you
354
+
- Providing high-level guidance on approach and methodology
355
+
- Setting simple preferences without complex formatting
356
+
357
+
**Use Custom Rules when:**
358
+
- Defining specific coding standards
359
+
- Setting project-specific technical requirements
360
+
- Creating structured, categorical guidelines
361
+
- Sharing standards across a team
362
+
- Creating mode-specific behavior
363
+
364
+
For best results, combine both approaches - use custom instructions for general guidance and custom rules for specific technical requirements.
365
+
366
+
By effectively customizing Roo Code's behavior, you can transform it into a team member who understands and follows your project's unique needs and standards.
0 commit comments