gitattributes-manager
Original:🇺🇸 English
Translated
Create, review, and safely update `.gitattributes` files with conservative Unix-first defaults and explicit attribute rationale.
55installs
Sourceabuxton/skills
Added on
NPX Install
npx skill4agent add abuxton/skills gitattributes-managerTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →.gitattributes
Manager
.gitattributesCreate or maintain files with safe, research-backed defaults for Unix-like development. This skill focuses on line-ending normalization, obvious binary handling, and precise attribute changes without trampling repository-specific rules.
.gitattributesRole
You are an expert in Git attributes, cross-platform text normalization, and repository hygiene. You understand how Git resolves matching rules, when to prefer versus , and how to apply , , , , and custom attributes conservatively.
.gitattributes.git/info/attributestext-texteolbinary- Prefer minimal, high-signal rules over exhaustive templates
- Preserve existing repository intent and ordering unless there is a clear correctness issue
- Use Unix-first defaults while keeping explicit Windows-only scripts on CRLF when needed
- Explain why each added, removed, or overridden rule exists
- Use only when a path must stop inheriting a broader attribute without deleting shared defaults
!attr
Reference Files
| Reference | When to Load |
|---|---|
| Before creating a new |
Workflow
-
Discover repository context — Check whetheralready exists, inspect representative file types in the repository, and note platform signals such as shell scripts, Windows scripts, binary assets, generated files, archives, and any existing custom diff or merge filters. If the requirement is local-only and should not be version-controlled, prefer
.gitattributesinstead of.git/info/attributes..gitattributes -
Respect Git attribute semantics — Remember that later matching lines override earlier ones per attribute, negative patterns are not allowed, and directory patterns do not recurse unless written as. When removing behavior inherited from a broader rule, prefer the narrowest safe change: edit a specific rule, delete a redundant rule, or use
dir/**to reset an attribute to!attr.Unspecified -
Establish conservative defaults — For a new Unix-first repository, start from the baseline in. Keep the baseline intentionally small:
references/defaults.md- normalize text with
* text=auto - set on Unix-executed scripts and core text/config formats that should stay LF
eol=lf - set only for Windows-native scripts such as
eol=crlf,.bat, and.cmd.ps1 - mark obvious binaries and archives as
binary - avoid broad language-, diff-, export-, or Linguist-specific rules unless the repository clearly needs them
- normalize text with
-
Add attributes safely — Before adding a rule, check whether an existing broader or narrower rule already covers the paths. Use the smallest pattern that matches the intended files, place the new rule near related rules, and preserve precedence. Explain the effect of,
text,-text,eol=<lf|crlf>, or any custom attribute before applying it.binary -
Remove or override attributes safely — When asked to remove an attribute:
- remove a redundant explicit rule if deleting it preserves the intended inherited behavior
- use or a more specific counter-rule when a path must stop inheriting a broader attribute
!attr - avoid deleting shared defaults when only one subset of files needs different behavior
- preserve comments and grouping where possible so the file stays understandable
-
Document the rationale — For each meaningful rule group, explain why it exists in terms of line-ending normalization, binary safety, diff behavior, or repository hygiene. When a plausible rule is intentionally omitted, say so instead of inventing speculative defaults.
-
Validate the result — Review ordering, pattern specificity, and override behavior. When Git is available, validate representative files with. If line-ending normalization is introduced to an existing repository, note that
git check-attr -a -- <path>may be required and advise reviewing the resulting diff before committing.git add --renormalize .
Notes
- patterns are similar to
.gitattributes, but negative patterns are forbidden..gitignore - is a practical shorthand for disabling text and diff treatment on obvious binary assets.
binary - Avoid unless the repository explicitly needs it and all participating Git clients support it.
working-tree-encoding - Do not default to GitHub Linguist attributes, custom diff drivers, or rules unless the repository's files justify them.
export-ignore