|
| 1 | +# Custom Instructions |
| 2 | + |
| 3 | +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: |
| 4 | + |
| 5 | +* **Global Custom Instructions:** Apply across all workspaces |
| 6 | +* **Workspace-Level Instructions:** |
| 7 | + * **Workspace-Wide:** Apply to all modes in the workspace through `.clinerules` files |
| 8 | + * **Mode-Specific:** Apply to specific modes in the workspace through files like `.clinerules-code` |
| 9 | + |
| 10 | +## Preferred Language |
| 11 | + |
| 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. |
| 13 | + |
| 14 | +## Global Custom Instructions |
| 15 | + |
| 16 | +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 | + |
| 18 | +**How to set them:** |
| 19 | + |
| 20 | +1. **Open Prompts Tab:** Click the <Codicon name="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 |
| 24 | + |
| 25 | +## Workspace-Level Instructions |
| 26 | + |
| 27 | +These instructions only apply within your current workspace, allowing you to customize Roo Code's behavior for specific projects. |
| 28 | + |
| 29 | +### Workspace-Wide Instructions |
| 30 | + |
| 31 | +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 | + |
| 33 | +### Mode-Specific Instructions |
| 34 | + |
| 35 | +Mode-specific instructions can be set in two independent ways that can be used simultaneously: |
| 36 | + |
| 37 | +1. **Using the Prompts Tab:** |
| 38 | + * **Open Tab:** Click the <Codicon name="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 |
| 42 | + |
| 43 | +2. **Using Rule Files:** Create a `.clinerules-[mode]` file in your workspace root (e.g., `.clinerules-code`) |
| 44 | + |
| 45 | +When both tab instructions and rule files are set for a mode, both sets of instructions will be included in the system prompt. |
| 46 | + |
| 47 | +### How Instructions are Combined |
| 48 | + |
| 49 | +Instructions are placed in the system prompt in this exact format: |
| 50 | + |
| 51 | +``` |
| 52 | +==== |
| 53 | +USER'S CUSTOM INSTRUCTIONS |
| 54 | +The following additional instructions are provided by the user, and should be followed to the best of your ability without interfering with the TOOL USE guidelines. |
| 55 | +[Language Preference (if set)] |
| 56 | +[Global Instructions] |
| 57 | +[Mode-specific Instructions] |
| 58 | +
|
| 59 | +Rules: |
| 60 | +[.clinerules-{mode} rules] |
| 61 | +[.clinerules rules] |
| 62 | +[.cursorrules rules] |
| 63 | +[.windsurfrules rules] |
| 64 | +``` |
| 65 | + |
| 66 | +### About Rule Files |
| 67 | + |
| 68 | +* **File Location:** All rule files must be placed in the workspace root directory |
| 69 | +* **Empty Files:** Empty or missing rule files are silently skipped |
| 70 | +* **Source Headers:** Each rule file's contents are included with a header indicating its source |
| 71 | +* **Rule Interaction:** Mode-specific rules complement global rules rather than replacing them |
| 72 | + |
| 73 | +## Examples of Custom Instructions |
| 74 | + |
| 75 | +* "Always use spaces for indentation, with a width of 4 spaces" |
| 76 | +* "Use camelCase for variable names" |
| 77 | +* "Write unit tests for all new functions" |
| 78 | +* "Explain your reasoning before providing code" |
| 79 | +* "Focus on code readability and maintainability" |
| 80 | +* "Prioritize using the most common library in the community" |
| 81 | +* "When adding new features to websites, ensure they are responsive and accessible" |
| 82 | + |
| 83 | +By using custom instructions, you can tailor Roo Code's behavior to match your coding style, project requirements, and personal preferences. |
0 commit comments