Skip to content
Back to skills

Git Guardrails Claude Code Cht

ASecurity

設定 Claude Code hooks,在 push、reset --hard、clean、branch -D 等危險 git 指令執行前阻擋。當使用者想防止破壞性 git 操作、加入 git 安全 hooks,或阻擋 git push/reset 時使用。

  • 4 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 12, 2026
ai-agentsrailsgit

Works with

  • claude code

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned September 12, 2026

npx -y skills add aibot88/sec_skill_store --skill git-guardrails-claude-code-cht --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Git Guardrails Claude Code Cht?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Git Guardrails Claude Code Cht
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/aibot88-git-guardrails-claude-code-cht/badge)](https://www.skillsdirectory.com/skills/aibot88-git-guardrails-claude-code-cht)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: git-guardrails-claude-code-cht
description: "設定 Claude Code hooks,在 push、reset --hard、clean、branch -D 等危險 git 指令執行前阻擋。當使用者想防止破壞性 git 操作、加入 git 安全 hooks,或阻擋 git push/reset 時使用。"
---

# Claude Code Git Guardrails

設定 Claude Code hooks,在危險 git 指令執行前阻擋它們。

## 目標

避免 agent 或使用者誤執行會破壞工作狀態的 git 指令,例如 git push、git reset --hard、git clean、git branch -D、git checkout -- path,以及其他會刪除、覆蓋或不可逆改變工作樹的操作。

## 工作流程

1. 檢查目前 repo 是否有 Claude Code hooks 設定。
2. 若沒有,建立 hook 目錄與設定檔。
3. 安裝 scripts/block-dangerous-git.sh 或等價 blocking script。
4. 設定 hook 在 git 指令執行前檢查 command line。
5. 對高風險指令輸出清楚警告並中止。
6. 驗證安全指令可通過,危險指令會被阻擋。

## 設計原則

- 預設保守:不確定是否危險時,要求使用者明確確認。
- 錯誤訊息要說明被阻擋的原因與替代做法。
- 不要阻擋只讀指令,例如 git status、git diff、git log。
- 不要修改使用者未要求的 hooks 或設定。

## 驗證

用安全的 dry-run 或 mock command 測試 matching 邏輯,不要真的執行破壞性 git 指令。

Files in this skill

  • SKILL.md1.4 KB
  • source.json788 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.