
Bash Defensive Patterns
Built for developers who've been burned by shell scripts failing in production. Implements bash strict mode, proper error trapping, and variable quoting patterns that prevent the usual disasters. Covers atomic file operations, signal handling for background processes, and idempotent script design. The argument parsing and logging templates alone will save you from reinventing wheels. Most valuable for CI/CD pipelines and system automation where a script failure at 2 AM costs real money. Takes the guesswork out of defensive bash programming with patterns that actually work in the wild.
- skills.sh installs
- 14.1K
- GitHub stars
- 42.4K
- last updated
- Aug 21, 2026
Install
$ npx -y skills add wshobson/agents --skill bash-defensive-patterns --agent claude-codeInstalls into .claude/skills of the current project.
Files
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
Detailed patterns and worked examples
Detailed pattern documentation lives in references/details.md. Read that file when the navigation tier above is insufficient.
Best Practices Summary
Sponsors
Details
- Repository
- github.com/wshobson/agents
- Categories
- DevOps & CI/CD, Documentation, CLI & Terminal
More from wshobson/agents
All 174- Visual Design Foundations14.1K
- Debugging Strategies13.9K
- Python Anti Patterns13.8K
- Stripe Integration13.8K
- Microservices Patterns13.7K
- Secrets Management13.6K
- Web Component Design13.6K
- Gitlab Ci Patterns13.6K
- Grafana Dashboards13.6K
- Langchain Architecture13.6K
- Protocol Reverse Engineering13.5K
- Python Packaging13.4K
- Llm Evaluation13.3K
- Python Type Safety13.2K
- Startup Financial Modeling13.1K
- React Modernization13.1K
- Wcag Audit Patterns13K
- Unity Ecs Patterns12.5K
- Workflow Orchestration Patterns12.5K
- Helm Chart Scaffolding12.4K
- Python Resilience12.2K
- Market Sizing Analysis12.2K
- Memory Safety Patterns12.2K
- Gitops Workflow12.1K