git-guardrails-claude-code
/git-guardrails-claude-code
Konfiguruje hooki Claude Code blokujące niebezpieczne polecenia git (push, reset --hard, clean, branch -D) przed ich wykonaniem.
- Autor
- sideshowroberto ↗
- Repozytorium
- vfx-agent-toolkit ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 10.10.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 2
- Skrypty
- 1
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 10.10.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
- 1 skrypt w paczce. Przejrzyj je przed instalacją, bo Claude może je uruchomić.
Skrypty: scripts/block-dangerous-git.sh
Co robi i kiedy
Konfiguruje hooki Claude Code blokujące niebezpieczne polecenia git (push, reset --hard, clean, branch -D) przed ich wykonaniem.
Oryginalny opis (EN)
Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute. Use when user wants to prevent destructive git operations, add git safety hooks, or block git push/reset in Claude Code.
Jak działa
- What Gets Blocked
- Steps
Podgląd SKILL.md
---
name: git-guardrails-claude-code
description: Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute. Use when user wants to prevent destructive git operations, add git safety hooks, or block git push/reset in Claude Code.
---
# Setup Git Guardrails
Sets up a PreToolUse hook that intercepts and blocks dangerous git commands before Claude executes them.
## What Gets Blocked
- `git push` (all variants including `--force`)
- `git reset --hard`
- `git clean -f` / `git clean -fd`
- `git branch -D`
- `git checkout .` / `git restore .`
When blocked, Claude sees a message telling it that it does not have authority to access these commands.
## Steps
### 1. Ask scope
Ask the user: install for **this project only** (`.claude/settings.json`) or **all projects** (`~/.claude/settings.json`)?
### 2. Copy the hook script
The bundled script is at: [scripts/block-dangerous-git.sh](scripts/block-dangerous-git.sh)
Copy it to the target location based on scope:
- **Project**: `.claude/hooks/block-dangerous-git.sh`
- **Global**: `~/.claude/hooks/block-dangerous-git.sh`
Make it executable with `chmod +x`.
### 3. Add hook to settings
Add to the appropriate settings file:
**Project** (`.claude/settings.json`):
```json
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/block-dangerous-git.sh"
}
]
}
]
}
}
```
**Global** (`~/.claude/settings.json`):
```json
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "~/.claude/hooks/block-dangerous-git.sh"
}
]
}
]
}
}
```
If the settings file already exists, merge the hook into existing `hooks.PreToolUse` array - don't overwrite other settings.
### 4. Ask about customization
Ask if user wants to add or remove any patterns from the blocked list. Edit the copied script accordingly.
### 5. Verify
Run a quick test:
```bash
echo '{"tool_input":{"command":"git push origin main"}}' | <path-to-script>
```
Should exit with code 2 and print a BLOCKED message to stderr.
Pliki w paczce (2)
- SKILL.md 2 KB
- scripts/block-dangerous-git.sh 1 KB
Wersje
| Repozytorium | Wynik | Licencja |
|---|---|---|
| Ta strona · sideshowroberto/vfx-agent-toolkit | 100 | MIT |
| mattpocock/skills | 100 | MIT |
| soultech-oh-ux/goodseed | 100 | MIT |
| stevesolun/ctx | 100 | MIT |
| akillness/jeo-skills | 95 | MIT |
Migawka bazy z 13.11.2026 · wersja paczki 53413ae475c0 (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 100git-guardrails
Instaluje hook dla jednego projektu lub wszystkich, który blokuje destrukcyjne polecenia git, np. push, reset --hard i branch -D. - 90git-safety
Pilnuje, by nie wykonywać niebezpiecznych operacji Git, takich jak force push, reset czy czyszczenie w trybie destrukcyjnym. - 100git-guardrails
Instaluje hook, który blokuje destrukcyjne polecenia git, zanim agent AI je uruchomi, np. force push lub reset --hard. - 100guard
Blokuje destrukcyjne polecenia (rm -rf, DROP TABLE, force-push, git reset --hard) i opcjonalnie ogranicza edycje plików do wskazanego katalogu, przy pracy na krytycznych systemach. - 100git-guardrails
Wymusza mechanicznie zasady bezpieczeństwa git hookiem PreToolUse, który blokuje force-push, reset --hard i inne ryzykowne polecenia. - 100git-guardrails
Instaluje hook PreToolUse, który blokuje destrukcyjne operacje git, np. --no-verify, branch -D i force-push, poza hubem.