locales/zh-TW/skills/push/SKILL.md
[UDS] AI 輔助 git push 安全層:品質閘門 + 協作護欄。 Use when: pushing commits, force pushing, pushing to protected branches, pushing feature branches. Keywords: git push, force push, protected branch, quality gate, push receipt, PR automation, 推送, 保護分支, 品質閘門.
npx skillsauth add asiaostrich/universal-dev-standards pushInstall 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.
語言: English | 繁體中文
版本:2.0.0 建立日期:2026-04-23 適用範圍:Claude Code Skills
git push 的 AI 輔助安全層。偵測保護分支、強制 force-push 護欄、執行 pre-push 品質閘門、輸出結構化推送收據,並整合 PR 自動化。
本 Skill 實作 .standards/push-standards.ai.yaml。
呼叫 /push 後,Claude 原生依序執行以下步驟:
執行 git rev-parse --abbrev-ref HEAD 取得目前分支。
比對 protected_branches 清單(預設:main、master、release/、hotfix/)。
若為保護分支:顯示警告 + 待推送的 commit 列表,需使用者明確確認才能繼續。
若偵測到 --force 或 --force-with-lease:
執行 git log origin/<branch>..HEAD --oneline 找出將被覆蓋的 commits。
顯示數量與作者列表。需要使用者輸入 yes, force push 才能繼續。
依序使用 Bash tool 執行每個已設定的閘門:
lint:偵測並執行專案 lint 指令test:偵測並執行專案測試指令type-check(選用):TypeScript 型別檢查ac-coverage(選用):驗收條件覆蓋率security-scan(選用):安全漏洞掃描若任何必要閘門失敗:中止並顯示錯誤訊息。
執行 git push <remote> <branch> [--force]。
若推送失敗:顯示 git 錯誤並建議修正方式。
將結構化收據輸出到 console(可選擇寫入 ~/.uds/push-history.jsonl):
{
"branch": "<branch>",
"commit_sha": "<sha>",
"gates_passed": ["lint", "test"],
"force_push": false,
"timestamp": "<ISO8601>",
"target_remote": "origin"
}
若 auto_pr=true 且 repo_mode=team 且該分支無 open PR:
建議使用者執行 /pr-automation-assistant 建立 Pull Request。
推送前偵測目標分支是否為保護分支(例如 main、master、release/*、hotfix/*)。
偵測到 --force 時,推送前顯示影響範圍。
yes, force push)force_push: true推送前依序執行已設定的品質閘門。
| 閘門 | 說明 |
|------|------|
| lint | 執行 lint 檢查 |
| test | 執行測試 |
| type-check | TypeScript 型別檢查(選用) |
| ac-coverage | AC 覆蓋率檢查(選用) |
| security-scan | 安全掃描(選用) |
推送成功後輸出結構化收據,供稽核追蹤使用。
{
"branch": "feature/my-feature",
"commit_sha": "a1b2c3d",
"gates_passed": ["lint", "test"],
"gates_skipped": false,
"force_push": false,
"timestamp": "2026-04-23T10:00:00Z",
"target_remote": "origin"
}
可選擇附加到 ~/.uds/push-history.jsonl 以持久化稽核追蹤。
推送 feature branch 後,若尚無 PR,提示使用者建立 Pull Request。
pr-automation-assistantsingle-owner repo 模式或使用 --no-pr 旗標時跳過# 標準推送(自動執行品質閘門)
/push
# Force push(顯示被覆蓋 commits,需要確認)
/push --force
# 推送到指定的遠端分支
/push --target main
# 跳過品質閘門(緊急情況)
/push --skip-gates
# 推送但不提示建立 PR
/push --no-pr
# Force push 且不提示建立 PR(例如更新個人分支)
/push --force --no-pr
| 參數 | 說明 |
|------|------|
| --force | 啟用 force push,含護欄確認 |
| --target <branch> | 明確指定目標遠端分支 |
| --skip-gates | 跳過品質閘門(僅緊急情況) |
| --no-pr | 推送後不提示建立 PR |
透過 uds.project.yaml 設定:
push:
repo_mode: team # "team" | "single-owner"
protected_branches:
- main
- master
- "release/*"
- "hotfix/*"
push_gates:
default:
- lint
- test
optional:
- type-check
- ac-coverage
- security-scan
receipt:
output: console # "console" | "file" | "both"
file_path: "~/.uds/push-history.jsonl"
auto_pr: true # 推送到非保護分支後是否提示建立 PR
| Option 檔案 | 模式 | 說明 |
|-------------|------|------|
| options/push/team-mode.md | team | 完整協作護欄(預設) |
| options/push/single-owner-mode.md | single-owner | 個人 repo 低摩擦模式 |
/push 完成後,AI 助手應建議:
推送完成。建議下一步:
- 執行
/pr-automation-assistant建立或更新 Pull Request ⭐ 推薦 — 確保協作流程完整- 執行
/checkin確認程式碼簽入品質 — 下次提交前的品質確認- 查看
~/.uds/push-history.jsonl確認推送紀錄 — 稽核追蹤
| 版本 | 日期 | 變更 | |------|------|------| | 2.0.0 | 2026-04-28 | 還原 workflow 執行步驟(XSPEC-097 採用層解耦);移除棄用通知 | | 1.0.0 | 2026-04-23 | 初始版本 — XSPEC-081 Phase 1 |
本 Skill 採用 MIT License 與 CC BY 4.0 雙重授權發布。
來源:universal-dev-standards
development
[UDS] 扫描代码库的调试残留与代码质量问题;可自动修正安全模式。 Use when: before committing, during PR review, or periodic codebase cleanup. Keywords: sweep, debug cleanup, console.log, debugger, TODO, ts-any, code quality, 扫描, 清理.
tools
[UDS] 从规格衍生 BDD 场景、TDD 骨架或 ATDD 表格
development
[UDS] 识别重复流程并以正确的开发深度构建 Skill
tools
[UDS] AI 辅助 git push 安全层:质量门禁 + 协作护栏。 Use when: pushing commits, force pushing, pushing to protected branches, pushing feature branches. Keywords: git push, force push, protected branch, quality gate, push receipt, PR automation, 推送, 保护分支, 质量门禁.