Master of defensive Bash scripting for production automation, CI/CD pipelines, and system utilities. Expert in safe, portable, and testable shell scripts.
42
Quality
28%
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Passed
No known issues
Optimize this skill with Tessl
npx tessl skill review --optimize ./.agent/skills/bash-pro/SKILL.mdset -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<(command) instead of temporary files when possible[[ $num =~ ^[0-9]+$ ]]eval on user input; use arrays for dynamic command construction(umask 077; touch "$secure_file")-- to separate options from arguments: rm -rf -- "$user_input": "${REQUIRED_VAR:?not set}"trap to ensure cleanup happens even on abnormal exitwhile read instead of for i in $(cat file)[[ ]] instead of test, ${var//pattern/replacement} instead of sedsed with multiple expressions)mapfile/readarray for efficient array population from command output$(( )) instead of expr for calculationsprintf over echo for formatted output (faster and more reliable)xargs -P for parallel processing when operations are independent--help and -h flags showing usage, options, and examples--version flag displaying script version and copyright informationshdoc from special comment formatsshellman for system integration${var@U} uppercase conversion, ${var@L} lowercase${parameter@operator} transformations, compat shopt options for compatibilityvarredir_close option, improved exec error handling, EPOCHREALTIME microsecond precision[[ ${BASH_VERSINFO[0]} -ge 5 && ${BASH_VERSINFO[1]} -ge 2 ]]${parameter@Q} for shell-quoted output (Bash 4.4+)${parameter@E} for escape sequence expansion (Bash 4.4+)${parameter@P} for prompt expansion (Bash 4.4+)${parameter@A} for assignment format (Bash 4.4+)wait -n to wait for any background job (Bash 4.3+)mapfile -d delim for custom delimiters (Bash 4.4+)shellcheck-problem-matchers for inline annotations.pre-commit-config.yaml with shellcheck, shfmt, checkbashismsshellcheck *.sh && shfmt -d *.sh && bats test/gitleaks or trufflehog to prevent credential leakslogger command for system log integrationlog_info() { logger -t "$SCRIPT_NAME" -p user.info "$*"; echo "[INFO] $*" >&2; }--help and provide clear usage information3395991
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.