skills/generate-gitattributes/SKILL.md
產生或補齊 .gitattributes,統一行尾處理、二進位識別與 lock files 標記,保留既有自訂偏好。
npx skillsauth add CloudyWing/ai-dotfiles generate-gitattributesInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
本 Skill 的規則內容以 ~/.ai-agents/templates/.gitattributes 為單一來源。修改建議規則時,只改範本檔,不改 SKILL.md。SKILL.md 僅描述執行流程。
範本檔位於使用者家目錄下的 .ai-agents/ 專案。執行時若找不到範本檔,告知使用者後流程終止,不自行重建內容。
~/.ai-agents/templates/.gitattributes,取得完整的建議內容。.gitattributes 已存在:
eol、merge 策略等)。若已存在 .gitattributes,逐條比對既有規則與範本規則:
*、*.ps1)但屬性不同(如現有 eol=crlf,範本為 eol=lf)。特別注意以下既有設定不可靜默覆蓋:
* text=auto eol=crlf(與範本方向相反,必須確認)。merge=binary 或 diff= 自訂驅動設定。linguist-* 屬性。若無衝突,直接進入步驟 3。
顯示完整的 .gitattributes 預覽內容(或僅顯示新增/修改的段落),停止等待使用者確認後再執行寫入。確認格式:
以下是將要寫入的 .gitattributes 內容(新增段落):
# 預設所有文字檔使用 LF,二進位檔不轉換
* text=auto eol=lf
...
確認後將寫入,請回覆「確認」。
若使用者要求調整,修改後重新顯示確認。
已存在 .gitattributes:使用 Merge 模式,將缺少的規則插入對應分組(依範本的分組標題對齊)。若原檔沒有對應分組標題,將新規則歸入語意最接近的段落,或追加於檔案末尾。
不存在 .gitattributes:直接以範本內容建立新檔。
寫入完成後,提醒使用者下列事項(不自動執行):
core.autocrlf 設定:若使用者全域 git config 仍是 core.autocrlf=true,建議改為 false,避免與 .gitattributes 雙重處理:
git config --global core.autocrlf false
既有檔案 normalize:新增或修改 .gitattributes 後,既有檔案的行尾不會自動套用新規則。需執行以下指令重新正規化(會產生一次大量 diff,建議獨立成一個 commit):
git add --renormalize .
git commit -m "chore: 套用 .gitattributes 行尾規則重新 normalize"
跨平台確認:若團隊有 Windows / macOS / Linux 混用成員,確認 .editorconfig 的 end_of_line 與此 .gitattributes 設定方向一致(如皆為 LF)。
輸出:
development
產生或補齊前端 Lint 設定(Prettier + ESLint Flat Config),統一格式化與程式碼品質規則,保留既有自訂偏好。
testing
依據事實校閱報告修改技術文件:以事實層為不可違反的約束,由改檔者負責表達層的措辭與行文連貫。Use when the user asks to apply fact-check results to a document, or to edit a document based on a previously produced fact-check-report.md.
data-ai
多份資料檔整合流程。當需要將兩份以上的資料檔(如 JSON、CSV)合併、補齊闕漏欄位或去重成單一檔案時使用。以 dry-run、筆數核對與抽樣比對降低整合錯誤。
tools
C# 程式碼風格規範:縮寫大小寫、泛型型別參數、成員排序、空行、換行、三元運算子等 .editorconfig 無法約束的細則。建立全新 C# 專案,或在無既有慣例的專案新增全新檔案時套用。