PluginBench
Skill
Pass
Audit score 90

bash-scripting

sickn33/agentic-awesome-skills

Workflow for creating production-ready bash scripts with defensive patterns, error handling, and testing.

What is bash-scripting?

A structured workflow for building robust shell scripts with defensive programming, comprehensive error handling, and automated testing. Use this when creating automation, system administration, deployment, or CI/CD scripts that need to be reliable and maintainable.

  • Design scripts with clear purpose, inputs, outputs, and error-handling strategy
  • Implement strict mode, argument parsing, logging, and cleanup handlers
  • Add comprehensive error handling with trap handlers, retry logic, and rollback capability
  • Write and run Bats tests and ShellCheck linting for quality assurance
  • Create structured logging with levels, timestamps, and debug modes
  • Document scripts with headers, function descriptions, usage examples, and dependencies

How to install bash-scripting

npx skills add https://github.com/sickn33/agentic-awesome-skills --skill bash-scripting
Claude Code
Cursor
Windsurf
Cline

How to use bash-scripting

  1. 1.Define your script's purpose, inputs, outputs, and error-handling requirements
  2. 2.Use bash-pro and bash-defensive-patterns to design the script structure with shebang, strict mode, and argument parsing
  3. 3.Implement core functionality using bash-linux and linux-shell-scripting skills
  4. 4.Add comprehensive error handling with trap handlers, retry logic, and exit codes using bash-defensive-patterns
  5. 5.Implement structured logging with levels and timestamps using bash-pro
  6. 6.Write Bats tests and run ShellCheck linting using bats-testing-patterns and shellcheck-configuration
  7. 7.Document the script with headers, function descriptions, usage examples, and troubleshooting information

Use cases

Good for
  • Building deployment and CI/CD automation scripts with robust error handling
  • Creating system administration tools for backup, monitoring, or maintenance tasks
  • Developing infrastructure automation that requires defensive patterns and comprehensive logging
  • Writing shell scripts that need to be tested, linted, and documented for production use
  • Implementing scripts with retry logic, rollback capability, and detailed error reporting
Who it's for
  • DevOps engineers and system administrators
  • Backend developers building automation tools
  • Infrastructure engineers creating deployment scripts
  • Anyone writing shell scripts intended for production environments

bash-scripting FAQ

What is strict mode in bash?

Strict mode uses `set -euo pipefail` to exit on errors, treat undefined variables as errors, and fail on pipe errors—making scripts more defensive and easier to debug.

When should I use this workflow versus writing a simple script?

Use this workflow when creating scripts for production, automation, or systems that need to be reliable, maintainable, and tested. For one-off scripts, simpler approaches may suffice.

What testing framework does this workflow use?

The workflow uses Bats (Bash Automated Testing System) for writing and running tests, combined with ShellCheck for static linting and code quality checks.

How does the workflow handle errors?

It uses trap handlers to catch errors, implements retry logic for transient failures, provides clear error messages, sets appropriate exit codes, and includes rollback capability where needed.

What should I document in my script?

Include a script header with purpose, document all functions with their inputs and outputs, provide usage examples, list dependencies, and add a troubleshooting section.

Full instructions (SKILL.md)

Source of truth, from sickn33/agentic-awesome-skills.


name: bash-scripting description: "Bash scripting workflow for creating production-ready shell scripts with defensive patterns, error handling, and testing." category: granular-workflow-bundle risk: safe source: personal date_added: "2026-02-27"

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

  1. Define script purpose
  2. Identify inputs/outputs
  3. Plan error handling
  4. Design logging strategy
  5. 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

  1. Add shebang and strict mode
  2. Create usage function
  3. Implement argument parsing
  4. Set up logging
  5. 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

  1. Implement main functions
  2. Add input validation
  3. Create helper functions
  4. Handle edge cases
  5. 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

  1. Add trap handlers
  2. Implement retry logic
  3. Create error messages
  4. Set up exit codes
  5. 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

  1. Create logging function
  2. Add log levels
  3. Implement timestamps
  4. Configure log rotation
  5. 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

  1. Write Bats tests
  2. Run ShellCheck
  3. Test edge cases
  4. Verify error handling
  5. 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

  1. Add script header
  2. Document functions
  3. Create usage examples
  4. List dependencies
  5. 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

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.