Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Bash scripting development standards, error handling, and best practices. Use when writing, editing, or reviewing .sh files or Bash scripts, when the user asks about Bash patterns/conventions, or when shell script quality guidance is needed.
.claude/skills/aiskillstore-bash-dev/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-02 | ✗→✓ | ▲ Improved | 60% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 72% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 60% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 112% | 0% |
| case-18 | ✗→✓ | ▲ Improved | 183% | 0% |
This skill supports Bash script development with best practices and safety standards.
#!/usr/bin/env bashset -euo pipefail-e: Exit on error-u: Exit on undefined variable-o pipefail: Fail pipeline if any command fails"${var}"readonly for constantslocal keywordbash#!/usr/bin/env bash set -euo pipefail # Script metadata # Usage: script_name.sh <arg1> [arg2] # Description: What this script does # Author: Your Name # Version: 1.0.0 # Global constants (UPPERCASE) readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" readonly SCRIPT_NAME="$(basename "${BASH_SOURCE[0]}")" readonly VERSION="1.0.0" # Color codes for output readonly RED='\033[0;31m' readonly GREEN='\033[0;32m' readonly YELLOW='\033[1;33m' readonly NC='\033[0m' # No Color ####################################### # Display usage information # Globals: # SCRIPT_NAME # Arguments: # None # Outputs: # Writes usage to stdout ####################################### usage() { cat <<EOF Usage: ${SCRIPT_NAME} <arg1> [arg2] Description: What this script does in detail Arguments: arg1 Required argument description arg2 Optional argument description (default: value) Options: -h, --help Show this help message -v, --version Show version information Examples: ${SCRIPT_NAME} value1 ${SCRIPT_NAME} value1 value2 EOF } ####################################### # Print error message and exit # Globals: # RED, NC # Arguments: # Error message # Outputs: # Writes error to stderr # Returns: # 1 (error code) ####################################### error() { echo -e "${RED}Error: $*${NC}" >&2 exit 1 } ####################################### # Print info message # Globals: # GREEN, NC # Arguments: # Info message # Outputs: # Writes message to stdout ####################################### info() { echo -e "${GREEN}Info: $*${NC}" } ####################################### # Print warning message # Globals: # YELLOW, NC # Arguments: # Warning message # Outputs: # Writes warning to stdout ####################################### warn() { echo -e "${YELLOW}Warning: $*${NC}" } ####################################### # Main function # Globals: # None # Arguments: # Command line arguments # Returns: # 0 on success, 1 on error ####################################### main() { local arg1="${1:?Error: arg1 required}" local arg2="${2:-default_value}" info "Processing: ${arg1}" # Your logic here info "Completed successfully" return 0 } # Error handler trap 'error "Script failed on line $LINENO"' ERR # Parse arguments case "${1:-}" in -h|--help) usage exit 0 ;; -v|--version) echo "${SCRIPT_NAME} version ${VERSION}" exit 0 ;; esac # Execute main function main "$@"
bash# Check if command exists if ! command -v git &> /dev/null; then error "git is not installed" fi # Check if file exists if [[ ! -f "${config_file}" ]]; then error "Config file not found: ${config_file}" fi # Check if directory exists if [[ ! -d "${target_dir}" ]]; then mkdir -p "${target_dir}" || error "Failed to create directory" fi
bash# Validate required argument validate_arg() { local arg="${1:?Error: argument required}" if [[ -z "${arg}" ]]; then error "Argument cannot be empty" fi } # Validate number validate_number() { local num="$1" if ! [[ "${num}" =~ ^[0-9]+$ ]]; then error "Invalid number: ${num}" fi }
bash# Safe file read read_file() { local file="$1" if [[ ! -r "${file}" ]]; then error "Cannot read file: ${file}" fi cat "${file}" } # Safe file write write_file() { local file="$1" local content="$2" echo "${content}" > "${file}" || error "Failed to write file" }
bash# Declare array declare -a items=("item1" "item2" "item3") # Iterate over array for item in "${items[@]}"; do echo "Processing: ${item}" done # Array length echo "Total items: ${#items[@]}"
Check these before committing:
#!/usr/bin/env bash presentset -euo pipefail at the beginning"${var}"local keywordshellcheck❌ Don't:
bash# Unquoted variables cd $HOME/dir # Missing error handling mkdir /some/dir # Undefined variables echo $UNDEFINED_VAR # No set options #!/bin/bash
✅ Do:
bash# Quoted variables cd "${HOME}/dir" || error "Failed to change directory" # With error handling mkdir -p "${target_dir}" || error "Failed to create directory" # Check before use if [[ -n "${VAR:-}" ]]; then echo "${VAR}" fi # Proper set options #!/usr/bin/env bash set -euo pipefail
bash# Install shellcheck brew install shellcheck # macOS # Check script shellcheck script.sh # Ignore specific warnings # shellcheck disable=SC2086 command ${unquoted}
bash# Simple test function test_function() { local expected="expected_value" local actual actual="$(your_function)" if [[ "${actual}" != "${expected}" ]]; then error "Test failed: expected '${expected}', got '${actual}'" fi info "Test passed" }
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-04 | pass→pass | 25,570 | 12,630 | -51% | 1 | 1 | 0% | 3,616 | 4,570 | +26% | 0 | 0 | — |
case-01 | fail→fail | 24,609 | 24,885 | +1% | 1 | 1 | 0% | 5,083 | 5,865 | +15% | 0 | 0 | — |
case-02 | fail→pass | 21,065 | 14,864 | -29% | 1 | 1 | 0% | 2,996 | 4,801 | +60% | 0 | 0 | — |
case-03 | fail→fail | 19,552 | 25,029 | +28% | 1 | 1 | 0% | 4,415 | 5,699 | +29% | 0 | 0 | — |
case-05 | pass→pass | 20,081 | 12,147 | -40% | 1 | 1 | 0% | 2,650 | 3,998 | +51% | 0 | 0 | — |
case-06 | fail→pass | 16,103 | 8,256 | -49% | 1 | 1 | 0% | 1,917 | 3,295 | +72% | 0 | 0 | — |
case-07 | fail→pass | 31,884 | 15,298 | -52% | 1 | 1 | 0% | 2,125 | 3,394 | +60% | 0 | 0 | — |
case-08 | fail→pass | 15,908 | 16,397 | +3% | 1 | 1 | 0% | 1,832 | 3,891 | +112% | 0 | 0 | — |
case-09 | pass→pass | 20,879 | 15,939 | -24% | 1 | 1 | 0% | 2,505 | 3,018 | +20% | 0 | 0 | — |
case-10 | pass→pass | 12,474 | 14,281 | +14% | 1 | 1 | 0% | 2,273 | 4,358 | +92% | 0 | 0 | — |
case-11 | pass→pass | 11,961 | 5,538 | -54% | 1 | 1 | 0% | 1,183 | 2,779 | +135% | 0 | 0 | — |
case-12 | pass→pass | 11,468 | 9,316 | -19% | 1 | 1 | 0% | 2,155 | 3,459 | +61% | 0 | 0 | — |
case-13 | fail→fail | 14,599 | 14,302 | -2% | 1 | 1 | 0% | 1,706 | 3,146 | +84% | 0 | 0 | — |
case-14 | fail→fail | 11,182 | 7,693 | -31% | 1 | 1 | 0% | 1,072 | 3,179 | +197% | 0 | 0 | — |
case-15 | pass→pass | 10,710 | 13,218 | +23% | 1 | 1 | 0% | 1,835 | 3,193 | +74% | 0 | 0 | — |
case-16 | fail→fail | 17,739 | 9,642 | -46% | 1 | 1 | 0% | 2,445 | 3,535 | +45% | 0 | 0 | — |
case-17 | fail→fail | 17,624 | 16,725 | -5% | 1 | 1 | 0% | 2,159 | 3,907 | +81% | 0 | 0 | — |
case-18 | fail→pass | 10,737 | 6,147 | -43% | 1 | 1 | 0% | 997 | 2,826 | +183% | 0 | 0 | — |
case-19 | fail→fail | 16,088 | 14,617 | -9% | 1 | 1 | 0% | 1,907 | 3,427 | +80% | 0 | 0 | — |
case-20 | fail→fail | 15,987 | 13,963 | -13% | 1 | 1 | 0% | 2,017 | 4,458 | +121% | 0 | 0 | — |
case-21 | fail→fail | 20,253 | 21,186 | +5% | 1 | 1 | 0% | 3,248 | 5,197 | +60% | 0 | 0 | — |
case-22 | pass→pass | 17,842 | 20,145 | +13% | 1 | 1 | 0% | 2,397 | 5,906 | +146% | 0 | 0 | — |
case-23 | pass→pass | 13,987 | 18,554 | +33% | 1 | 1 | 0% | 1,677 | 4,365 | +160% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 23 cases were attempted. The headline lift of +22 percentage points is the difference between those two pass rates over the 23 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.