ROORULESMD(5)ROORULESMD(5)

NAME

.roo/rules/*.md — instruction file for Roo Code

SYNOPSIS

.roo/rules/

.roo/rules-{modeSlug}/

METADATA

FORMATMarkdown
FILENAME.roo/rules/*.md
CASE SENSITIVENo
TOOLRoo Code
ENCODINGUTF-8
GIT COMMITTEDYes
MAX SIZE5KB per rule file
SINCERoo Code (formerly Roo-Cline) 2025

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

├──YAML Frontmatter
Optional frontmatter with `description` (string), `alwaysApply` (boolean), and `globs` (string array). Controls when the rule activates: always, auto (glob match), or manual (explicit reference).
└──Rule BodyREQUIRED
Markdown content with coding instructions, constraints, or conventions. Injected into the AI context when the rule is active.

ANNOTATED EXAMPLE

.roo/rules/*.md
markdown
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

Gotchas
✗WRONG Putting mode-specific rules in `.roo/rules/` instead of `.roo/rules-{modeSlug}/`
✓RIGHT Use `.roo/rules-code/`, `.roo/rules-architect/`, etc. for mode-specific rules

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.

✗WRONG Expecting .clinerules/ to work with Roo Code
✓RIGHT Roo Code uses `.roo/rules/` — it does not read `.clinerules/`

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/`.

✗WRONG Creating deeply nested subdirectories inside `.roo/rules/`
✓RIGHT Rules are read from the top level of each rules directory — keep files flat

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.

USED BY

SIMILAR FILES

.roomodesRoo Code Custom Modes
.clinerules/Cline Rules & Memory Bank
.cursor/rules/*.mdcCursor Rules (MDC Format)
.trae/rules/*.mdTrae AI Rules

COMPARISONS

agentconfig.ing2026-03-16ROORULESMD(5)