首页/DevOps/bash-scripting
B

bash-scripting

by @sickn33v1.0.0
0.0(0)

专业化创建健壮的生产级Bash脚本工作流,内置防御性编程模式确保脚本可靠运行

bashshell-scriptingdefensive-programmingautomationGitHub
安装方式
npx skills add sickn33/antigravity-awesome-skills --skill bash-scripting
compare_arrows

Before / After 效果对比

1
使用前

编写Bash脚本缺乏规范,错误处理不完善,边界情况考虑不周,脚本在生产环境中频繁出现意外失败,排查和维护困难

使用后

按照防御性编程模式生成健壮脚本,内置错误处理、参数校验和日志记录,边界情况全面覆盖,生产环境稳定可靠运行

description SKILL.md

bash-scripting

Bash Scripting Workflow

Overview

Specialized workflow for creating robust, production-ready bash scripts with defensive programming patterns, comprehensive error handling, and automated testing.

When to Use This Workflow

Use this workflow when:

  • Creating automation scripts

  • Writing system administration tools

  • Building deployment scripts

  • Developing backup solutions

  • Creating CI/CD scripts

Workflow Phases

Phase 1: Script Design

Skills to Invoke

  • bash-pro - Professional scripting

  • bash-defensive-patterns - Defensive patterns

Actions

  • Define script purpose

  • Identify inputs/outputs

  • Plan error handling

  • Design logging strategy

  • Document requirements

Copy-Paste Prompts

Use @bash-pro to design production-ready bash script

Phase 2: Script Structure

Skills to Invoke

  • bash-pro - Script structure

  • bash-defensive-patterns - Safety patterns

Actions

  • Add shebang and strict mode

  • Create usage function

  • Implement argument parsing

  • Set up logging

  • Add cleanup handlers

Copy-Paste Prompts

Use @bash-defensive-patterns to implement strict mode and error handling

Phase 3: Core Implementation

Skills to Invoke

  • bash-linux - Linux commands

  • linux-shell-scripting - Shell scripting

Actions

  • Implement main functions

  • Add input validation

  • Create helper functions

  • Handle edge cases

  • Add progress indicators

Copy-Paste Prompts

Use @bash-linux to implement system commands

Phase 4: Error Handling

Skills to Invoke

  • bash-defensive-patterns - Error handling

  • error-handling-patterns - Error patterns

Actions

  • Add trap handlers

  • Implement retry logic

  • Create error messages

  • Set up exit codes

  • Add rollback capability

Copy-Paste Prompts

Use @bash-defensive-patterns to add comprehensive error handling

Phase 5: Logging

Skills to Invoke

  • bash-pro - Logging patterns

Actions

  • Create logging function

  • Add log levels

  • Implement timestamps

  • Configure log rotation

  • Add debug mode

Copy-Paste Prompts

Use @bash-pro to implement structured logging

Phase 6: Testing

Skills to Invoke

  • bats-testing-patterns - Bats testing

  • shellcheck-configuration - ShellCheck

Actions

  • Write Bats tests

  • Run ShellCheck

  • Test edge cases

  • Verify error handling

  • Test with different inputs

Copy-Paste Prompts

Use @bats-testing-patterns to write script tests

Use @shellcheck-configuration to lint bash script

Phase 7: Documentation

Skills to Invoke

  • documentation-templates - Documentation

Actions

  • Add script header

  • Document functions

  • Create usage examples

  • List dependencies

  • Add troubleshooting section

Copy-Paste Prompts

Use @documentation-templates to document bash script

Script Template

#!/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 "$@"

Quality Gates

  • ShellCheck passes

  • Bats tests pass

  • Error handling works

  • Logging functional

  • Documentation complete

Related Workflow Bundles

  • os-scripting - OS scripting

  • linux-troubleshooting - Linux troubleshooting

  • cloud-devops - DevOps automation

Weekly Installs196Repositorysickn33/antigra…e-skillsGitHub Stars25.7KFirst SeenFeb 24, 2026Security AuditsGen Agent Trust HubPassSocketPassSnykPassInstalled ongithub-copilot195opencode195gemini-cli194amp194cursor194codex194

forum用户评价 (0)

发表评价

效果
易用性
文档
兼容性

暂无评价,来写第一条吧

统计数据

安装量0
评分0.0 / 5.0
版本1.0.0
更新日期2026年3月19日
对比案例1 组

用户评分

0.0(0)
5
0%
4
0%
3
0%
2
0%
1
0%

为此 Skill 评分

0.0

兼容平台

🔧Claude Code

时间线

创建2026年3月19日
最后更新2026年3月19日