git-repo-normalize
Git Repo Normalize
Workflow
-
Detect the repository scope first.
- Run
git rev-parse --is-inside-work-treeandgit rev-parse --show-toplevel. - Manage
.gitattributesonly at the repository root.
- Run
-
Normalize before doing other repository work.
- Do not postpone line-ending normalization until the end of the task.
- Treat the first Git-facing handling of a repo as the normalization point.
- If the root
.gitattributesdoes not contain* text=auto eol=lf, add or merge that rule instead of replacing the file. - Preserve existing user rules and binary file patterns.
-
Inspect the repo signals that explain LF/CRLF drift.
- Read
.editorconfigwhen present and check whether it already declaresend_of_line = lf. - Read
git config --get core.autocrlfto explain local warnings, but do not treat global Git config as the fix. - Use
git ls-files --eolon representative files when the repository state is unclear.
- Read
-
Renormalize once the repository rule is in place.
- Run
git add --renormalize .. - Review
git status --shortandgit diff --cached --stat. - Spot-check any large or suspicious change set with
git diff --cached -- <path>. - Keep the normalization change explicit before continuing with the original task.
- Run
-
Escalate only when the repository intentionally differs.
- If the repo already documents a different committed EOL policy and the user wants to preserve it, follow that policy instead of forcing LF.
- If renormalization reveals real content edits beyond line endings, stop and ask how to proceed.
- Never delete or overwrite unrelated user changes while normalizing.
Default repository baseline
When the repository does not already define a different policy, use this root .gitattributes baseline:
* text=auto eol=lf
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.webp binary
*.ico binary
*.pdf binary
*.zip binary
Typical triggers
- Bump application or plugin versions.
- Prepare a release, tag, or changelog commit.
- Edit GitHub Actions, CI files, or release workflows.
- Diagnose
LF will be replaced by CRLFor related warnings. - Review staged diffs, branch changes, or repository-wide file churn.
- Start work in a Git repository that has no committed
.gitattributesbaseline.
Expected outcome
- Keep line-ending policy in version control instead of relying on local Git configuration.
- Perform repository normalization on the first Git-facing handling, not as final cleanup.
- Leave the repo in a stable LF-based state so later Git work does not repeat the onboarding step.
More from why8023/agent-skills
python-use
定义 Python 环境管理和依赖管理的强制规范。当 Agent 需要使用 Python、创建虚拟环境、安装依赖、管理 Python 版本时必须应用此技能。强制使用 uv 工具,禁止 pip/conda,确保项目级环境隔离。
11nodejs-use
定义 Node.js 环境管理和版本管理的强制规范。当 Agent 需要使用 Node.js、管理 Node 版本、安装 JavaScript 依赖、处理 packageManager 或 Corepack、编写或读取 mise.toml / .mise.toml / .tool-versions,或将旧项目从 volta、fnm、.node-version、.nvmrc 迁移到 mise 时必须应用此技能。强制使用 mise 管理 Node.js 运行时,禁止手动安装 Node.js,确保项目级环境隔离。
10skill-authoring-sync
在 `why8023/agent-skills` 中央 skills 仓库中新增、更新或重命名一个 skill,并在完成后把该 skill 安装到某个业务项目根目录时使用。适用于“新建一个 skill”“把 skill 沉淀到中央仓库”“把中央 skill 安装到当前项目”“更新项目里已安装的某个中央 skill”等请求。覆盖 `skills/skill-name/` 目录创建、`SKILL.md` 与 `agents/openai.yaml` 编写、最小验证、按目标 skill 单独提交并 push,以及在目标项目中通过 `npx skills add why8023/agent-skills --skill skill-name` 做项目级安装或刷新。
4dependency-reuse-first
在代码功能开发场景中,先评估是否可复用流行、成熟、维护良好的第三方依赖、官方 SDK、平台能力或现成服务,再决定是否自行实现。当 Agent 收到新功能、新模块、协议或文件格式支持、基础设施集成、数据处理、认证授权、图表表格、抓取解析、缓存队列、测试辅助等开发需求,且存在“从零写一套”的风险时必须使用此技能。先做候选依赖调研与取舍,再开始编码。
3docling-word
使用 Docling CLI 解析 `.docx` Word 文件并导出 Markdown,同时把提取出的图片等附件统一整理到 Markdown 同级的 `attachments/` 目录。用于用户要求用 Docling 转 Word、要求通过 `uv tool install` 安装 Docling、或要求修正 Docling 附件路径与目录结构时。
2skill-sync
在 skills 仓库中创建、更新或重命名一个 skill,并在编辑完成后只提交本次相关 skill 变更、推送到远端仓库,再用 `npx skills` 从远端仓库将目标 skill 安装或更新到本机多 Agent 环境。默认同步 Universal、Codex、Claude Code、OpenClaw、Cursor、OpenCode、Qoder、Trae、Trae CN、Windsurf,并约定用 `--all` 表示“全部 skill + 全部受支持 agent”。
2