Bash Authorize — Development skill for Claude Code
Claude Code "PreToolUse" hook for authorizing Bash commands.
How to install Bash Authorize
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open rse/bash-authorize and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
What Bash Authorize does
Claude Code "PreToolUse" hook for authorizing Bash commands.
Alternatives in Development
- Hookify — Rule-based hook system for Claude Code 14k ★
- Ralphy — My Ralph Wiggum setup, an autonomous bash script that runs Claude Code, Codex, OpenCode, Cursor agent, Qwen & 2.8k ★
- Claude Code Prompt Improver — Intelligent prompt improver hook for Claude Code 1.3k ★
README
Bash-Authorize
**Claude Code "PreToolUse" hook for authorizing Bash commands**
[](https://github.com/rse) [](https://github.com/rse)
Abstract
This is a small Command-Line Interface (CLI) acting as a *Claude Code* `PreToolUse` hook for the `Bash` tool. It parses the to-be-executed Bash command into an Abstract Syntax Tree (with the help of the [`unbash`](https://npmjs.com/unbash) parser), recursively walks the full command structure, and classifies it into one of four verdicts:
**allow** — the command is *genuinely inert* (read-only, no side-effects), so it is *auto-approved* without prompting the user (e.g. `ls`, `cat`, `grep`, `git status`, or `curl`/`wget` as long as they stream to stdout and do not write any file).
**ask** — the command is *known-dangerous* but legitimate, so a user confirmation *prompt is forced* (e.g. `rm -rf`, `git push`, `chmod`).
**deny** — the command is *catastrophic* and near-never legitimate, so it is *blocked outright* (e.g. `rm -rf /`, `mkfs.*`, `dd of=/dev/...`).
**passthrough** — nothing matched, or the classification was *gated* by a hard safety condition (a mutating redirect, a background job, an embedded `$(...)` substitution, a non-literal command name, etc.), so the hook *stays silent* and defers to *Claude Code*'s normal permission flow.
The classification is *fail-safe* throughout: any parse error, thrown exception, or unexpected/unmatched construct yields `passthrough`, so the tool never crashes the host agent and never auto-approves on doubt.
[!CAUTION] THIS IS A SECURITY-RELEVANT AND RISKY PIECE OF SO
Related Skills
Narthex
Prompt-injection defenses for Claude Code. A PreToolUse Bash hook blocks compositional credential-exfiltration
Smart Approve.py
PreToolUse (Bash) Decompose compound bash commands (&&, \ \ , ;, \ , $()) into sub-commands and check each aga
Edit Hook
Authorize the next Write/Edit to a .claude/hooks/.sh file. Writes a single-use marker the injection-gate hook
Edit Settings
Authorize the next Write/Edit to a .claude/settings.json (or settings.local.json) file. Writes a single-use ma
Claude Code Permissions Hook
A PreToolUse hook for Claude Code for more granular permission controls
Overleaf Sync Now
Stops Claude Code and Codex CLI from silently overwriting your Overleaf web edits with a stale local Dropbox c
Related Agents
Code Audit Maintainer Shell
Maintainer-only audit of framework bash and the bats suites guarding it: quoting/portability correctness, a sh
Claude Code System Prompts
by Piebald AI - All parts of Claude Code's system prompt, including builtin tool descriptions, sub agent promp
CLI Explore Agent
Read-only code exploration via Bash + CLI semantic dual-source analysis, with schema-validated structured outp