Shell Expert Expert knowledge for shell scripting, command-line tools, and automation with focus on robust, portable, and efficient solutions. Core Expertise Command-Line Tool Mastery - Expert knowledge of modern CLI tools (jq, yq, fd, rg, etc.) - JSON/YAML processing and transformation - File searching and text manipulation - System automation and orchestration Shell Scripting Excellence - POSIX-compliant shell scripting for maximum portability - Bash-specific features and best practices - Error handling and defensive programming - Cross-platform compatibility (Linux, macOS, BSD) Automation…

\\n\\t'\n\ntrap 'echo \"Error on line $LINENO\"' ERR\ntrap cleanup EXIT\n\ncleanup() {\n rm -f \"$TEMP_FILE\" 2>/dev/null || true\n}\n\nmain() {\n parse_args \"$@\"\n validate_environment\n execute_task\n}\n\nmain \"$@\"\n```\n\n**Cross-Platform Detection**\n```bash\ndetect_os() {\n case \"$OSTYPE\" in\n linux*) OS=\"linux\" ;;\n darwin*) OS=\"macos\" ;;\n msys*) OS=\"windows\" ;;\n *) OS=\"unknown\" ;;\n esac\n}\n```\n\nFor detailed command-line tools reference, advanced automation examples, and troubleshooting guidance, see REFERENCE.md.\n---","attachment_filenames":["REFERENCE.md"],"attachments":[{"filename":"REFERENCE.md","content":"# Shell Expert - Detailed Reference\n\n## Command-Line Tools Reference\n\n### jq - JSON Query and Transformation\n\n```bash\n# Pretty-print JSON\njq . data.json\n\n# Extract specific value\njq -r '.key.subkey' data.json\n\n# Filter arrays\njq '.items[] | select(.status == \"active\")' data.json\n\n# Transform structure\njq '{name: .fullName, age: .years}' data.json\n\n# Multiple filters\njq '.items[] | select(.status == \"active\") | {name, id}' data.json\n\n# Array operations\njq '[.items[] | .price] | add' data.json # Sum prices\njq '.items | length' data.json # Count items\njq '.items | sort_by(.name)' data.json # Sort array\n```\n\n### yq - YAML Query and Edit\n\n```bash\n# Read value\nyq '.services.web.image' docker-compose.yml\n\n# Update in-place\nyq -i '.version = \"2.1.0\"' config.yml\n\n# Convert YAML to JSON\nyq -o json config.yml\n\n# Convert JSON to YAML\nyq -P config.json\n\n# Merge YAML files\nyq eval-all 'select(fileIndex == 0) * select(fileIndex == 1)' base.yml override.yml\n\n# Delete key\nyq -i 'del(.obsolete.key)' config.yml\n\n# Add array element\nyq -i '.items += [\"new-item\"]' config.yml\n```\n\n### jd - JSON Diff and Patch\n\n```bash\n# Show differences\njd v1.json v2.json\n\n# Create patch file\njd -set v1.json v2.json > patch.json\n\n# Apply patch\njd -p patch.json v1.json\n\n# Output formats\njd -f patch v1.json v2.json # Patch format\njd -f merge v1.json v2.json # Merge format\n```\n\n### fd - Modern Find Alternative\n\n```bash\n# Find by pattern\nfd 'ReportGenerator'\n\n# Find by extension\nfd -e md\nfd -e 'js' -e 'ts' # Multiple extensions\n\n# Find and execute\nfd -e sh -x shellcheck {}\n\n# Find with size constraints\nfd --size +1M # Larger than 1MB\nfd --size -10k # Smaller than 10KB\n\n# Find by type\nfd -t f # Files only\nfd -t d # Directories only\nfd -t l # Symlinks only\n\n# Exclude patterns\nfd -E 'node_modules' -E '.git'\n\n# Case-insensitive\nfd -i readme\n```\n\n### rg (ripgrep) - Fast Recursive Grep\n\n```bash\n# Basic search\nrg 'DATABASE_URL'\n\n# Search specific file types\nrg 'TODO' -t python\nrg 'import' -t js -t ts\n\n# Search with context\nrg -C 3 'error' # 3 lines before and after\nrg -A 2 'error' # 2 lines after\nrg -B 2 'error' # 2 lines before\n\n# Search and replace preview\nrg 'old_name' --replace 'new_name'\n\n# Case-insensitive\nrg -i 'error'\n\n# Whole word match\nrg -w 'test'\n\n# Show files without matches\nrg --files-without-match 'pattern'\n\n# Count matches\nrg -c 'pattern'\n\n# Only show filenames\nrg -l 'pattern'\n\n# Ignore git and hidden files\nrg --no-ignore --hidden 'pattern'\n```\n\n### lsd - Modern ls\n\n```bash\n# List with icons and details\nlsd -l\n\n# Tree view\nlsd --tree\nlsd --tree --depth 2\n\n# Sort by time\nlsd -lt\n\n# Sort by size\nlsd -lS\n\n# Show file permissions octal\nlsd -l --permission octal\n\n# Human-readable sizes\nlsd -lh\n\n# Show all files including hidden\nlsd -la\n```\n\n### mermaid-cli - Diagrams as Code\n\n```bash\n# Generate SVG from Mermaid definition\nmmdc -i flow.mmd -o flow.svg\n\n# Generate PNG with custom theme\nmmdc -i diagram.mmd -o diagram.png -t dark\n\n# Generate PDF\nmmdc -i chart.mmd -o chart.pdf\n\n# Set background color\nmmdc -i diagram.mmd -o diagram.png -b transparent\n\n# Set width\nmmdc -i diagram.mmd -o diagram.png -w 1920\n```\n\n## Advanced Automation Examples\n\n### Parallel Execution Pattern\n\n```bash\n# Using GNU parallel\nfind . -name \"*.log\" | parallel -j+0 gzip {}\n\n# Using xargs\nfind . -name \"*.txt\" -print0 | xargs -0 -P 4 -I {} process_file {}\n\n# Background jobs with wait\nfor file in *.data; do\n process_heavy \"$file\" &\n # Limit concurrent jobs\n while (( $(jobs -r | wc -l) >= 4 )); do\n sleep 0.1\n done\ndone\nwait # Wait for all remaining jobs\n\n# Parallel with progress\nparallel --bar -j4 process_file ::: *.txt\n```\n\n### Cross-Platform Detection\n\n```bash\ndetect_distro() {\n if [[ -f /etc/os-release ]]; then\n . /etc/os-release\n DISTRO=\"$ID\"\n DISTRO_VERSION=\"$VERSION_ID\"\n fi\n}\n\ndetect_architecture() {\n case \"$(uname -m)\" in\n x86_64) ARCH=\"amd64\" ;;\n aarch64) ARCH=\"arm64\" ;;\n armv7l) ARCH=\"armv7\" ;;\n *) ARCH=\"unknown\" ;;\n esac\n}\n\ncheck_command() {\n command -v \"$1\" >/dev/null 2>&1\n}\n```\n\n### Argument Parsing\n\n```bash\nparse_args() {\n while [[ $# -gt 0 ]]; do\n case $1 in\n -h|--help)\n show_help\n exit 0\n ;;\n -v|--verbose)\n VERBOSE=1\n shift\n ;;\n -o|--output)\n OUTPUT_FILE=\"$2\"\n shift 2\n ;;\n --)\n shift\n break\n ;;\n -*)\n echo \"Unknown option: $1\" >&2\n exit 1\n ;;\n *)\n POSITIONAL_ARGS+=(\"$1\")\n shift\n ;;\n esac\n done\n}\n```\n\n### File Locking\n\n```bash\n# Using flock\n(\n flock -x 200 # Exclusive lock\n # Critical section\n echo \"Processing...\"\n) 200>/var/lock/myapp.lock\n\n# Using mkdir (atomic operation)\nlock_dir=\"/var/lock/myapp.lock\"\nif mkdir \"$lock_dir\" 2>/dev/null; then\n trap 'rmdir \"$lock_dir\"' EXIT\n # Critical section\nelse\n echo \"Another instance is running\" >&2\n exit 1\nfi\n```\n\n### Retry Logic\n\n```bash\nretry() {\n local max_attempts=\"$1\"\n local delay=\"$2\"\n local command=\"${@:3}\"\n local attempt=1\n\n until $command; do\n if (( attempt >= max_attempts )); then\n echo \"Command failed after $max_attempts attempts\" >&2\n return 1\n fi\n echo \"Attempt $attempt failed. Retrying in ${delay}s...\" >&2\n sleep \"$delay\"\n ((attempt++))\n done\n}\n\n# Usage\nretry 3 5 curl -f https://example.com/api\n```\n\n### Logging Functions\n\n```bash\nlog() {\n echo \"[$(date +'%Y-%m-%d %H:%M:%S')] $*\" >&2\n}\n\nlog_info() {\n log \"INFO: $*\"\n}\n\nlog_error() {\n log \"ERROR: $*\"\n}\n\nlog_debug() {\n [[ -n \"${DEBUG:-}\" ]] && log \"DEBUG: $*\"\n}\n```\n\n### Configuration File Parsing\n\n```bash\n# Parse simple KEY=VALUE config\nparse_config() {\n local config_file=\"$1\"\n while IFS='=' read -r key value; do\n # Skip comments and empty lines\n [[ \"$key\" =~ ^[[:space:]]*# ]] && continue\n [[ -z \"$key\" ]] && continue\n\n # Remove leading/trailing whitespace\n key=$(echo \"$key\" | xargs)\n value=$(echo \"$value\" | xargs)\n\n # Export as environment variable\n export \"$key\"=\"$value\"\n done \u003c \"$config_file\"\n}\n```\n\n## Troubleshooting Guide\n\n### Common Issues and Solutions\n\n**Spaces in filenames**\n```bash\n# Wrong\nfor file in $(find . -name \"*.txt\"); do\n process \"$file\" # Breaks on spaces\ndone\n\n# Right\nfind . -name \"*.txt\" -print0 | while IFS= read -r -d '' file; do\n process \"$file\"\ndone\n\n# Or use array\nwhile IFS= read -r -d '' file; do\n files+=(\"$file\")\ndone \u003c \u003c(find . -name \"*.txt\" -print0)\n\nfor file in \"${files[@]}\"; do\n process \"$file\"\ndone\n```\n\n**Pipe failures**\n```bash\n# Without pipefail\nfalse | true\necho $? # Returns 0\n\n# With pipefail\nset -o pipefail\nfalse | true\necho $? # Returns 1\n```\n\n**Race conditions**\n```bash\n# Wrong - race condition\nif [[ ! -f \"$file\" ]]; then\n touch \"$file\"\nfi\n\n# Right - atomic operation\nset -o noclobber\necho \"data\" > \"$file\" || {\n echo \"File already exists\" >&2\n exit 1\n}\n```\n\n**Signal handling**\n```bash\ncleanup() {\n local exit_code=$?\n # Cleanup resources\n rm -f \"$TEMP_FILE\"\n kill \"${CHILD_PID:-}\" 2>/dev/null\n exit $exit_code\n}\n\ntrap cleanup EXIT\ntrap 'echo \"Interrupted\" >&2; exit 130' INT\ntrap 'echo \"Terminated\" >&2; exit 143' TERM\n```\n\n**Performance issues**\n```bash\n# Wrong - slow\nfor file in *.log; do\n count=$(grep -c \"ERROR\" \"$file\")\n echo \"$file: $count\"\ndone\n\n# Right - faster\ngrep -c \"ERROR\" *.log\n\n# Profile with time\ntime {\n # Commands to profile\n}\n\n# Profile with strace\nstrace -c script.sh\n```\n\n**Portability problems**\n```bash\n# Test POSIX compliance\ndash script.sh\nash script.sh\n\n# Check for bash-specific features\nshellcheck --shell=sh script.sh\n\n# Portable shebang\n#!/usr/bin/env bash\n\n# Check for required commands\nfor cmd in jq curl; do\n if ! command -v \"$cmd\" >/dev/null 2>&1; then\n echo \"Error: $cmd is required but not installed\" >&2\n exit 1\n fi\ndone\n```\n\n## Performance Optimization Tips\n\n1. **Avoid unnecessary subshells**: Use `${var//search/replace}` instead of `$(echo \"$var\" | sed 's/search/replace/')`\n2. **Use built-in commands**: Prefer `[[ ]]` over `[ ]`, use `${#var}` instead of `$(echo \"$var\" | wc -c)`\n3. **Minimize external commands**: Use bash built-ins when possible\n4. **Batch operations**: Process multiple files at once instead of one by one\n5. **Use parallel processing**: Leverage multiple cores with parallel or xargs -P\n6. **Profile before optimizing**: Use `time` and `strace` to identify bottlenecks\n","content_type":"text/markdown; charset=utf-8","language":"markdown","size":8801,"content_sha256":"9a8bbdaf8428bcbab48585af28d6f12d51913e91f8adaa7f915cc278589ccd57"}],"content_json":{"type":"doc","content":[{"type":"heading","attrs":{"level":1},"content":[{"text":"Shell Expert","type":"text"}]},{"type":"paragraph","content":[{"text":"Expert knowledge for shell scripting, command-line tools, and automation with focus on robust, portable, and efficient solutions.","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Core Expertise","type":"text"}]},{"type":"paragraph","content":[{"text":"Command-Line Tool Mastery","type":"text","marks":[{"type":"strong"}]}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Expert knowledge of modern CLI tools (jq, yq, fd, rg, etc.)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"JSON/YAML processing and transformation","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"File searching and text manipulation","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"System automation and orchestration","type":"text"}]}]}]},{"type":"paragraph","content":[{"text":"Shell Scripting Excellence","type":"text","marks":[{"type":"strong"}]}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"POSIX-compliant shell scripting for maximum portability","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Bash-specific features and best practices","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Error handling and defensive programming","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Cross-platform compatibility (Linux, macOS, BSD)","type":"text"}]}]}]},{"type":"paragraph","content":[{"text":"Automation & Integration","type":"text","marks":[{"type":"strong"}]}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"CI/CD pipeline scripting","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"System administration automation","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Tool integration and workflow automation","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Performance optimization for shell operations","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Key Capabilities","type":"text"}]},{"type":"paragraph","content":[{"text":"JSON/YAML Processing","type":"text","marks":[{"type":"strong"}]}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"jq","type":"text","marks":[{"type":"strong"}]},{"text":": Complex JSON queries, transformations, and filtering","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"yq","type":"text","marks":[{"type":"strong"}]},{"text":": YAML manipulation, in-place editing, format conversion","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"jd","type":"text","marks":[{"type":"strong"}]},{"text":": JSON diffing and patching for configuration management","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Data pipeline construction","type":"text","marks":[{"type":"strong"}]},{"text":": Chaining tools for complex transformations","type":"text"}]}]}]},{"type":"paragraph","content":[{"text":"File Operations & Search","type":"text","marks":[{"type":"strong"}]}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"fd","type":"text","marks":[{"type":"strong"}]},{"text":": Fast, user-friendly file finding with intuitive syntax","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"rg (ripgrep)","type":"text","marks":[{"type":"strong"}]},{"text":": Lightning-fast recursive grep with gitignore support","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"lsd","type":"text","marks":[{"type":"strong"}]},{"text":": Modern ls replacement with visual enhancements","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"find/grep alternatives","type":"text","marks":[{"type":"strong"}]},{"text":": When and how to use modern replacements","type":"text"}]}]}]},{"type":"paragraph","content":[{"text":"Shell Script Development","type":"text","marks":[{"type":"strong"}]}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Error Handling","type":"text","marks":[{"type":"strong"}]},{"text":": Proper trap usage, exit codes, error propagation","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Input Validation","type":"text","marks":[{"type":"strong"}]},{"text":": Argument parsing, option handling, user input sanitization","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Debugging","type":"text","marks":[{"type":"strong"}]},{"text":": Set options (-x, -e, -u, -o pipefail), debug output strategies","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Performance","type":"text","marks":[{"type":"strong"}]},{"text":": Process substitution, parallel execution, efficient loops","type":"text"}]}]}]},{"type":"paragraph","content":[{"text":"Cross-Platform Scripting","type":"text","marks":[{"type":"strong"}]}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Platform Detection","type":"text","marks":[{"type":"strong"}]},{"text":": OS-specific behavior handling","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Path Management","type":"text","marks":[{"type":"strong"}]},{"text":": Portable path construction and manipulation","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Tool Availability","type":"text","marks":[{"type":"strong"}]},{"text":": Checking for and handling missing dependencies","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Compatibility Layers","type":"text","marks":[{"type":"strong"}]},{"text":": Writing scripts that work everywhere","type":"text"}]}]}]},{"type":"paragraph","content":[{"text":"Automation Patterns","type":"text","marks":[{"type":"strong"}]}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Idempotent Operations","type":"text","marks":[{"type":"strong"}]},{"text":": Scripts that can run multiple times safely","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Atomic Operations","type":"text","marks":[{"type":"strong"}]},{"text":": Ensuring all-or-nothing execution","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Progress Reporting","type":"text","marks":[{"type":"strong"}]},{"text":": User-friendly output and status updates","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Logging & Monitoring","type":"text","marks":[{"type":"strong"}]},{"text":": Structured logging for automated systems","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Essential Commands","type":"text"}]},{"type":"paragraph","content":[{"text":"jq - JSON Processing","type":"text","marks":[{"type":"strong"}]}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"jq . data.json # Pretty-print\njq -r '.key.subkey' data.json # Extract value\njq '.items[] | select(.status == \"active\")' # Filter","type":"text"}]},{"type":"paragraph","content":[{"text":"yq - YAML Processing","type":"text","marks":[{"type":"strong"}]}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"yq '.services.web.image' docker-compose.yml # Read value\nyq -i '.version = \"2.1.0\"' config.yml # Update in-place\nyq -o json config.yml # Convert to JSON","type":"text"}]},{"type":"paragraph","content":[{"text":"fd - Fast File Finding","type":"text","marks":[{"type":"strong"}]}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"fd 'pattern' # Find by pattern\nfd -e md # Find by extension\nfd -e sh -x shellcheck {} # Find and execute","type":"text"}]},{"type":"paragraph","content":[{"text":"rg - Recursive Grep","type":"text","marks":[{"type":"strong"}]}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"rg 'DATABASE_URL' # Basic search\nrg 'TODO' -t python # Search specific file types\nrg -C 3 'error' # Search with context","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Best Practices","type":"text"}]},{"type":"paragraph","content":[{"text":"Script Development Workflow","type":"text","marks":[{"type":"strong"}]}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Requirements Analysis","type":"text","marks":[{"type":"strong"}]},{"text":": Understand automation need and target platforms","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Tool Selection","type":"text","marks":[{"type":"strong"}]},{"text":": Choose appropriate tools for the task","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Prototype Development","type":"text","marks":[{"type":"strong"}]},{"text":": Create initial script with core functionality","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Error Handling","type":"text","marks":[{"type":"strong"}]},{"text":": Add robust error handling and edge case management","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Cross-Platform Testing","type":"text","marks":[{"type":"strong"}]},{"text":": Verify script works on all target systems","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Performance Optimization","type":"text","marks":[{"type":"strong"}]},{"text":": Profile and optimize for efficiency","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Documentation","type":"text","marks":[{"type":"strong"}]},{"text":": Add clear usage instructions and inline comments","type":"text"}]}]}]},{"type":"paragraph","content":[{"text":"Critical Guidelines","type":"text","marks":[{"type":"strong"}]}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Always use shellcheck for linting","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Set strict mode: ","type":"text"},{"text":"set -euo pipefail","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Quote all variables: ","type":"text"},{"text":"\"${var}\"","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Use functions for reusable code","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Implement proper cleanup with trap","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Provide helpful error messages","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Include --help and --version options","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Use meaningful variable names","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Comment complex logic","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Test with different shells when targeting POSIX","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Common Patterns","type":"text"}]},{"type":"paragraph","content":[{"text":"Robust Script Template","type":"text","marks":[{"type":"strong"}]}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"#!/usr/bin/env bash\nset -euo pipefail\nIFS=

Shell Expert Expert knowledge for shell scripting, command-line tools, and automation with focus on robust, portable, and efficient solutions. Core Expertise Command-Line Tool Mastery - Expert knowledge of modern CLI tools (jq, yq, fd, rg, etc.) - JSON/YAML processing and transformation - File searching and text manipulation - System automation and orchestration Shell Scripting Excellence - POSIX-compliant shell scripting for maximum portability - Bash-specific features and best practices - Error handling and defensive programming - Cross-platform compatibility (Linux, macOS, BSD) Automation…

\\n\\t'\n\ntrap 'echo \"Error on line $LINENO\"' ERR\ntrap cleanup EXIT\n\ncleanup() {\n rm -f \"$TEMP_FILE\" 2>/dev/null || true\n}\n\nmain() {\n parse_args \"$@\"\n validate_environment\n execute_task\n}\n\nmain \"$@\"","type":"text"}]},{"type":"paragraph","content":[{"text":"Cross-Platform Detection","type":"text","marks":[{"type":"strong"}]}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"detect_os() {\n case \"$OSTYPE\" in\n linux*) OS=\"linux\" ;;\n darwin*) OS=\"macos\" ;;\n msys*) OS=\"windows\" ;;\n *) OS=\"unknown\" ;;\n esac\n}","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"For detailed command-line tools reference, advanced automation examples, and troubleshooting guidance, see REFERENCE.md.","type":"text"}]}]},"metadata":{"date":"2026-06-05","name":"shell-expert","author":"@skillopedia","source":{"stars":65,"repo_name":"claude-code-skills","origin_url":"https://github.com/aaaaqwq/claude-code-skills/blob/HEAD/skills/shell-expert/SKILL.md","repo_owner":"aaaaqwq","body_sha256":"a9c88143364756d49f4e1a9a5dbc777d9225a2121297e713323aa7b149dcd547","cluster_key":"a3cdf6df90003b2839e67daeab593c8e44fa3205130b7badf25d87056ce302ab","clean_bundle":{"format":"clean-skill-bundle-v1","source":"aaaaqwq/claude-code-skills/skills/shell-expert/SKILL.md","attachments":[{"id":"70bf9115-6518-58c8-898a-be722172b371","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/70bf9115-6518-58c8-898a-be722172b371/attachment.md","path":"REFERENCE.md","size":8801,"sha256":"9a8bbdaf8428bcbab48585af28d6f12d51913e91f8adaa7f915cc278589ccd57","contentType":"text/markdown; charset=utf-8"}],"bundle_sha256":"37b921c2f81d53d672a52339da27a806b061164025582086c3b4b3438aec0a31","attachment_count":1,"text_attachments":1,"attachment_storage":"skillopedia-attachments-v1","binary_attachments":0,"excluded_attachments":[]},"cluster_size":1,"skill_md_path":"skills/shell-expert/SKILL.md","import_metadata":{"date":"2026-06-05","author":"@skillopedia","version":"v1","category":"software-engineering","category_label":"Engineering"},"exact_dupes_collapsed_into_this":0},"created":"2025-12-16T00:00:00.000Z","version":"v1","category":"software-engineering","modified":"2025-12-16T00:00:00.000Z","reviewed":"2026-02-08T00:00:00.000Z","import_tag":"clean-skills-v1","description":"Shell scripting expertise, command-line tools, automation, and cross-platform\nscripting best practices. Covers shell script development, CLI tool usage,\nand system automation with bash, zsh, and POSIX shell.\nUse when user mentions shell scripts, bash, zsh, CLI commands, pipes, command-line\nautomation, or writing portable shell code.\n","allowed-tools":"Bash, BashOutput, KillShell, Grep, Glob, Read, Write, Edit, TodoWrite","user-invocable":false}},"renderedAt":1782979603081}

Shell Expert Expert knowledge for shell scripting, command-line tools, and automation with focus on robust, portable, and efficient solutions. Core Expertise Command-Line Tool Mastery - Expert knowledge of modern CLI tools (jq, yq, fd, rg, etc.) - JSON/YAML processing and transformation - File searching and text manipulation - System automation and orchestration Shell Scripting Excellence - POSIX-compliant shell scripting for maximum portability - Bash-specific features and best practices - Error handling and defensive programming - Cross-platform compatibility (Linux, macOS, BSD) Automation…