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
Copy file name to clipboardExpand all lines: docs/features/code-actions.md
+28-5Lines changed: 28 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Code Actions
2
2
3
-
Code Actions are a powerful feature of VS Code that provide quick fixes, refactorings, and other code-related suggestions directly within the editor. Roo Code integrates with this system to offer AI-powered assistance for common coding tasks.
3
+
Code Actions provide instant access to Roo Code's AI assistance directly within your code editor through VSCode's lightbulb (quick fix) system. This context-aware feature automatically detects relevant code situations and offers appropriate AI-powered actions without requiring you to switch to the chat interface.
4
4
5
5
---
6
6
@@ -29,10 +29,17 @@ Roo Code provides 5 code actions, though their availability varies by context:
29
29
***Fix Code:** Available through the lightbulb menu and command palette (but not the right-click menu). Asks Roo Code to fix problems in the selected code.
30
30
***New Task:** Creates a new task with the selected code. Available through the command palette.
31
31
32
-
### Conditional Display Logic
33
-
The lightbulb menu shows different actions based on context:
34
-
-**When diagnostics (errors/warnings) are present:** Only "Add to Context" and "Fix Code" appear
35
-
-**When no diagnostics are present:** "Add to Context", "Explain Code", and "Improve Code" are shown
32
+
### Context-Aware Actions
33
+
The lightbulb menu intelligently shows different actions based on your code's current state:
34
+
35
+
**For Code with Problems** (when VSCode shows red/yellow squiggles):
36
+
-**Fix Code** - Get step-by-step guidance to resolve the specific error or warning
37
+
-**Add to Context** - Add the problematic code to Roo's context for discussion
38
+
39
+
**For Clean Code** (no diagnostics):
40
+
-**Explain Code** - Get detailed explanations of what the code does
41
+
-**Improve Code** - Receive optimization suggestions and best practices
42
+
-**Add to Context** - Add the code to Roo's context for further work
36
43
37
44
### Add to Context Deep Dive
38
45
@@ -92,6 +99,22 @@ These actions are available when you select text in the terminal and right-click
92
99
93
100
---
94
101
102
+
## Disabling/Enabling Code Actions
103
+
104
+
You can control Code Actions through VSCode settings:
-**Description**: Controls whether Roo Code quick fix options appear in the editor
110
+
111
+
To access this setting:
112
+
1. Open VSCode Settings (`Ctrl/Cmd + ,`)
113
+
2. Search for "enableCodeActions"
114
+
3. Toggle the checkbox to enable or disable
115
+
116
+
---
117
+
95
118
## Customizing Code Action Prompts
96
119
97
120
You can customize the prompts used for each Code Action by modifying the "Support Prompts" in the **Prompts** tab. This allows you to fine-tune the instructions given to the AI model and tailor the responses to your specific needs.
Copy file name to clipboardExpand all lines: docs/features/custom-instructions.md
+126-7Lines changed: 126 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,9 +3,13 @@
3
3
Custom Instructions allow you to personalize how Roo behaves, providing specific guidance that shapes responses, coding style, and decision-making processes.
4
4
5
5
:::info Instruction File Locations
6
-
You can provide custom instructions using dedicated files or directories within your workspace. This allows for better organization and version control.
6
+
You can provide custom instructions using global rules (applied across all projects), workspace rules (project-specific), or through the Prompts tab interface.
7
7
8
-
**Workspace-Wide Instructions:** Apply to all modes in the project.
8
+
**Global Rules Directory:** Apply to all projects automatically.
9
+
***Linux/macOS:**`~/.roo/rules/` and `~/.roo/rules-{modeSlug}/`
10
+
***Windows:**`%USERPROFILE%\.roo\rules\` and `%USERPROFILE%\.roo\rules-{modeSlug}\`
11
+
12
+
**Workspace Rules:** Apply only to the current project, can override global rules.
9
13
***Preferred Method: Directory (`.roo/rules/`)**
10
14
```
11
15
.
@@ -38,7 +42,8 @@ You can provide custom instructions using dedicated files or directories within
38
42
├── .roorules-code # Rules for "code" mode (single file)
39
43
└── ... (other project files)
40
44
```
41
-
The directory methods take precedence if they exist and contain files. See [Workspace-Level Instructions](#workspace-level-instructions) and [Mode-Specific Instructions](#mode-specific-instructions) for details.
45
+
46
+
Rules are loaded in order: Global rules first, then workspace rules (which can override global rules). See [Global Rules Directory](#global-rules-directory) for details.
42
47
:::
43
48
44
49
---
@@ -63,6 +68,108 @@ These instructions apply across all workspaces and maintain your preferences reg
63
68
3. **Enter Instructions:** Enter your instructions in the text area
64
69
4. **Save Changes:** Click "Done" to save your changes
65
70
71
+
### Global Rules Directory
72
+
73
+
The Global Rules Directory feature provides reusable rules and custom instructions that automatically apply across all your projects. This system supports both global configurations and project-specific overrides.
74
+
75
+
#### Key Benefits
76
+
77
+
**Without Global Rules**: You had to maintain separate rule files in each project:
78
+
- Copy the same rules to every new project
79
+
- Update rules manually across multiple projects
80
+
- No consistency between projects
81
+
82
+
**With Global Rules**: Create rules once and use them everywhere:
83
+
- Set up your preferred coding standards globally
84
+
- Override specific rules per project when needed
85
+
- Maintain consistency across all your work
86
+
- Easy to update rules for all projects at once
87
+
88
+
#### Directory Structure
89
+
90
+
The global rules directory location is fixed and cannot be customized:
91
+
92
+
**Linux/macOS:**
93
+
```
94
+
~/.roo/ # Your global Roo configuration
95
+
├── rules/ # General rules applied to all projects
96
+
│ ├── coding-standards.md
97
+
│ ├── formatting-rules.md
98
+
│ └── security-guidelines.md
99
+
├── rules-code/ # Rules specific to Code mode
100
+
│ ├── typescript-rules.md
101
+
│ └── testing-requirements.md
102
+
├── rules-docs-extractor/ # Rules for documentation extraction
103
+
│ └── documentation-style.md
104
+
└── rules-{mode}/ # Rules for other specific modes
105
+
└── mode-specific-rules.md
106
+
```
107
+
108
+
**Windows:**
109
+
```
110
+
%USERPROFILE%\.roo\ # Your global Roo configuration
111
+
├── rules\ # General rules applied to all projects
112
+
│ ├── coding-standards.md
113
+
│ ├── formatting-rules.md
114
+
│ └── security-guidelines.md
115
+
├── rules-code\ # Rules specific to Code mode
116
+
│ ├── typescript-rules.md
117
+
│ └── testing-requirements.md
118
+
└── rules-{mode}\ # Rules for other specific modes
119
+
└── mode-specific-rules.md
120
+
```
121
+
122
+
#### Setting Up Global Rules
123
+
124
+
1. **Create Global Rules Directory:**
125
+
```bash
126
+
# Linux/macOS
127
+
mkdir -p ~/.roo/rules
128
+
129
+
# Windows
130
+
mkdir %USERPROFILE%\.roo\rules
131
+
```
132
+
133
+
2.**Add General Rules** (`~/.roo/rules/coding-standards.md`):
2. Prefer interfaces over type aliases for object shapes
149
+
3. Always specify return types for functions
150
+
```
151
+
152
+
#### Available Rule Directories
153
+
154
+
| Directory | Purpose |
155
+
|-----------|---------|
156
+
|`rules/`| General rules applied to all modes |
157
+
|`rules-code/`| Rules specific to Code mode |
158
+
|`rules-docs-extractor/`| Rules for documentation extraction |
159
+
|`rules-architect/`| Rules for system architecture tasks |
160
+
|`rules-debug/`| Rules for debugging workflows |
161
+
|`rules-{mode}/`| Rules for any custom mode |
162
+
163
+
#### Rule Loading Order
164
+
165
+
Rules are loaded in this order:
166
+
167
+
1.**Global Rules** (from `~/.roo/`)
168
+
2.**Project Rules** (from `project/.roo/`) - can override global rules
169
+
3.**Legacy Files** (`.roorules`, `.clinerules` - for backward compatibility)
170
+
171
+
Within each level, mode-specific rules are loaded before general rules.
172
+
66
173
### Workspace-Level Instructions
67
174
68
175
These instructions only apply within your current workspace, allowing you to customize Roo Code's behavior for specific projects.
@@ -104,7 +211,7 @@ Mode-specific instructions can be set in two independent ways that can be used s
104
211
* If `.roo/rules-{modeSlug}/` doesn't exist or is empty, Roo Code looks for a single `.roorules-{modeSlug}` file (e.g., `.roorules-code`) in the workspace root.
105
212
* If found, its content is loaded for that mode.
106
213
107
-
Instructions from the Prompts tab, the mode-specific directory/file, and the workspace-wide directory/file are all combined. See the section below for the exact order.
214
+
Instructions from the Prompts tab, global rules, workspace rules, and mode-specific rules are all combined. See the section below for the exact order.
108
215
109
216
---
110
217
@@ -124,6 +231,10 @@ The following additional instructions are provided by the user, and should be fo
124
231
125
232
[Mode-specific Instructions (from Prompts Tab for the current mode)]
126
233
234
+
Global Rules (from ~/.roo/):
235
+
[Contents of files in ~/.roo/rules-{modeSlug}/ (if directory exists and is not empty)]
236
+
[Contents of files in ~/.roo/rules/ (if directory exists and is not empty)]
*Note: The exact order ensures that more specific instructions (mode-level) appear before more general ones (workspace-wide), and directory-based rules take precedence over file-based fallbacks within each level.*
249
+
*Note: Global rules load first, followed by workspace rules that can override them. Mode-specific rules appear before general rules within each level, and directory-based rules take precedence over file-based fallbacks.*
* "Prioritize using the most common library in the community"
159
270
* "When adding new features to websites, ensure they are responsive and accessible"
160
271
161
-
:::tip Pro Tip: File-Based Team Standards
162
-
When working in team environments, using the `.roo/rules/` directory structure (and potentially `.roo/rules-{modeSlug}/` directories for specific modes) under version control is the recommended way to standardize Roo's behavior across your team. This allows for better organization of multiple instruction files and ensures consistent code style, documentation practices, and development workflows. The older `.roorules` file method can still be used but offers less flexibility.
272
+
:::tip Pro Tip: Team Standardization
273
+
For team environments, consider these approaches:
274
+
275
+
**Project Standards**: Use workspace `.roo/rules/` directories under version control to standardize Roo's behavior for specific projects. This ensures consistent code style and development workflows across team members.
276
+
277
+
**Organization Standards**: Use global rules (`~/.roo/rules/`) to establish organization-wide coding standards that apply to all projects. Team members can set up identical global rules for consistency across all work.
278
+
279
+
**Hybrid Approach**: Combine global rules for organization standards with project-specific workspace rules for project-specific requirements. Workspace rules can override global rules when needed.
280
+
281
+
The directory-based approach offers better organization than single `.roorules` files and supports both global and project-level customization.
0 commit comments