/agentic-utils-claude-code:bash-safetyfrom agentic-utils-claude-code
Review bash commands for dangerous patterns and interpret exit codes correctly. Use when asked to "check this bash", "is this safe to run", "review this script", or when debugging a script that fails unexpectedly.
Ships in agentic-utils-claude-code. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Review bash commands for dangerous patterns and interpret exit codes correctly.
Not every non-zero exit code is an error. The following commands use non-zero exits to convey information:
| Command | Exit 0 | Exit 1 | Exit 2+ |
|---|---|---|---|
grep / rg | Matches found | No matches (not an error) | Real error |
find | Success | Some directories inaccessible | Real error |
diff | No differences | Files differ (not an error) | Real error |
test / [ | Condition true | Condition false (not an error) | Real error |
Common mistake: treating grep exit 1 as an error in a pipeline, causing the whole script to abort when set -e is active. Fix:
# Wrong — aborts on no matches
grep "pattern" file.txt
# Correct — treats no-match as non-error
grep "pattern" file.txt || true
# Or check explicitly
if grep -q "pattern" file.txt; then
echo "found"
else
echo "not found" # exit 1, not an error
fi
These patterns can execute arbitrary code:
$() — command substitution` ` — backtick substitution<() / >() — process substitution=cmd at word-start (zsh) — equals expansion, bypasses binary allowlists# Dangerous: heredoc inside $()
$(cat <<EOF
rm -rf /
EOF
)
# Dangerous: setting IFS changes how word-splitting works
IFS=/ read -r a b <<< "$path"
# Can cause unexpected word splitting in subsequent commands
$LD_PRELOAD — injects shared libraries into subsequent processes$DYLD_INSERT_LIBRARIES — macOS equivalent$@ or $* — word-splits on spaces in argumentsThese zsh-specific patterns can bypass command allowlists or execute code through modules:
zmodload — loads zsh modules that enable dangerous operations (file I/O, TCP, pseudo-terminals)emulate -c — eval-equivalentsysopen, sysread, syswrite — low-level file descriptor operations via zsh/systemztcp, zsocket — network operations via zsh/netzf_rm, zf_mv, zf_chmod — builtin filesystem operations that bypass binary checksBefore running an unfamiliar script:
$var splits on spaces and globsset -e is active, will grep/diff/test exits cause unexpected aborts?rm or rm -rf present? What path does it target?$() or backtick expand user-controlled input?> or >> target a sensitive file?curl, wget, nc)?When asked to review a script, go through the checklist above and report:
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub agentic-utils/skills --plugin agentic-utils-claude-code7 skills in this plugin
/ant-modeAdd communication style, comment, and reporting preferences to any AI assistant config. Use when asked to "enable ant mode", "improve communication style", "add reporting preferences", or when setting up a new AI assistant config./codex-delegateGet an answer from the Codex CLI (`codex exec`) that THIS conversation needs, such as a second opinion, a review of a diff or design, web research or a non-interactive edit. One headless run; the answer and token usage come back here. Covers the credit preflight, a background-safe invocation, sandbox and reasoning-effort choices, and relaying through a cheap subagent. Use when asked to "ask codex", "get codex's take", "get a second opinion from codex", "have codex review this", "have codex research this", "run codex exec", or, when codex is installed, before spawning a Claude subagent for self-contained work codex could do. For separate work codex should carry on in its own tab, use session-handoff instead./compaction-prepCheckpoint mid-task state before context limits hit. Use when asked to "prep for compaction", "checkpoint", "save state", or when context is getting long.Other plugins' skills for the same job