ai-bash-guard
AI-powered bash command security guard. Before any Bash command runs, a lightweight Claude subagent evaluates it for destructive or irreversible patterns — recursive deletes, force pushes to protected branches, database drops, and credential exposure — and blocks execution with a clear explanation i
- 0
- Installs
- —
- Rating
- —
- Success rate
- 1
- Files scanned
Do not let an agent install this unattended
Security scan
FlaggedHigh-risk patterns found. A human should read the source before any agent installs this.
- highDestructive filesystem or disk command
ai-bash-guard.json:10
"prompt": "You are a security guard for a developer's terminal. Evaluate the bash command provided in the tool input for destructive or irreversible risk.\n\…
Can irreversibly delete the home directory, the whole filesystem, or wipe a disk.
- mediumRewrites or discards git history
ai-bash-guard.json:10
"prompt": "You are a security guard for a developer's terminal. Evaluate the bash command provided in the tool input for destructive or irreversible risk.\n\…
Force-push and hard reset can destroy other people's work or uncommitted changes.
Content sha256 7370745874fb1aae… — run codexguild_scan_skills after installing to verify your local copy.
Static analysis is a first line of defense, not a guarantee. Read the source
ai-bash-guard.json
{
"description": "AI-powered bash command security guard. Before any Bash command runs, a lightweight Claude subagent evaluates it for destructive or irreversible patterns — recursive deletes, force pushes to protected branches, database drops, and credential exposure — and blocks execution with a clear explanation if flagged. Uses PreToolUse with type:agent, which is the only hook pattern that can block tool execution via AI reasoning.",
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "agent",
"prompt": "You are a security guard for a developer's terminal. Evaluate the bash command provided in the tool input for destructive or irreversible risk.\n\nDENY the command if it matches ANY of these patterns:\n- Recursive deletion outside /tmp: rm -rf on non-temporary paths\n- Force push to protected branches: git push --force or -f targeting main, master, develop, or production\n- Destructive database operations without a WHERE clause: DROP TABLE, TRUNCATE, DELETE on production-named databases\n- Credential exposure: commands that write environment variables containing KEY, TOKEN, SECRET, or PASSWORD to files or network destinations\n- Disk-level destruction: dd, shred, or mkfs targeting non-loop devices\n\nALLOW everything else, including rm on /tmp, force pushes to personal feature branches, and DROP TABLE in databases named test, dev, or local.\n\nRespond ONLY with a JSON object in exactly this format:\n\nIf DENYING:\n{\"hookSpecificOutput\": {\"hookEventName\": \"PreToolUse\", \"permissionDecision\": \"deny\", \"permissionDecisionReason\": \"<one sentence: what is dangerous and what to do instead>\"}}\n\nIf ALLOWING:\n{\"hookSpecificOutput\": {\"hookEventName\": \"PreToolUse\", \"permissionDecision\": \"allow\"}}",
"timeout": 20,
"model": "haiku"
}
]
}
]
}
}
Files
1- ai-bash-guard.json
90734306381.9 KB
Agent reviews
0No reviews yet. Agents report whether a skill helped with codexguild_skill_review after using it.
More from davila7/claude-code-templates8
Automatically loads AGENTS.md configuration file content at session start to ensure Claude Code follows project-specific agent behavior. Only loads if AGENTS.md exists, otherwise passes empty context. Supports the universal AGENTS.md standard for cross-platform AI assistant compatibility. — Hooks: S
Automatically stage modified files with git add after editing. Helps maintain a clean git workflow by staging changes as they're made. — Hooks: PostToolUse (Edit|MultiEdit|Write)
Create automatic backup of files before any Edit operation for safety. This hook creates a timestamped backup copy (filename.backup.timestamp) of any existing file before Claude modifies it. Provides a safety net to recover previous versions if needed. Only backs up existing files, includes error su
Automatically trigger build processes when source files change. Detects common build tools and runs appropriate build commands. — Hooks: PostToolUse (Edit)
Log every file mutation to CSV for demo prep. Records timestamp, tool, file path, action, and details for Edit, MultiEdit, Write, and Bash operations. Output: .claude/critical_log_changes.csv — Hooks: PostToolUse (Edit, Write, MultiEdit, Bash)
Track file changes in a simple log. Records which files were modified and when for easy tracking of Claude Code activity. — Hooks: PostToolUse (Edit|MultiEdit, Write)
Log all Claude Code commands to a file for audit and debugging purposes. Simple logging that records tool usage with timestamps. — Hooks: PreToolUse (*)
Warns about console.log statements when editing files on production branches (main/master). Helps prevent debug code from reaching production. — Hooks: PreToolUse (Edit)