ClaudeCodeMod

All shelves / Mods / Safety

bash-guard

By Singh-AP

bash-guard is a Claude Code safety mod by Singh-AP.

Holds every Bash call, even in bypass mode. Blocks rm -rf on a home or system directory, and asks before a force-push, a hard reset, or a pipe into sh.

Holds a command

Install

The marketplace name is awesome-claude-mods.

In Claude Code
/plugin marketplace add Singh-AP/awesome-claude-mods
/plugin install bash-guard@awesome-claude-mods
Open the repo

It runs inside the Claude Code process. The side panel is only what the author's README names. Read the repo before you install, or run claude plugin validate on the plugin folder.

Version
1.0.0
License
MIT
Repo stars
3
Last change
2026-10-04

What it can reach

  • Holds a command

Claude Code 2.1.287 or later. The mod is live once you run /reload-plugins or start a new session. It sits on every Bash call, subagents included, below the permission system, so it holds with --dangerously-skip-permissions. It blocks outright rm -rf on /, ~, $HOME, or system folders, rm --no-preserve-root, mkfs, dd to a disk, fork bombs, recursive chmod or chown on system folders, shutdown and reboot, kill -9 -1, find / -delete, diskutil erase, and gh repo delete, and the model gets the reason. It asks first, and a headless run refuses, before a force-push, reset --hard, clean -f, branch -D, a history rewrite, curl piped into sh, DROP TABLE or a DELETE without WHERE, terraform destroy, kubectl delete, cloud delete and terminate calls, docker system prune, npm or cargo publish, sudo, crontab -r, and overwriting ~/.zshrc. It reads the shell, not just patterns: quotes, chains, $(…) and backticks, bash -c, eval, and wrappers, so a git commit message that mentions rm -rf / is fine. risky sets confirm, block, or allow for risky commands, customBlock and customConfirm take your own regular expressions, and /bash-guard dry-runs a command or shows what it blocked.

The marketplace, Singh-AP's awesome-claude-mods, holds the 21 mods built there, file-guard, net-guard, slopsquat-guard among them, and 26 community and Anthropic mods pinned to a commit. This one installs on its own. Stopping the shell commands nobody means to run is why this page files it under safety. blast-radius, by Anthropic, holds a shell command such as rm -rf, a force push, a hard reset, or a migration, shows what it would touch, then asks you to proceed or cancel. arasovic-guardrails holds Cloudflare write commands, attribution lines in commits and pull requests, and branch names that start with claude/. This one holds every Bash call against a long built-in list, and catastrophic commands are always blocked whatever risky says. The README says it reads the command text, so a script file Claude writes and then runs is checked by name, not by its contents, and calls it a seatbelt, not a sandbox, pointing to a container or VM for real isolation. Its plugin.json names awesome-claude-mods as its author, and Singh-AP owns the marketplace.

Demo

bash-guard asking before a risky shell command
From the author's repo.

What it hooks into

  • session.startWhen a session starts
  • tool.callAround a tool call, where it can hold oneBash
  • command.runWhen you run its slash command/bash-guard

Read from the on() calls in its hook modules. Open its source under Files to check what each one does.

Slash commands 1

  • /bash-guardShow what bash-guard has blocked, or test a command: /bash-guard <command>

Files

The author's README and source, 4 files. They load when you open them.

Facts

Author
Singh-AP
Category
Safety
Marketplace
awesome-claude-mods
Repo
Singh-AP/awesome-claude-mods
Folder
mods/safety/bash-guard
Version
1.0.0
License
MIT
Repo stars
3
Last change
2026-10-04
Language
TypeScript
Files
7

Other mods in Safety

net-guardSingh-APHolds a commandHolds curl, wget, ssh, scp, git push, and WebFetch, even in bypass mode. Blocks paste sites and request catchers, and asks before data goes anywhere new.file-guardSingh-APHolds a commandHolds writes outside the project and writes into .git, and asks before lockfiles and CI files.slopsquat-guardSingh-APHolds a commandHolds a package install and checks the name against its registry, so a hallucinated or typosquatted package does not install.command-explainerSingh-APDraws a plain-English line and a risk level on the permission prompt, so you can see what the command does before you approve it.secret-guardarasovicHolds a commandHides API keys and private keys before the model or the transcript sees them, blocks credential files and commands that print secrets, and shows what it caught.guardrailsarasovicHolds a commandHolds Cloudflare write commands, attribution lines in commits and pull requests, and branch names that start with claude/.guardrails-liteedtrackaiHolds a commandHolds a read of a secret .env file, a git force-push, and a recursive rm on /, ~, or $HOME. .env.example, .env.sample, and .env.template are allowed.injection-guardSingh-APStrips hidden characters from tool output and marks results that carry instructions aimed at Claude, so they reach it as untrusted data.collision-guardnateherkaiHolds a commandHolds an edit to a file another open chat changed in the last 30 minutes, and asks you to proceed, move this chat to a worktree, or cancel.recording-modenateherkaiHolds a commandMasks keys, personal details, and business figures on screen while you record, hides results from mail, chat, and finance tools, and keeps private files closed.secret-boxray-amjadHolds a commandOpens a masked box when Claude needs a key, writes the key to .env, and gives Claude a placeholder; any key a tool prints comes back as a placeholder too.secret-shieldSingh-APHolds a commandReplaces API keys, tokens, private keys, and passwords in tool output with a redaction marker before the model or the transcript sees them.
All 73 in Safety