rse

Bash Authorize — Development skill for Claude Code

Development community

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**

[![github (author stars)](https://img.shields.io/github/stars/rse?logo=github&label=author%20stars&color=%233377aa)](https://github.com/rse) [![github (author followers)](https://img.shields.io/github/followers/rse?label=author%20followers&logo=github&color=%234477aa)](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