Files
ruflo/.roo/rules-code/code_editing.md
T
rUv 4134144018 Add comprehensive guidelines for file operations, code editing, and search/replace functionality
- Introduced detailed guidelines for `apply_diff`, `read_file`, `write_to_file`, `insert_content`, and `search_and_replace` operations to prevent common errors and ensure best practices.
- Created a new index for tool usage guidelines to facilitate easy navigation and reference.
- Established rules for preventing apply_diff errors, emphasizing the importance of avoiding literal diff markers in code examples.
- Updated `.roomodes` with new roles and instructions for various development tasks, including architecture design, coding, testing, debugging, security review, documentation, integration, and deployment monitoring.
2025-06-11 16:09:59 +00:00

869 B

Code Editing Guidelines

apply_diff

<apply_diff>
  <path>File path here</path>
  <diff>
    <<<<<<< SEARCH
    Original code
    =======
    Updated code
    >>>>>>> REPLACE
  </diff>
</apply_diff>

Required Parameters:

  • path: The file path to modify
  • diff: The diff block containing search and replace content

Common Errors to Avoid:

  • Incomplete diff blocks (missing SEARCH or REPLACE markers)
  • Including literal diff markers in code examples
  • Nesting diff blocks inside other diff blocks
  • Using incorrect diff marker syntax
  • Including backticks inside diff blocks when showing code examples

Best Practices:

  • Always verify the file exists before applying diffs
  • Ensure exact text matching for the search block
  • Use read_file first to confirm content before modifying
  • Keep diff blocks simple and focused on specific changes