Claude Code hook

Claude Code Guardrails

Protective hooks that guard against lost work via branch protection and automatic checkpoints.

54 stars 2 forksHooks Source

Install

From source
git clone https://github.com/wangbooth/Claude-Code-Guardrails.git

From the README

πŸ›‘οΈ Claude Code Guardrails

  Smart Guardrail System for Safer Claude Code Development

  πŸ”₯ If this project helps you, please click the ⭐ Star in the top right corner to support us!

  πŸ‡ΊπŸ‡Έ English | πŸ‡¨πŸ‡³ δΈ­ζ–‡ | πŸ‡―πŸ‡΅ ζ—₯本θͺž

🚨 Pain Points: Claude Code's "Dangerous Moments"

Have you ever encountered these frustrating scenarios while Vibe Coding?

❌ Direct modification on main branch β†’ One mistake, important code gets overwritten
❌ Interrupted modifications β†’ Intermediate artifacts lost, unable to rollback to specific states
❌ Chaotic multiple modifications β†’ Don't know which change introduced the bug
❌ Accidentally deleted important files β†’ No timely commits, game over
❌ Manual changes overwritten β†’ AI directly overwrites uncommitted manual changes, cannot distinguish code ownership

πŸ’‘ Solution: Claude Code Guardrails

Guardrails based on Claude Code Hook
Triple Security Mechanism: πŸ›‘οΈ Pre-write Interception Alert + πŸ“Έ Precise Snapshot Commits + πŸ”„ Smart Merge Archiving

βœ… Protected branch interception β†’ Automatically blocks writes to main branch, suggests creating feature branch
βœ… Uncommitted changes protection β†’ Blocks when manual changes are uncommitted, forces commit first to avoid overwriting
βœ… File-level precise snapshots β†’ Each modification only commits changed files, avoiding noise
βœ… Smart backup mechanism β†’ Automatic backup before gitignore file modifications
βœ… Safe history merging β†’ Multiple checkpoints intelligently merged into clean task commits

πŸŽ‰ Start experiencing now!

    

✨ Core Features

πŸ›‘οΈ Dual Security Protection
- Protected branch interception
- Uncommitted changes detection
- Pre-write blocking alerts
- Smart suggestion to create vibe branch
- Force commit manual changes before continuing

πŸ“Έ Precise Snapshots
- File-level snapshot…
Read the full README on GitHub

How hooks work

  • Hooks are shell commands Claude Code runs at fixed points: before or after a tool call, when you submit a prompt, when Claude stops, on notifications and at session start.
  • They are set in the hooks section of ~/.claude/settings.json (or .claude/settings.json for a project), or come bundled in a plugin.
  • A hook can block a tool call, add context, or run a formatter or test. Read the scripts before you install them: they run on your machine with your permissions.
Claude Code docs

Details

Type
Hooks
Language
Shell
License
MIT
Last updated
15 September 2025
Topics
claude-codeclaude-code-hooksvibe-coding

FAQ

What is Claude Code Guardrails?

Protective hooks that guard against lost work via branch protection and automatic checkpoints. It is a hook for Claude Code, from wangbooth/Claude-Code-Guardrails on GitHub.

How do I install Claude Code Guardrails?

Clone wangbooth/Claude-Code-Guardrails from GitHub and follow the setup steps in its README.

Is Claude Code Guardrails popular?

wangbooth/Claude-Code-Guardrails has 54 GitHub stars and 2 forks, and is included in 1 curated Claude Code list. It was last updated on 15 September 2025.

More hooks

Browse the most popular Claude Code mods, all hooks, or the skills and MCP server directories.