/bash-master:bash-masterfrom bash-master
Expert Bash scripting across Linux, macOS, WSL, Git Bash, and containers. Enforces Google Shell Style Guide, ShellCheck validation, portability, security hardening, error handling, and BATS testing.
Ships in bash-master. 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.
Read when SKILL.md points to them.
This skill targets Bash itself, wherever Bash runs - Linux, macOS, WSL, Git Bash / MSYS2 on Windows, and Bash-based container images. It does not cover native PowerShell: a PowerShell script is a different language and should use powershell-master. On Windows, bash-master assumes the user is running Bash inside Git Bash, WSL, or a similar Bash environment, and addresses the MSYS path-translation quirks that result.
Project-level conventions (Windows backslashes in tool calls, documentation discipline, etc.) live in the agent body and the windows-path-master plugin. This skill focuses on Bash content; do not duplicate that boilerplate here.
#!/usr/bin/env bash
set -euo pipefail # Exit on error, undefined vars, pipe failures
IFS=$'\n\t' # Safe word splitting
# Run shellcheck your_script.sh before deployment.
# Test on every target platform before production.
Bash-portability quick check:
# Linux/macOS: Full bash features
# Git Bash (Windows): Most features, some system calls missing (no systemd, /proc differs)
# WSL: Effectively Linux; /mnt/c for Windows filesystem
# Containers: Depends on base image - alpine ships /bin/sh, not bash
# POSIX mode: Use /bin/sh and avoid bashisms
Always activate for:
Do not use this skill for:
powershell-master.cmd/.bat) scriptingEvery script should open with the safety preamble:
#!/usr/bin/env bash
set -e # Exit on any error
set -u # Exit on undefined variable
set -o pipefail # Catch failures mid-pipeline
set -E # Inherit ERR trap into functions
IFS=$'\n\t' # Avoid word splitting on spaces
readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
readonly SCRIPT_NAME="$(basename "${BASH_SOURCE[0]}")"
Need to run on any UNIX sh | #!/bin/sh, no [[ ]], no arrays, no process substitution |
|---|---|
| Modern Linux/macOS with Bash | #!/usr/bin/env bash, prefer [[ ]], arrays, regex |
| Alpine/minimal containers | Either install bash explicitly or write POSIX-compliant sh |
# Always quote expansions
process "$file_path" # correct
process $file_path # word-splitting bug
# Arrays
files=("file 1.txt" "file 2.txt")
process "${files[@]}" # each element kept separate
process "${files[*]}" # joined as one string - usually wrong
Run shellcheck on every script. Only disable warnings with a justification comment: # shellcheck disable=SC2086 reason: intentional word splitting.
See references/best_practices.md for the full quoting/style table and references/patterns_antipatterns.md for the common pitfalls.
Git Bash auto-converts Unix-style arguments to Windows paths. This is the largest single source of cross-platform Bash bugs on Windows.
# The conversion: /foo becomes C:/Program Files/Git/usr/foo
# Disable per-command:
MSYS_NO_PATHCONV=1 command /path/that/should/stay/unix
# Manual conversion
unix_path=$(cygpath -u "C:\Windows\System32")
win_path=$(cygpath -w "/c/Users/username")
# Detect Git Bash
if [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "mingw"* ]]; then
: # Git Bash
fi
case "${MSYSTEM:-}" in
MINGW64|MINGW32|MSYS) : ;; # MSYS2 / Git Bash environment
esac
# Flags that look like paths
command //e //s # double-slash to suppress conversion
command -e -s # or use dash-options
Full Git Bash + Windows path notes live in references/windows-git-bash-paths.md.
GNU coreutils, /proc, systemd integration. Detect via [[ "$OSTYPE" == "linux-gnu"* ]].
BSD utilities behave differently from GNU. Most common gotchas: sed -i '' (empty string required), date flags differ, readlink -f not available on stock macOS.
if command -v gsed >/dev/null; then SED=gsed; else SED=sed; fi
Effectively Linux. The Windows filesystem is mounted at /mnt/c/. Detect via grep -qi microsoft /proc/version.
Alpine images ship only /bin/sh (BusyBox). Write POSIX-compliant scripts or apk add bash. Container init quirks: PID 1 must reap children and handle signals. Detect via [ -f /.dockerenv ] or [ -n "$KUBERNETES_SERVICE_HOST" ].
detect_platform() {
case "$OSTYPE" in
linux-gnu*) echo "linux" ;;
darwin*) echo "macos" ;;
msys*|cygwin*) echo "windows" ;;
*) echo "unknown" ;;
esac
}
Full per-platform tables (BSD-vs-GNU coreutils flags, WSL networking, container init patterns) live in references/platform_specifics.md.
The full patterns - function design, error handling, input validation, argument parsing, logging - live in references/in-depth-patterns.md. The headline rules:
UPPER_CASE; locals lower_case; mark immutable values readonly.if ! cmd, ||, traps, or a central error_exit helper).getopts or a case-based argument parser; print usage and exit 1 on bad input.These each have dedicated sections in references/in-depth-patterns.md:
| Topic | What it covers |
|---|---|
| Security | Command-injection prevention, path-traversal guards, privilege management, secure temp files |
| Performance | Avoiding subshells, bash built-ins vs externals, process substitution, array ops |
| Testing | BATS unit tests, integration test patterns, CI/CD wiring |
| Debugging | set -x, PS4, conditional debug helpers, tracing and profiling |
| Advanced patterns | Safe config parsing, parallel processing, signal handling, retries with backoff |
Read that reference any time you need the canonical code template for one of those topics.
references/platform_specifics.md - Detailed platform differences and workaroundsreferences/best_practices.md - Comprehensive industry standards and guidelinesreferences/patterns_antipatterns.md - Common patterns and pitfalls with solutionsreferences/windows-git-bash-paths.md - Git Bash / MSYS path-translation referencereferences/in-depth-patterns.md - Function design, security, performance, testing, debugging, advanced patternsreferences/resources.md - Official docs, style guides, tooling, and learning linksA Bash script written with this skill should:
shellcheck with no warningsset -euo pipefail-h/--helptrap EXIT)# Pre-deployment checklist
shellcheck script.sh
bash -n script.sh
bats test/script.bats
./script.sh --help
DEBUG=true ./script.sh
checkbashisms script.sh to surface non-portable constructs.command -v tool to verify a required tool is installed.sed --version etc.).shellcheck -W SC2086).PATH - set PATH explicitly../script.sh >> /tmp/cron.log 2>&1.time.set -x to find slow steps.references/best_practices.md (opens in a new tab)references/in-depth-patterns.md (opens in a new tab)references/patterns_antipatterns.md (opens in a new tab)references/platform_specifics.md (opens in a new tab)references/resources.md (opens in a new tab)references/windows-git-bash-paths.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub josiahsiegel/claude-plugin-marketplace --plugin bash-master10 skills in this plugin
/advanced-array-patternsAdvanced bash array patterns including indexed and associative arrays, mapfile/readarray, slicing, and array manipulation (2025).
PROACTIVELY activate for: (1) using bash arrays effectively, (2) reading file contents into an array via mapfile/readarray, (3) authoring associative arrays (declare -A), (4) iterating arrays safely under set -u, (5) deleting/inserting array elements, (6) joining and splitting arrays, (7) passing arrays to functions via nameref (declare -n), (8) array slicing and parameter expansion, (9) sorting and deduplicating arrays in pure bash.
Provides: indexed and associative array reference, mapfile and readarray recipes, nameref-based pass-by-reference, slicing/expansion patterns, and gotchas for unset variables and word splitting.
/bash-53-featuresBash 5.3 new features and modern patterns (2025).
PROACTIVELY activate for: (1) Bash 5.3 specific features (BASH_TRAPSIG, in-shell command substitution, ${|} REPLY syntax), (2) checking bash version compatibility, (3) migrating scripts to take advantage of 5.3 additions, (4) C23 conformance changes in bash 5.3, (5) new shopt and bind options, (6) trap handling improvements, (7) wait -p enhancements, (8) READLINE_ARGUMENT and history expansion changes.
Provides: complete 5.3 feature reference, version-detection snippets, compatibility shims for older bash, migration recipes, and POSIX.1-2024 alignment notes.
/debugging-troubleshooting-2025Comprehensive bash script debugging and troubleshooting techniques for 2025.
PROACTIVELY activate for: (1) debugging a misbehaving bash script, (2) using set -x, set -e, set -u, set -o pipefail (strict mode), (3) customizing PS4 for richer trace output, (4) trap DEBUG, ERR, and EXIT for diagnostics, (5) bashdb and other interactive debuggers, (6) profiling slow scripts (timing, BASH_REMATCH overhead), (7) reproducing CI-only failures locally, (8) resolving unbound variable or command not found errors, (9) understanding subshell vs current-shell variable scope.
Provides: strict-mode template, PS4 patterns, trap recipes for instrumentation, profiling techniques, and a step-by-step debugging playbook.
/modern-automation-patternsModern DevOps and CI/CD bash automation patterns with containers and cloud (2025).
PROACTIVELY activate for: (1) writing CI/CD scripts (GitHub Actions, GitLab CI, Azure DevOps), (2) container-aware shell scripting (detecting containers, Kubernetes pods), (3) cloud provider helpers (AWS CLI, Azure CLI, gcloud), (4) blue-green and canary deployments via bash, (5) writing idempotent rollback scripts, (6) integrating with Docker/Compose from bash, (7) cross-environment variable management, (8) build matrix orchestration.
Provides: copy-pasteable CI snippets, container detection helpers, cloud CLI wrappers, deployment orchestration patterns, and idempotent rollback templates.
/parallel-processing-patternsParallel and concurrent processing patterns in bash including GNU Parallel, xargs -P, job pools, and async patterns (2025).
PROACTIVELY activate for: (1) running tasks in parallel from bash, (2) xargs -P for parallel command execution, (3) GNU parallel for complex distribution, (4) background jobs with & and wait, (5) implementing a concurrency cap (job pool of N workers), (6) collecting exit codes from parallel children, (7) preventing race conditions in shared output files, (8) parallel file processing across many cores.
Provides: xargs -P recipes, GNU parallel quick reference, job-pool implementations in pure bash, exit-code aggregation patterns, and FIFO-based work queues.
/process-substitution-fifosProcess substitution, named pipes (FIFOs), and advanced IPC patterns for efficient bash data streaming (2025).
PROACTIVELY activate for: (1) using process substitution with <(cmd) and >(cmd), (2) creating named pipes (mkfifo) for inter-process streaming, (3) avoiding intermediate temp files in pipelines, (4) tee-ing into multiple consumers, (5) feeding diff/comm with command output, (6) building shell-only producers and consumers, (7) reading from a FIFO with timeout, (8) signal-safe FIFO cleanup.
Provides: process substitution patterns, mkfifo recipes, multi-consumer tee patterns, and signal-safe cleanup with trap.
Other plugins' skills for the same job