This workflow guides you through creating new custom modes or editing existing ones
for the Roo Code Software, ensuring comprehensive understanding and cohesive implementation.
.roomodes in the workspace root directory
Workspace modes are the default target for project-specific modes and for overrides.
VS Code globalStorage custom modes settings file (location is environment-specific; open it via the product UI)
Global modes are used system-wide and are created automatically on Roo Code startup.
If the same slug exists in both global modes and workspace modes, the workspace (.roomodes) entry wins.
Both files use the same YAML schema: a top-level customModes: list of mode objects.
Mode definitions are YAML objects within customModes:. Use YAML block scalars (e.g., >-) for multi-line text fields when helpful.
If you must embed explicit newlines in a quoted string, use \n for newlines and \n\n for blank lines.
groups is required and is a YAML array. It may be empty when a mode should not have access to optional permissions.
Each groups entry may be:
- a simple string (unrestricted permission group), or
- a structured entry that restricts the permission to a subset of files (e.g., fileRegex + description for edit restrictions).
slugnameroleDefinitiongroupsdescriptionwhenToUsecustomInstructionsCanonical YAML skeleton (illustrative; keep instructions/tooling details in .roo/rules-[slug]/)
customModes:
- slug: example-mode
name: Example Mode
description: Short five-word summary
roleDefinition: >-
You are Roo Code, a [specialist type] who...
Key areas:
- Area one
- Area two
whenToUse: >-
Use this mode when...
groups:
- read
- - edit
- fileRegex: \\.(md|mdx)$
description: Documentation files only
customInstructions: >-
Optional brief glue text.
Determine User Intent
Identify whether the user wants to create a new mode or edit an existing one
User mentions a specific mode by name or slugUser references a mode directory path (e.g., .roo/rules-[mode-slug])User asks to modify, update, enhance, or fix an existing modeUser says "edit this mode" or "change this mode"User asks to create a new modeUser describes a new responsibility not covered by existing modesUser says "make a mode for" or "create a mode that"I want to make sure I understand correctly. Are you looking to create a brand new mode or modify an existing one?Create a new mode for a specific purposeEdit an existing mode to add new responsibilitiesFix issues in an existing modeEnhance an existing mode with better workflowsResolve Mode Source (Workspace vs Global)
When the user asks about a specific mode by name/slug (including phrases like "global mode"), resolve where that mode is defined
before doing broad repository searches.
Check the workspace override first by reading .roomodes.
If not present (or the user explicitly requests global scope), inspect the global custom modes settings file.
Note: its exact path is determined by the extension at runtime (do not hardcode a machine-specific path).
If the mode is workspace-scoped, read its instruction directory .roo/rules-[mode-slug]/.
If the mode entry is found in either .roomodes or the global file, proceed directly to analysis/edits without additional discovery.
Gather Requirements for New Mode
Understand what the user wants the new mode to accomplish
Ask about the mode's primary purpose and use casesIdentify what types of tasks the mode should handleDetermine what repository access and permissions the mode needsClarify any special behaviors or restrictionsWhat is the primary purpose of this new mode? What types of tasks should it handle?A mode for writing and maintaining documentationA mode for database schema design and migrationsA mode for API endpoint development and testingA mode for performance optimization and profilingDesign Mode Configuration
Create the mode definition with all required fields
Default to workspace-scoped modes unless the user explicitly requests a global mode.
User asks for a mode to be available across all workspaces, or explicitly mentions the global modes file.
User asks for a mode for this repo/project only, or wants to commit/share the mode with the repository.
Unique identifier (lowercase, hyphens allowed)Keep it short and descriptive (e.g., "api-dev", "docs-writer")Display name with optional emojiUse an emoji that represents the mode's purposeDetailed description of the mode's role and expertise
Start with "You are Roo Code, a [specialist type]..."
List specific areas of expertise
Mention key technologies or methodologies
Permission groups the mode can access
The concrete group names and any nesting structure are runtime-defined and may evolve.
Treat these as conceptual categories and map them to the closest available equivalents.
Short human-readable summary (aim ~5 words)Keep it scannable and concreteClear description for the OrchestratorExplain specific scenarios and task types
Prefer keeping substantial mode guidance in XML files within .roo/rules-[mode-slug]/.
The underlying mode system supports customInstructions, but large instruction blocks there are easier to duplicate/drift.
Use customInstructions only for brief "glue" text when needed.
Note: the underlying mode system supports a customInstructions field,
but this repository intentionally keeps detailed instructions in
.roo/rules-[mode-slug]/ XML files to avoid duplication and drift.
Implement File Restrictions
Configure appropriate file access permissions
Restrict edit access to specific file types
groups:
- read
- - edit
- fileRegex: \.(md|txt|rst)$
description: Documentation files only
- command
Use regex patterns to limit file editing scopeProvide clear descriptions for restrictionsConsider the principle of least privilegeCreate XML Instruction Files
Design structured instruction files in .roo/rules-[mode-slug]/
Main workflow and step-by-step processesGuidelines and conventionsReusable code patterns and examplesDecision criteria and guardrailsComplete workflow examplesUse semantic tag names that describe contentNest tags hierarchically for better organizationInclude code examples in CDATA sections when neededAdd comments to explain complex sectionsImmerse in Existing Mode
Fully understand the existing mode before making any changes
Locate and read the mode configuration in .roomodesWhen global scope is relevant, locate and read the global custom modes settings file and compare slugs for precedenceRead all XML instruction files in .roo/rules-[mode-slug]/Analyze the mode's current scope, permissions, and limitationsUnderstand the mode's role in the broader ecosystemWhat specific aspects of the mode would you like to change or enhance?Adjust permissions or restrictionsFix issues with current workflows or instructionsImprove the mode's roleDefinition or whenToUse descriptionEnhance XML instructions for better clarityAnalyze Change Impact
Understand how proposed changes will affect the mode
Compatibility with existing workflows
Impact on file permissions and capability access
Consistency with mode's core purpose
Integration with other modes
Role and scope: roleDefinition matches actual scope and permissions; remove scope creepOrchestrator routing: whenToUse/whenNotToUse are explicit and distinct from other modesPermissions: groups and fileRegex follow least-privilege and match instructionsInstructions hygiene: no contradictions or duplicates across XML filesNaming consistency: tag names and terminology are consistentDeprecated content: remove legacy fields (e.g., customInstructions in .roomodes)Boundaries: clear handoffs to other modes; no overlapping responsibilitiesSearch for repeated guidance and conflicting directives across filesI've analyzed the existing mode. Here's what I understand about your requested changes. Is this correct?Yes, that's exactly what I want to changeMostly correct, but let me clarify some detailsNo, I meant something differentI'd like to add additional changesPlan Modifications
Create a detailed plan for modifying the mode
Identify which files need to be modifiedDetermine if new XML instruction files are neededCheck for potential conflicts or contradictionsPlan the order of changes for minimal disruptionConsolidate overlapping instructions into a single source of truthAlign with XML best practices (semantic tags, hierarchical nesting)Standardize whenToUse/whenNotToUse language and boundariesCentralize preamble rules and autonomy calibrationTighten fileRegex to least-privilege; add clear descriptionsEnsure instructions match configured permissionsSplit overly long files; ensure 6_error_handling and 7_communication are present or updatedUpdate 5_examples.xml to reflect new workflows and refactorsInclude before/after diffs where helpful.roomodes: roleDefinition and whenToUse.roo/rules-[slug]/ XML instruction filesExamples and quick_reference sectionsSilent Self-Reflection RubricPrivately evaluate the planned changes against a 5–7 category rubric before implementationCohesion across filesPermissions and file restrictions (least privilege)Orchestrator fit (whenToUse/whenNotToUse clarity)XML structure and naming consistencyMode boundaries and handoff pointsExamples and testabilityIterate on the plan until it passes the rubric; do not expose the rubric to the userImplement Changes
Apply the planned modifications to the mode
Update .roomodes configuration if neededModify existing XML instruction filesCreate new XML instruction files if requiredUpdate examples and documentationRemove duplicate or contradictory instruction blocks across XML filesDelete or migrate deprecated fields (e.g., customInstructions in .roomodes)Tighten fileRegex patterns and add clear descriptionsNormalize tag names, terminology, and structureEnsure whenToUse/whenNotToUse and handoff rules are explicitValidate file restriction patterns against the intended file setsConfirm permissions match instruction expectationsRe-run validation (section 5) and testing (section 6)Scan the repository for legacy references and remove/modernize as neededValidate Cohesion and Consistency
Ensure all changes are cohesive and don't contradict each other
Mode slug follows naming conventionsFile restrictions align with mode purpose (least privilege)Permissions are appropriatewhenToUse clearly differentiates from other modesAll XML files follow consistent structureNo contradicting instructions between files; contradiction hierarchy and resolutions documentedExamples align with stated workflowsInstructions match granted permissions and file restrictionsMode integrates well with OrchestratorClear boundaries with other modesHandoff points are well-definedI've completed the validation checks. Would you like me to review any specific aspect in more detail?Review the file permission patternsCheck for workflow contradictionsVerify integration with other modesEverything looks good, proceed to testingTest and Refine
Verify the mode works as intended
Mode appears in the mode listFile restrictions work correctlyInstructions are clear and actionableMode integrates well with OrchestratorAll examples are accurate and helpfulChanges don't break existing functionality (for edits)New behavior works as expectedCreate mode in .roomodes for project-specific modesCreate mode in the global custom modes settings file for system-wide modes (path is environment-specific)Verify the .roo folder structure contains expected rule directories and XML filesValidate file regex patterns against the intended file sets (avoid overbroad matches)Find existing mode implementations and patterns to reuseRead all XML files in a mode directory to understand its structureAlways validate changes for cohesion and consistency