← ClaudeAtlas

uniform-eollisted

Use when a small edit produces a diffstat near the file's whole line count, or before writing a file with write_text on Windows. A uniform EOL conversion is invisible to a mixed-endings guard.
MrBinnacle/skills · ★ 0 · AI & Automation · score 68
Install: claude install-skill MrBinnacle/skills
# A uniform EOL rewrite hides the change and passes the mixed-EOL guard ## Problem A script makes five targeted edits to a document. The commit reports 810 insertions and 788 deletions on a 788-line file. Nothing is wrong with the edits. The write converted every line ending from LF to CRLF, so git sees every line as changed. Two costs, and the second is worse than the first. The file's line endings are now wrong. And the five real edits are invisible — no reviewer can find them inside a whole-file diff, so the change ships unreviewed while looking reviewed. ## Context / Trigger conditions - A diffstat's insertions and deletions are each near the file's total line count, after an edit you know touched a handful of lines. - A Python script wrote the file with `pathlib.Path.write_text(s)` or `open(path, "w").write(s)`. Both default to `newline=None`, which on write translates every `\n` to `os.linesep` — `\r\n` on Windows. Reading with `read_text()` does the reverse, so a read-modify-write round trip converts a whole file with no error and no warning. - The repository stores LF, which is the common case, so the conversion is total rather than partial. - A mixed-EOL guard is installed and did not fire. - The write went into a sibling repository by absolute path, and the hook is scoped to the session's own project directory. ## Solution **Write bytes, not text, whenever you are rewriting an existing file.** ```python # Wrong on Windows: read_text/write_text round trip con