Master of defensive Bash scripting for production automation, CI/CD
Add this skill
npx mdskills install sickn33/bash-proExceptionally comprehensive Bash scripting guide with security patterns and best practices
set -Eeuo pipefail and proper error trappingfor f in $(ls)[[ ]] for Bash conditionals, fall back to [ ] for POSIX compliancegetopts and usage functionsmktemp and cleanup trapsprintf over echo for predictable output formatting$() instead of backticks for readabilityshopt -s inherit_errexit for better error propagation in Bash 4.4+IFS=$'\n\t' to prevent unwanted word splitting on spaces: "${VAR:?message}" for required environment variables-- and use rm -rf -- "$dir" for safe operations--trace mode with set -x opt-in for detailed debuggingxargs -0 with NUL boundaries for safe subprocess orchestrationreadarray/mapfile for safe array population from command outputSCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"find -print0 | while IFS= read -r -d '' file; do ...; done#!/usr/bin/env bash shebang for portability across systems(( BASH_VERSINFO[0] >= 4 && BASH_VERSINFO[1] >= 4 )) for Bash 4.4+ featurescommand -v jq &>/dev/null || exit 1case "$(uname -s)" in Linux*) ... ;; Darwin*) ... ;; esacsed -i vs sed -i '')--verbose instead of -vvalidate_input_file not check_filefunction_name() {readonly to prevent accidental modificationlocal keyword for all function variables to avoid polluting global scopetimeout for external commands: timeout 30s curl ... prevents hangs[[ -r "$file" ]] || exit 1&2; }--help and provide clear usage informationenable=all and external-sources=true configuration-i 2 -ci -bn -sr -kp)for f in $(ls ...) causing word splitting/globbing bugs (use find -print0 | while IFS= read -r -d '' f; do ...; done)set -e without proper error trapping in complex flowsecho for data output (prefer printf for reliability)readarray/mapfile instead of command substitution)basher or bpkg for installing shell script dependenciesbasher install username/repo@version or bpkg install username/repo -gtrap 'echo "Error at line $LINENO: exit $?" >&2' ERR for debuggingtrap 'rm -rf "$tmpdir"' EXIT; tmpdir=$(mktemp -d)(( BASH_VERSINFO[0] >= 5 )) before using modern featuresreadarray -d '' files output.log share redirection, ( cd dir && cmd ) use subshell for isolationcoproc proc { cmd; }; echo "data" >&"${proc[1]}"; read -u "${proc[0]}" result for bidirectional pipescat <<-'EOF' with - strips leading tabs, quotes prevent expansionwait $pid to wait for background job, jobs -p list background PIDscmd1 && cmd2 run cmd2 only if cmd1 succeeds, cmd1 || cmd2 run cmd2 if cmd1 failstouch file{1..10}.txt creates multiple files efficientlydeclare -n ref=varname creates reference to another variable (Bash 4.3+)set -Eeuo pipefail; shopt -s inherit_errexit for comprehensive error handlingxargs -P $(nproc) -n 1 command for parallel processing with CPU core countjq -n --arg key "$value" '{key: $key}' for JSON generationtime -v for detailed resource usage or TIMEFORMAT for custom timingInstall via CLI
npx mdskills install sickn33/bash-proBash Pro is a free, open-source AI agent skill. Master of defensive Bash scripting for production automation, CI/CD
Install Bash Pro with a single command:
npx mdskills install sickn33/bash-proThis downloads the skill files into your project and your AI agent picks them up automatically.
Bash Pro works with Claude Code, Claude Desktop, Cursor, Vscode Copilot, Windsurf, Continue Dev, Codex, Gemini Cli, Amp, Roo Code, Goose, Opencode, Trae, Qodo, Command Code. Skills use the open SKILL.md format which is compatible with any AI coding agent that reads markdown instructions.