Claude Code Guardrails — Summary
Claude Code Guardrails is a bash-script bundle that installs three Claude Code hooks to prevent accidental code loss during AI-assisted development: a pre-write branch guard (PreToolUse), a post-write auto-commit snapshot (PostToolUse), and a session-end checkpoint squasher (Stop/PreCompact).
Problem it solves: Claude Code modifies files directly without warning when working on protected branches, can overwrite uncommitted manual changes, and produces messy git histories with hundreds of micro-checkpoint commits. The three hooks enforce branch safety, preserve intermediate states as git snapshots, and squash those snapshots into clean task commits at session end.
Distinctive trait: The four-hook configuration covers the full write lifecycle — PreToolUse blocks dangerous writes, PostToolUse captures each change as a snapshot commit, Stop squashes checkpoints into a task commit, and PreCompact squashes before context compaction. This is a complete git-safety harness delivered as a bash install script that intelligently merges with existing .claude/settings.json.
Target audience: Developers using Claude Code who have experienced "AI overwrote my uncommitted work" or "git history has 200 micro-commits from one coding session."
Production-readiness: Active but small project (54 stars, MIT, Shell, last commit September 2025). Bilingual documentation (English, Chinese, Japanese). Clean install script with backup/dedup/idempotent behavior.
Differs from seeds: Most similar to spec-kit's PostToolUse hooks (which auto-run tests) in using the hook lifecycle for automation, but Claude Code Guardrails exclusively targets git safety rather than quality gates. Unlike superpowers's using-git-worktrees skill (which isolates features), Guardrails operates in-place and focuses on protecting the working state via continuous snapshotting rather than isolation.