create-slidev-presenta…
Build or edit Slidev (sli.dev) presentations for tech talks, workshops, conference sessions, and live-coding demos. Use when the…
This skill provides Shell/Bash coding standards and is automatically loaded for shell projects. It includes defensive scripting patterns, best practices, and recommended tooling.
Claude Code
$ npx -y skills add b33eep/claude-code-setup --skill standards-shell --agent claude-code
Codex
$ npx skills add b33eep/claude-code-setup --skill standards-shell -a codex -y
Cursor
$ npx skills add b33eep/claude-code-setup --skill standards-shell -a cursor -y
Gemini CLI
$ npx skills add b33eep/claude-code-setup --skill standards-shell -a gemini-cli -y
GitHub Copilot
$ npx skills add b33eep/claude-code-setup --skill standards-shell -a github-copilot -y
OpenCode
$ npx skills add b33eep/claude-code-setup --skill standards-shell -a opencode -y
Windsurf
$ npx skills add b33eep/claude-code-setup --skill standards-shell -a windsurf -y
name: standards-shell description: This skill provides Shell/Bash coding standards and is automatically loaded for shell projects. It includes defensive scripting patterns, best practices, and recommended tooling. type: context applies_to: [bash, sh, shell, zsh, shellcheck, bats] file_extensions: [".sh", ".bash"]
1. **Simplicity**: Simple, understandable scripts 2. **Readability**: Readability over cleverness 3. **Maintainability**: Scripts that are easy to maintain 4. **Testability**: Scripts that are easy to test 5. **DRY**: Don't Repeat Yourself - but don't overdo it 6. **Defensiveness**: Fail early, fail loudly
| Element | Convention | Example | |---------|------------|---------| | Variables | snake_case | `user_name`, `file_count` | | Functions | snake_case | `get_user_by_id`, `validate_input` | | Constants | UPPER_SNAKE_CASE | `MAX_RETRIES`, `DEFAULT_TIMEOUT` | | Files | kebab-case or snake_case | `deploy-app.sh`, `run_tests.sh` | | Environment Vars | UPPER_SNAKE_CASE | `API_URL`, `DATABASE_HOST` |
#!/bin/bash
set -euo pipefail
readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
readonly SCRIPT_NAME="$(basename "${BASH_SOURCE[0]}")"
# Cleanup on exit
cleanup() {
rm -f "$SCRIPT_DIR"/*.tmp 2>/dev/null || true
}
trap cleanup EXIT
# Error handler
error_handler() {
echo "Error on line $1" >&2
exit 1
}
trap 'error_handler $LINENO' ERR
main() {
# Script logic here
echo "Running $SCRIPT_NAME"
}
main "$@"# REQUIRED: Always start with this set -euo pipefail # -e: Exit on error # -u: Error on undefined variables # -o pipefail: Pipe fails if any command fails # RECOMMENDED: Safer IFS IFS=$'\n\t' # REQUIRED: Quote all variables echo "$var" # Good echo $var # Bad - word splitting # REQUIRED: Use [[ ]] for conditionals (Bash) if [[ -f "$file" ]]; then # Good if [ -f "$file" ]; then # POSIX only
# Defaults and validation
${var:-default} # Use default if unset
${var:=default} # Assign default if unset
${var:?error message} # Error if unset
# String manipulation
${var#pattern} # Remove prefix (shortest)
${var##pattern} # Remove prefix (longest)
${var%pattern} # Remove suffix (shortest)
${var%%pattern} # Remove suffix (longest)
${var/old/new} # Replace first
${var//old/new} # Replace all
${#var} # Length
# Examples
file="document.txt"
echo "${file%%.*}" # "document" (remove extension)
echo "${file##*.}" # "txt" (get extension)# REQUIRED: Use local variables
get_user_name() {
local user_id=$1
local name
name=$(grep "^${user_id}:" /etc/passwd | cut -d: -f5)
echo "$name"
}
# Return values via stdout
result=$(get_user_name "1000")
# Return status codes
validate_file() {
local file=$1
if [[ ! -f "$file" ]]; then
echo "Error: File not found: $file" >&2
return 1
fi
return 0
}
if validate_file "$input_file"; then
process_file "$input_file"
fi# Indexed arrays
files=("file1.txt" "file2.txt" "file3.txt")
echo "${files[0]}" # First element
echo "${files[@]}" # All elements
echo "${#files[@]}" # Array length
# Iterate safely
for file in "${files[@]}"; do
echo "Processing: $file"
done
# Associative arrays (Bash 4+)
declare -A config
config[host]="localhost"
config[port]="8080"
echo "${config[host]}:${config[port]}"# Read file line by line
while IFS= read -r line; do
echo "Line: $line"
done < "input.txt"
# Read into array
mapfile -t lines < "input.txt"
# Write to file (heredoc)
cat > output.txt <<EOF
Line 1
Line 2
EOF
# Temp files with cleanup
temp_file=$(mktemp)
trap 'rm -f "$temp_file"' EXIT# Trap for cleanup
cleanup() {
echo "Cleaning up..."
rm -f "$temp_file"
}
trap cleanup EXIT
# Trap for errors
error_handler() {
local line=$1
echo "Error occurred on line $line" >&2
}
trap 'error_handler $LINENO' ERR
# Check command exists
if ! command -v python3 &>/dev/null; then
echo "Error: python3 not found" >&2
exit 1
fi
# Conditional execution
command1 && command2 # Run command2 only if command1 succeeds
command1 || command2 # Run command2 only if command1 failsusage() {
echo "Usage: $0 [-v] [-o output] [-h]"
echo " -v Verbose mode"
echo " -o FILE Output file"
echo " -h Show help"
exit 1
}
verbose=false
output_file=""
while getopts "vo:h" opt; do
case $opt in
v) verbose=true ;;
o) output_file="$OPTARG" ;;
h) usage ;;
*) usage ;;
esac
done
shift $((OPTIND - 1))
# Remaining args in $@log() {
local level=$1
shift
echo "[$(date '+%Y-%m-%d %H:%M:%S')] [$level] $*" >&2
}
log_info() { log "INFO" "$@"; }
log_warn() { log "WARN" "$@"; }
log_error() { log "ERROR" "$@"; }
# Usage
log_info "Starting process"
log_error "Failed to connect"# Enable debugging
set -x # Print commands
PS4='+ ${BASH_SOURCE}:${LINENO}: ' # Better debug output
# Debug specific section
set -x
# code to debug
set +x
# Run script with debug
bash -x script.sh
bash -n script.sh # Syntax check only#
This project is archived and no longer maintained. Claude Code Setup has not been developed for a while. Its concepts now live on in our own Claude Code plugins.
Build or edit Slidev (sli.dev) presentations for tech talks, workshops, conference sessions, and live-coding demos. Use when the…
Guide users through creating, reviewing, and fixing custom skills for Claude — both command skills (invoked via /slash) and…
Gradle build tool standards focusing on Kotlin DSL. Covers project configuration, dependency management, and custom plugin/task…
Java coding standards for enterprise applications. Includes naming conventions, modern Java features, design patterns, and…
This skill provides JavaScript coding standards and is automatically loaded for JavaScript projects. It includes modern ES2025…
Kotlin coding standards for modern applications. Includes naming conventions, coroutines, flows, modern Kotlin 2.3.0 features,…
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
Ask which skill or flow fits your situation. A router over the skills in this repo.