by sickn33
构建可靠的 shell 脚本需要防御性模式和全面测试。本工作流程将指导您创建具有正确错误处理、日志记录和自动化测试覆盖率的健壮 bash 脚本。
1. 打开 Claude 聊天界面
2. 点击下方 "📋 复制" 按钮
3. 粘贴到 Claude 聊天框中并发送
4. 输入 "使用 bash-scripting 技能" 开始使用
=== bash-scripting 技能 === 作者: sickn33 描述: 构建可靠的 shell 脚本需要防御性模式和全面测试。本工作流程将指导您创建具有正确错误处理、日志记录和自动化测试覆盖率的健壮 bash 脚本。 使用方法: 1. 调用技能: "使用 bash-scripting 技能" 2. 提供相关信息: 根据技能要求提供必要参数 3. 查看结果: 技能会返回处理结果 示例: "使用 bash-scripting 技能,帮我分析一下这段代码"
这种方法适用于所有 Claude 用户,不需要安装额外工具。
devops
safe
Specialized workflow for creating robust, production-ready bash scripts with defensive programming patterns, comprehensive error handling, and automated testing.
Use this workflow when:
bash-pro - Professional scriptingbash-defensive-patterns - Defensive patternsUse @bash-pro to design production-ready bash script
bash-pro - Script structurebash-defensive-patterns - Safety patternsUse @bash-defensive-patterns to implement strict mode and error handling
bash-linux - Linux commandslinux-shell-scripting - Shell scriptingUse @bash-linux to implement system commands
bash-defensive-patterns - Error handlingerror-handling-patterns - Error patternsUse @bash-defensive-patterns to add comprehensive error handling
bash-pro - Logging patternsUse @bash-pro to implement structured logging
bats-testing-patterns - Bats testingshellcheck-configuration - ShellCheckUse @bats-testing-patterns to write script tests
Use @shellcheck-configuration to lint bash script
documentation-templates - DocumentationUse @documentation-templates to document bash script
#!/usr/bin/env bash
set -euo pipefail
readonly SCRIPT_NAME=$(basename "$0")
readonly SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
log() { echo "[$(date '+%Y-%m-%d %H:%M:%S')] $*"; }
error() { log "ERROR: $*" >&2; exit 1; }
usage() { cat <<EOF
Usage: $SCRIPT_NAME [OPTIONS]
Options:
-h, --help Show help
-v, --verbose Verbose output
EOF
}
main() {
log "Script started"
# Implementation
log "Script completed"
}
main "$@"
os-scripting - OS scriptinglinux-troubleshooting - Linux troubleshootingcloud-devops - DevOps automationView Count
0
Download Count
0
Favorite Count
0
Quality Score
70