Przejdź do treści
Biblioteka skilli
AI i agenci · Automatyzacja

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.

Licencja
MIT
Ostatnia zmiana repozytorium
10.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
2
Skrypty
1
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 10.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co sprawdzić przed instalacją
  • 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

  1. What Gets Blocked
  2. Steps
Sekcje z nagłówków SKILL.md, w oryginale · 92 linii, 257 słów
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

RepozytoriumWynikLicencja
Ta strona · sideshowroberto/vfx-agent-toolkit100MIT
mattpocock/skills100MIT
soultech-oh-ux/goodseed100MIT
stevesolun/ctx100MIT
akillness/jeo-skills95MIT

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.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.