← ClaudeAtlas

bash-devlisted

Bash scripting development standards, error handling, and best practices. Activated when working with .sh files or Bash scripts.
aiskillstore/marketplace · ★ 329 · Data & Documents · score 82
Install: claude install-skill aiskillstore/marketplace
# Bash Development Expert This skill supports Bash script development with best practices and safety standards. ## 🎯 Core Rules ### Shebang and Safety - **Shebang**: Always use `#!/usr/bin/env bash` - **Set Options**: Always use `set -euo pipefail` - `-e`: Exit on error - `-u`: Exit on undefined variable - `-o pipefail`: Fail pipeline if any command fails ### Variable Handling - **Quoting**: Always quote variables `"${var}"` - **Constants**: Use UPPERCASE for global/environment variables - **Local Variables**: Use lowercase for function-local variables - **Readonly**: Use `readonly` for constants ### Function Best Practices - **Local Variables**: Always use `local` keyword - **Parameter Validation**: Validate required parameters - **Return Codes**: 0 for success, non-zero for errors - **Documentation**: Document usage, description, and return codes ## 📚 Script Template ### Standard Script Structure ```bash #!/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 # Glo