bash-defensive-patterns

Installation
Summary

Production-grade Bash scripting with strict error handling, defensive patterns, and safety best practices.

  • Covers 10 fundamental patterns including strict mode (set -Eeuo pipefail), error trapping, variable quoting, array handling, and safe temporary file management
  • Includes advanced techniques for argument parsing, structured logging, process orchestration with signals, and idempotent script design
  • Provides templates for function definitions, file operations, command substitution, and dry-run support to prevent common pitfalls
  • Emphasizes input validation, dependency checking, and cleanup mechanisms to ensure reliability across different platforms and edge cases
SKILL.md

Bash Defensive Patterns

Comprehensive guidance for writing production-ready Bash scripts using defensive programming techniques, error handling, and safety best practices to prevent common pitfalls and ensure reliability.

When to Use This Skill

  • Writing production automation scripts
  • Building CI/CD pipeline scripts
  • Creating system administration utilities
  • Developing error-resilient deployment automation
  • Writing scripts that must handle edge cases safely
  • Building maintainable shell script libraries
  • Implementing comprehensive logging and monitoring
  • Creating scripts that must work across different platforms

Core Defensive Principles

1. Strict Mode

Related skills

More from wshobson/agents

Installs
6.7K
Repository
wshobson/agents
GitHub Stars
35.3K
First Seen
Jan 20, 2026