skills/git-workflow/SKILL.md
Git 分支策略與協作規範:分支命名、PR 流程、Merge 策略與版本標籤管理。
npx skillsauth add CloudyWing/ai-dotfiles git-workflowInstall 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.
當使用者詢問 Git 分支管理、Pull Request 流程或版本發布策略時,請自動套用以下規範。
| 分支 | 用途 | 保護規則 |
| --- | --- | --- |
| main | 正式發布版本,隨時可部署 | 禁止直接推送,僅透過 PR 合併 |
| develop | 開發整合分支(若採用 Git Flow) | 禁止直接推送,僅透過 PR 合併 |
main + feature branches)。main + develop + feature/release/hotfix)。Pattern: <type>/<short-description>
feature/user-registration
fix/order-total-calculation
refactor/extract-email-service
docs/api-endpoint-guide
chore/upgrade-dotnet-10
hotfix/null-reference-on-checkout
type 與 commit 的 type whitelist 一致(feature 對應 feat,其餘相同)。short-description 使用 kebab-case(小寫字母,連字號分隔)。wing-0403、test-branch)。與 commit message 的 Header 格式一致:<type>([scope]): <subject>
## Summary
- 變更摘要(1-3 個重點)
## Test Plan
- [ ] 測試項目 1
- [ ] 測試項目 2
console.log 或註解。| 策略 | 適用情境 | 說明 | | --- | --- | --- | | Squash Merge | 功能分支 → main/develop | 多個 commit 壓縮為一個,保持主線歷史乾淨 | | Merge Commit | release → main, hotfix → main | 保留完整合併記錄 | | Rebase | 功能分支同步上游變更 | 保持線性歷史,僅限本地未推送的 commit |
generate-commit skill 的規範。git rebase main 同步上游變更。--force-with-lease(非 --force),防止覆蓋他人推送。git diff --name-only --diff-filter=U。vMAJOR.MINOR.PATCH(如 v1.2.3)。main 分支建立。| Hook | 用途 |
| --- | --- |
| pre-commit | Lint 檢查、格式化(如 dotnet format) |
| commit-msg | 驗證 commit message 格式 |
| pre-push | 執行測試(避免推送破壞主線的程式碼) |
scripts/ 或 .githooks/ 目錄),透過 git config core.hooksPath 或 Husky 等工具統一。--no-verify。.gitignore(參閱 generate-gitignore-by-techstack prompt)。bin/、obj/、dist/、node_modules/).env、*.pfx、credentials.json).vs/、.idea/、*.user)Thumbs.db、.DS_Store)tools
PowerShell 腳本撰寫規範:嚴格模式、錯誤處理、參數宣告、Verb-Noun 命名與 5.1 相容語法邊界。當撰寫或修改 `*.ps1` / `*.psm1` 腳本時自動套用。
tools
產生或補齊 .gitattributes,統一行尾處理、二進位識別與 lock files 標記,保留既有自訂偏好。
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.