amagilabs

Amagi Hookguard — Security skill for Claude Code

Security community

Tested Claude Code PreToolUse/PostToolUse hooks: block destructive shell commands, secret-file reads and force pushes to main, keep a local audit log, and check your settings.json hook wiring with do.

How to install Amagi Hookguard

This entry records only its repository, not the path inside it, so there is no exact command to give. Open amagilabs/amagi-hookguard and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Amagi Hookguard does

Tested Claude Code PreToolUse/PostToolUse hooks: block destructive shell commands, secret-file reads and force pushes to main, keep a local audit log, and check your settings.json hook wiring with `doctor`.

Alternatives in Security

  • Security Guardian — Comprehensive security analysis for RTK CLI tool, focusing on command injection, shell escaping, hook security 11.9k ★
  • Secfoo — AI security review CLI: SAST, secret scanning, SCA, threat modeling and architecture review with Claude Code 356 ★
  • Omarchy Plugin Security Skill — Agent skill and field guide: the security pitfalls that block Omarchy plugins on the marketplace, from 5,000+ 70 ★

README

amagi-hookguard

Claude Code hooks that stop `rm -rf ~`, a force push to `main`, or a read of your `.env` before they run. One command wires them into `settings.json`. From then on every Bash, PowerShell, Read and Grep call is checked first: the dangerous ones are blocked with a reason Claude can read, and the risky ones (`git reset --hard`, `curl | sh`) open a permission prompt for you to answer. Every call is written to a local log, and `doctor` tells you why a hook in your settings isn't firing.

![demo](assets/demo.gif)

It has 14 rules, 252 tests and no runtime dependencies. It makes no network calls and needs no API key.

Install

pipx install amagi-hookguard

It isn't on PyPI yet. Until it is, install from a clone:

git clone https://github.com/amagilabs/amagi-hookguard
cd amagi-hookguard
pipx install .

Needs Python 3.9+.

Usage

Wire it in

amagi-hookguard install
Wired hookguard into ~/.claude/settings.json (PreToolUse + PostToolUse, matcher "*", command `amagi-hookguard hook`).
Restart Claude Code (or open /hooks) so it picks up the change, then run: amagi-hookguard doctor

It adds one `PreToolUse` and one `PostToolUse` entry and leaves your other settings and hooks alone. If the file already existed, the old copy is saved next to it as `settings.json.bak-hookguard`. Running it twice doesn't add a second entry.

  • --scope project writes .claude/settings.json in the current folder, so the guard travels with the repo. --scope local writes .claude/settings.local.json.
  • --absolute writes the full path to the executable, for when Claude Code's PATH differs from your shell's.
  • --dry-run prints the new file without writing it.
  • amagi-hookguard uninstall removes only hookguard's entries.

Check the wiring

amagi-hookguard doctor
amagi-hookguard doctor 0.1.0

user     ~/.claude/settings.json
  ok    valid JSON
  ok    2 command hook(s) found

project  ~/myapp/.claude/settings.json
  i