targeted-line-range-edits
Installation
SKILL.md
Targeted Line-Range Mutation Protocol (replace_file_content Precision)
Overview
When tasked with fixing a bug in an existing file (e.g., adding an error check to src/services/billing.ts), naive agents re-emit the entire 500-line file from scratch using whole-file overwrite tools (write_to_file(Overwrite: true)).
Full-file rewriting causes severe operational problems:
- Severe Token Waste: Emitting 500 lines to change 5 lines burns 3,500+ output tokens per edit turn.
- Git Merge Conflicts: Re-writing the entire file touches timestamps and trailing whitespace on 495 unchanged lines, breaking git blame and creating merge conflicts.
- Accidental Deletions: Long generation streams frequently truncate or hallucinate omissions in unchanged functions.
The Targeted Line-Range Mutation Protocol uses replace_file_content with precise [StartLine, EndLine] bounding, modifying strictly the target 5-to-10 line slice.