diff --git a/.roo/rules-mode-writer/5_complete_mode_examples.xml b/.roo/rules-mode-writer/5_complete_mode_examples.xml new file mode 100644 index 0000000000..31e54859e2 --- /dev/null +++ b/.roo/rules-mode-writer/5_complete_mode_examples.xml @@ -0,0 +1,91 @@ + + + Canonical examples for creating and editing Roo Code modes. Each example demonstrates structured workflows, least-privilege configuration, contradiction resolution, and completion formatting, without referencing runtime implementation details. + + + + + Edit the Test mode to add benchmark testing and performance guidance using Vitest's bench API. + + + I want to edit the test mode to add benchmark testing support. + + + + Clarify scope and features + + Ask the user a focused clarifying question to confirm which scope/features to include; provide 2–4 actionable options. Outcome: selected scope. + + User selects: Add benchmark testing with Vitest bench API + + + + Immerse in current mode config and instructions + + Review .roomodes, inventory .roo/rules-test recursively, and review .roo/rules-test/1_workflow.xml. Outcome: confirm roleDefinition, file restrictions, and existing workflows. + + Confirm roleDefinition, file restrictions, and existing workflows. + + + + Update roleDefinition in .roomodes + + Edit .roomodes to update the roleDefinition, adding benchmark testing and performance guidance topics. Outcome: roleDefinition updated to include performance/bench themes. + + + + + Extend file restrictions to include .bench files + + Edit .roomodes to extend the fileRegex to include .bench.(ts|tsx|js|jsx) and update the description accordingly. Outcome: file restrictions now cover benchmark files. + + + + + Create benchmark guidance file + + Create a new file at .roo/rules-test/5_benchmark_testing.xml with guidance and examples. Outcome: new guidance file available to the mode. + + + + Guidelines for performance benchmarks using Vitest bench API + + + Basic structure + +import { bench, describe } from 'vitest'; + + +describe('Array operations', () => { + bench('Array.push', () => { + const arr: number[] = []; + for (let i = 0; i < 1000; i++) arr.push(i); + }); + + bench('Array spread', () => { + let arr: number[] = []; + for (let i = 0; i < 1000; i++) arr = [...arr, i]; + }); +}); + + + + + Use meaningful names and isolate benchmarks + Document expectations and thresholds + + + + + + + + Provide a concise summary of what was accomplished and how it addresses the user's request. + + + + Important lesson from this example + Pattern that can be reused + + +