New to Claude Skills? Learn how to install them →

sickn33 on GitHub

Bash Scripting Workflow

Free

Create robust shell scripts with error handling and testing.

Get this skill

Free · Opens the source repo

What Bash Scripting Workflow does

The Bash Scripting Workflow skill is designed for developers and system administrators who need to create production-ready shell scripts. It emphasizes defensive programming patterns and comprehensive error handling, ensuring that scripts are not only functional but also resilient against unexpected inputs and failures. This workflow guides users through a structured process, making it easier to develop automation scripts, system administration tools, deployment scripts, and more.

The workflow is divided into several phases, starting with script design, where users define the purpose and requirements of the script. It encourages planning for error handling and logging from the outset, which is crucial for maintaining scripts in production environments. The subsequent phases focus on structuring the script, implementing core functionalities, and ensuring robust error handling mechanisms are in place.

One of the standout features of this skill is its emphasis on testing. Users are guided to write Bats tests and utilize ShellCheck for linting, which helps catch potential issues before deployment. This focus on testing not only improves the reliability of the scripts but also enhances the developer's confidence in their code. Additionally, the workflow includes a thorough documentation phase, ensuring that scripts are well-documented for future reference and maintenance.

Overall, this skill is ideal for anyone looking to streamline their bash scripting process while adhering to best practices. It provides a comprehensive framework that can significantly reduce the time spent on debugging and maintenance, allowing developers to focus on building features rather than fixing errors.

When to use it

Use this workflow when developing automation scripts, system administration tools, or CI/CD scripts that require robust error handling and testing.

When not to use it

This skill may not be suitable for simple scripts or one-off tasks that do not require the level of rigor and documentation this workflow enforces.

What you can build with it

Automating Backups

Use this workflow to create a reliable backup script that handles errors and logs its actions.

Deployment Scripts

Implement a deployment script that ensures safe execution with comprehensive error handling and rollback capabilities.

CI/CD Pipeline Integration

Develop scripts for CI/CD processes that require automated testing and error handling to ensure smooth deployments.

How to install Bash Scripting Workflow

View source

1. Install with the skills CLI

npx skills add sickn33/agentic-awesome-skills/bash-scripting --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by sickn33

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.

Frequently asked questions about Bash Scripting Workflow

Similar skills