file-editing-patterns

Select file editing tools like apply_diff or write_to_file for code modifications.

2|2|Updated Jan 20, 2026
One-click install
npx skills add https://github.com/srulyt/srulys-agent-packs --skill file-editing-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: file-editing-patterns
Source: https://github.com/srulyt/srulys-agent-packs/tree/main/agent-packs/agentic-developer/.roo/skills/file-editing-patterns
Command: npx skills add https://github.com/srulyt/srulys-agent-packs --skill file-editing-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you choose the most efficient and reliable method for editing files, minimizing context window usage and preventing errors, especially when dealing with large files or making precise changes.

Core Features & Use Cases

  • Optimized Tool Selection: Guides you to use apply_diff for surgical edits or write_to_file for complete rewrites.
  • Context Minimization: Reduces token usage by favoring diff-based edits over full file rewrites.
  • Reliability: Provides best practices for diff formatting, line number accuracy, and post-edit verification.
  • Use Case: When modifying a specific function in a large codebase, this skill ensures you use apply_diff with a precise search block, rather than rewriting the entire file.

Quick Start

Use the file-editing-patterns skill to select the best editing tool for a code modification.

Frequently Asked Questions about file-editing-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What is the best way to apply surgical code changes to a large file?

The best way to apply surgical code changes is using a diff-based approach rather than a full rewrite. This targets specific lines for modification, minimizing token usage and preventing errors when altering large files.

How do I minimize context window usage when modifying code?

To minimize context window usage during code modification, favor diff-based edits over complete file rewrites. This approach sends only the changed lines instead of the entire file, significantly reducing token consumption.

When should I use a full file rewrite instead of a diff for file editing?

You should use a full file rewrite instead of a diff when making extensive modifications across the entire document. A complete rewrite is more reliable than a surgical edit when the majority of the file's content is changing.

How does diff formatting affect the reliability of file editing?

Diff formatting affects file editing reliability by requiring precise search blocks and accurate line targeting. Following best practices for diff formatting ensures modifications are applied exactly to the intended code sections.

What verification protocols should I follow after applying code modifications?

After applying code modifications, you should follow post-edit verification protocols to confirm the changes were applied accurately. This ensures the surgical edits or file rewrites match the intended code structure without errors.

Why does my file edit fail when targeting specific lines in a large codebase?

File edits fail when targeting specific lines due to inaccurate line targeting or improper diff formatting. Ensuring precise search blocks and following diff application best practices prevents these modification errors.