git-line-endings

git-line-endings is a skill for Claude Code, Codex from AmineDjeghri/personal-os-setup. It costs 20 tokens per session (918 once invoked), scanned A, original, MIT.

A guide to finding and fixing inconsistent line endings in Git files. Line endings are the invisible characters that mark the end of each text line, and Windows and Unix-like systems commonly use different ones.

In plain words
What is it for?
Use it to diagnose CRLF and LF problems, configure .gitattributes, and normalise existing files in a repository.
Why use it?
It prevents a small edit from making an entire file appear changed in a Git difference.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions AGENTS.md.

Good fit Use it to diagnose CRLF and LF problems, configure .gitattributes, and normalise existing files in a repository.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/aminedjeghri/personal-os-setup/git-line-endings
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add AmineDjeghri/personal-os-setup --skill git-line-endings
Clone the repo
git clone --depth 1 https://github.com/AmineDjeghri/personal-os-setup

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for git-line-endings

README.md
[![agentmods](https://agentmods.dev/badge/skills/aminedjeghri/personal-os-setup/git-line-endings/github.svg)](https://agentmods.dev/skills/aminedjeghri/personal-os-setup/git-line-endings)
Your own site
<a href="https://agentmods.dev/skills/aminedjeghri/personal-os-setup/git-line-endings"><img src="https://agentmods.dev/badge/skills/aminedjeghri/personal-os-setup/git-line-endings/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for git-line-endings

Your own site · 80×15
<a href="https://agentmods.dev/skills/aminedjeghri/personal-os-setup/git-line-endings"><img src="https://agentmods.dev/badge/skills/aminedjeghri/personal-os-setup/git-line-endings.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 20 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 918 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00020 $0.00918
Opus 5.5 $0.00008 $0.00367
Sonnet 5.5 $0.00004 $0.00184
Haiku 4.5 $0.00002 $0.00092

Measured 18d ago against content hash af25b23a9098, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

git-line-endings scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 18d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

src/personal_os_setup/config/chezmoi/dot_claude/skills/git-line-endings/SKILL.md · 46 lines

How it starts

The opening of the file, as written. The whole thing — 46 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Git Line Endings (.gitattributes / CRLF-LF normalization)

Fix repos where line-ending contamination makes small edits diff whole files. Cross-platform repos (Windows tools writing CRLF into Linux-maintained files) hit this repeatedly.

Diagnose first — never guess

  • git ls-files --eol is authoritative: per tracked file it shows index/worktree endings (i/lf w/lf, i/crlf, i/mixed). Contaminated blobs = git ls-files --eol | grep -E 'i/(crlf|mixed)'.
  • Do NOT byte-scan working-tree files (od/python open) to judge blob state — confusing. --eol settles it.
  • A clean git status proves NOTHING: blobs can be consistently CRLF, or text=auto silently tolerates CRLF worktrees that round-trip clean.

Root cause (the WHY)

.gitattributes governs future commits only — it never rewrites existing blobs. Adding or editing it leaves legacy CRLF/mixed blobs untouched until a renormalize. Symptom: the first edit that writes LF lines into a legacy-CRLF file normalizes the whole file at commit → entire-file diff for a one-line change.

Fix — normalize once, per repo

  1. Sync the base first: fetch, then git switch main (the checkout may sit on an unrelated feature branch) and git pull --ff-only.
  2. Branch chore/normalize-line-endings and commit chore: normalize line endings to LF — chore: keeps semantic-release repos from bumping on non-user-visible maintenance.
  3. Author/extend .gitattributes — * text=auto; eol=lf for shell scripts and CI workflow files; eol=crlf ONLY for Windows-runtime extensions that actually exist in the repo (.bat/.cmd/.ps1/.reg). Repos without any .gitattributes get the full file.
  4. git add --renormalize . — stages only blobs whose content actually changes; a pure EOL swap shows equal insertions/deletions in --stat.
  5. Force the worktree to LF too: git checkout-index -f --all — renormalize updates the index but disk copies can stay CRLF, so editors keep tripping.
  6. Verify before commit: git ls-files --eol | grep -E 'i/(crlf|mixed)' → empty output.
  7. Commit, then the repo's normal branch → PR flow (squash-merge repos use the PR title as the commit message).

Read the full file on GitHub · 46 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 18d ago Changed · +3 lines af25b23a9098
  2. 27d ago First seen · 43 lines · 20 tokens per session scan A 3c15e0598f7b

Subscribe to this mod's changes

git-line-endings is a skill published in the GitHub repository AmineDjeghri/personal-os-setup (654 stars, last pushed today), licensed MIT. It adds 20 tokens to every session and 918 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-19.