NAME
.roo/rules/*.md — instruction file for Roo Code
SYNOPSIS
.roo/rules/
.roo/rules-{modeSlug}/
METADATA
DESCRIPTION
`.roo/rules/*.md` are Markdown instruction files for Roo Code (formerly Roo-Cline), a VS Code AI coding extension. Rules use optional YAML frontmatter for activation control: `alwaysApply: true` (always loaded), glob patterns (auto-loaded when matching files are in context), or manual (only when explicitly referenced).
Roo Code's distinctive feature is mode-specific rule directories. Beyond the global `.roo/rules/` directory, each mode gets its own rules directory: `.roo/rules-code/`, `.roo/rules-architect/`, `.roo/rules-ask/`, `.roo/rules-debug/`, and directories for any custom modes defined in `.roomodes`. This allows different instruction sets for different AI personas.
The frontmatter schema matches the pattern used by Cursor rules and Trae rules — `description`, `alwaysApply`, and `globs` — making migration between tools straightforward.
STRUCTURE
ANNOTATED EXAMPLE
1---
2description: "General coding standards"
3alwaysApply: true
4---
5
6# Coding Standards
7
8- TypeScript strict mode — no `any`
9- Named exports only
10- Prefer composition over inheritance
11- Error handling with custom error classes
12
13---
14
15## Example: Auto-activated rule (.roo/rules/react.md)
16
17```markdown
18---
19description: "React component conventions"
20alwaysApply: false
21globs:
22 - "src/components/**/*.tsx"
23---
24
25# React Rules
26- Functional components only
27- Props interfaces, not types
28- Use React.memo for list items
29```
30
31---
32
33## Example: Mode-specific rule (.roo/rules-architect/design.md)
34
35```markdown
36---
37description: "Architecture review guidelines"
38alwaysApply: true
39---
40
41# Architecture Mode Rules
42- Propose changes as diagrams before implementation
43- Consider scalability and maintainability
44- Document decisions in ADR format
45```
COMMON MISTAKES
Rules in `.roo/rules/` are global and apply to all modes. To restrict a rule to a specific mode (Code, Architect, Ask, Debug, or custom), place it in the corresponding `.roo/rules-{modeSlug}/` directory.
Although Roo Code is forked from Cline, it uses its own `.roo/` directory structure. Cline's `.clinerules/` directory is not read by Roo Code. If migrating from Cline, move rule files to `.roo/rules/`.
Roo Code scans for .md files at the top level of `.roo/rules/` and `.roo/rules-{modeSlug}/` directories. Subdirectories within these are not recursively scanned.