5_complete_mode_examples.xml 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <complete_examples>
  2. <example name="mode_editing_enhancement">
  3. <scenario>
  4. Edit the test mode to add support for performance testing and benchmarking
  5. </scenario>
  6. <user_request>
  7. I want to edit the test mode to add benchmark testing capabilities
  8. </user_request>
  9. <workflow>
  10. <step number="1">
  11. <description>Determine user intent and clarify scope</description>
  12. <tool_use><![CDATA[
  13. <ask_followup_question>
  14. <question>I understand you want to edit the test mode to add performance testing capabilities. Before we proceed, let me confirm the scope of changes. What specific performance testing features do you need?</question>
  15. <follow_up>
  16. <suggest>Add benchmark testing with Vitest's bench API</suggest>
  17. <suggest>Include performance profiling and memory usage tracking</suggest>
  18. <suggest>Add load testing capabilities for API endpoints</suggest>
  19. <suggest>All of the above - comprehensive performance testing suite</suggest>
  20. </follow_up>
  21. </ask_followup_question>
  22. ]]></tool_use>
  23. <expected_outcome>User selected: Add benchmark testing with Vitest's bench API</expected_outcome>
  24. </step>
  25. <step number="2">
  26. <description>Immerse in existing test mode configuration</description>
  27. <tool_use><![CDATA[
  28. <read_file>
  29. <path>.roomodes</path>
  30. </read_file>
  31. ]]></tool_use>
  32. <analysis>Found test mode configuration with current roleDefinition and file restrictions</analysis>
  33. </step>
  34. <step number="3">
  35. <description>Explore existing test mode instructions</description>
  36. <tool_use><![CDATA[
  37. <list_files>
  38. <path>.roo/rules-test</path>
  39. <recursive>true</recursive>
  40. </list_files>
  41. ]]></tool_use>
  42. <tool_use><![CDATA[
  43. <read_file>
  44. <path>.roo/rules-test/1_workflow.xml</path>
  45. </read_file>
  46. ]]></tool_use>
  47. <analysis>Understood current test workflows and patterns</analysis>
  48. </step>
  49. <step number="4">
  50. <description>Validate changes for cohesion</description>
  51. <tool_use><![CDATA[
  52. <ask_followup_question>
  53. <question>I've analyzed the test mode. Adding benchmark testing would require:
  54. 1. Updating the roleDefinition to include performance testing expertise
  55. 2. Modifying file restrictions to include .bench.ts files
  56. 3. Adding new workflow instructions for benchmark creation
  57. 4. Including Vitest bench API examples
  58. This aligns well with the existing testing focus. Should I proceed with all these changes?</question>
  59. <follow_up>
  60. <suggest>Yes, implement all the changes as described</suggest>
  61. <suggest>Start with just the roleDefinition and file restrictions</suggest>
  62. <suggest>Focus only on the workflow instructions first</suggest>
  63. <suggest>Let me review the specific changes before proceeding</suggest>
  64. </follow_up>
  65. </ask_followup_question>
  66. ]]></tool_use>
  67. <expected_outcome>User selected: Yes, implement all the changes as described</expected_outcome>
  68. </step>
  69. <step number="5">
  70. <description>Update mode configuration in .roomodes</description>
  71. <tool_use><![CDATA[
  72. <apply_diff>
  73. <path>.roomodes</path>
  74. <diff>
  75. <<<<<<< SEARCH
  76. roleDefinition: |-
  77. You are Roo, a Vitest testing specialist with deep expertise in: - Writing and maintaining Vitest test suites - Test-driven development (TDD) practices - Mocking and stubbing with Vitest - Integration testing strategies - TypeScript testing patterns - Code coverage analysis - Test performance optimization
  78. =======
  79. roleDefinition: |-
  80. You are Roo, a Vitest testing specialist with deep expertise in: - Writing and maintaining Vitest test suites - Test-driven development (TDD) practices - Mocking and stubbing with Vitest - Integration testing strategies - TypeScript testing patterns - Code coverage analysis - Test performance optimization - Benchmark testing with Vitest bench API - Performance profiling and optimization - Memory usage analysis in tests
  81. >>>>>>> REPLACE
  82. </diff>
  83. </apply_diff>
  84. ]]></tool_use>
  85. </step>
  86. <step number="6">
  87. <description>Update file restrictions to include benchmark files</description>
  88. <tool_use><![CDATA[
  89. <apply_diff>
  90. <path>.roomodes</path>
  91. <diff>
  92. <<<<<<< SEARCH
  93. - fileRegex: (__tests__/.*|__mocks__/.*|\.test\.(ts|tsx|js|jsx)$|\.spec\.(ts|tsx|js|jsx)$|/test/.*|vitest\.config\.(js|ts)$|vitest\.setup\.(js|ts)$)
  94. description: Test files, mocks, and Vitest configuration
  95. =======
  96. - fileRegex: (__tests__/.*|__mocks__/.*|\.test\.(ts|tsx|js|jsx)$|\.spec\.(ts|tsx|js|jsx)$|\.bench\.(ts|tsx|js|jsx)$|/test/.*|vitest\.config\.(js|ts)$|vitest\.setup\.(js|ts)$)
  97. description: Test files, benchmarks, mocks, and Vitest configuration
  98. >>>>>>> REPLACE
  99. </diff>
  100. </apply_diff>
  101. ]]></tool_use>
  102. </step>
  103. <step number="7">
  104. <description>Create new benchmark workflow instructions</description>
  105. <tool_use><![CDATA[
  106. <write_to_file>
  107. <path>.roo/rules-test/5_benchmark_testing.xml</path>
  108. <content>
  109. <benchmark_testing_guide>
  110. <overview>
  111. Guidelines for creating and maintaining performance benchmarks using Vitest bench API
  112. </overview>
  113. <benchmark_patterns>
  114. <pattern name="basic_benchmark">
  115. <description>Basic benchmark structure</description>
  116. <example><![CDATA[
  117. import { bench, describe } from 'vitest';
  118. describe('Array operations', () => {
  119. bench('Array.push', () => {
  120. const arr = [];
  121. for (let i = 0; i < 1000; i++) {
  122. arr.push(i);
  123. }
  124. });
  125. bench('Array spread', () => {
  126. let arr = [];
  127. for (let i = 0; i < 1000; i++) {
  128. arr = [...arr, i];
  129. }
  130. });
  131. });
  132. ]]></example>
  133. </pattern>
  134. </benchmark_patterns>
  135. <best_practices>
  136. <practice>Use meaningful benchmark names that describe what's being measured</practice>
  137. <practice>Include baseline comparisons when optimizing code</practice>
  138. <practice>Run benchmarks in isolation to avoid interference</practice>
  139. <practice>Document performance expectations and thresholds</practice>
  140. </best_practices>
  141. </benchmark_testing_guide>
  142. </content>
  143. <line_count>38</line_count>
  144. </write_to_file>
  145. ]]></tool_use>
  146. </step>
  147. <step number="8">
  148. <description>Validate all changes for consistency</description>
  149. <tool_use><![CDATA[
  150. <ask_followup_question>
  151. <question>I've completed all the changes to add benchmark testing capabilities to the test mode:
  152. 1. ✓ Updated roleDefinition to include benchmark expertise
  153. 2. ✓ Modified file restrictions to include .bench.ts files
  154. 3. ✓ Created new benchmark workflow instructions
  155. 4. ✓ Added Vitest bench API examples
  156. All changes are cohesive and align with the existing test mode structure. Would you like me to test any specific aspect of these changes?</question>
  157. <follow_up>
  158. <suggest>Test creating a new benchmark file to verify file permissions</suggest>
  159. <suggest>Review the complete changes one more time</suggest>
  160. <suggest>Everything looks good, the mode is ready</suggest>
  161. <suggest>Create a simple benchmark example to test</suggest>
  162. </follow_up>
  163. </ask_followup_question>
  164. ]]></tool_use>
  165. </step>
  166. </workflow>
  167. <completion><![CDATA[
  168. <attempt_completion>
  169. <result>
  170. I've successfully enhanced the test mode with benchmark testing capabilities:
  171. 1. Updated the roleDefinition to include:
  172. - Benchmark testing with Vitest bench API
  173. - Performance profiling and optimization
  174. - Memory usage analysis in tests
  175. 2. Modified file restrictions to include .bench.ts files, allowing the mode to create and edit benchmark files
  176. 3. Created new workflow instructions at .roo/rules-test/5_benchmark_testing.xml with:
  177. - Basic benchmark patterns
  178. - Best practices for performance testing
  179. - Example code using Vitest's bench API
  180. All changes have been validated for cohesion and consistency with the existing test mode structure. The mode now supports comprehensive performance testing alongside its existing unit and integration testing capabilities.
  181. </result>
  182. </attempt_completion>
  183. ]]></completion>
  184. <key_takeaways>
  185. <takeaway>Always immerse yourself in the existing mode before making changes</takeaway>
  186. <takeaway>Use ask_followup_question aggressively to clarify scope and validate changes</takeaway>
  187. <takeaway>Validate all changes for cohesion and consistency</takeaway>
  188. <takeaway>Update all relevant parts: configuration, file restrictions, and instructions</takeaway>
  189. <takeaway>Test changes to ensure they work as expected</takeaway>
  190. </key_takeaways>
  191. </example>
  192. </complete_examples>