Skip to content
sickn33 avatar

Bash Defensive Patterns

Defensive Bash guidance for production scripts covering strict mode, input validation, safe file handling, and logging.

CCM score
43 of 100
skills.sh installs
319
GitHub stars
50.5K
last updated
Jun 3, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers strict mode setup, quoting and input validation, safe file handling, error traps, logging, and basic script tests
  • Includes a playbook at resources/implementation-playbook.md with patterns, checklists, and templates for shell scripts
  • Requires explicit approval before destructive or irreversible actions and provides dry-run flags before modifying operations
  • Designed for CI/CD pipelines, system administration utilities, and deployment automation that must tolerate edge cases

Install

$ npx -y skills add sickn33/agentic-awesome-skills --skill bash-defensive-patterns -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

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.

Use this skill when

  • 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

Do not use this skill when

  • You need a single ad-hoc shell command, not a script
  • The target environment requires strict POSIX sh only
  • The task is unrelated to shell scripting or automation

Instructions

  1. Confirm the target shell, OS, and execution environment.
  2. Enable strict mode and safe defaults from the start.
  3. Validate inputs, quote variables, and handle files safely.
  4. Add logging, error traps, and basic tests.
  5. Require explicit user approval before running destructive, irreversible, or high-impact operations.

Safety

Details

Repository
github.com/sickn33/agentic-awesome-skills
Categories
CLI & Terminal, DevOps & Cloud, Security
First seen
Jun 3, 2026

Questions

What does the bash-defensive-patterns skill do?

bash-defensive-patterns guides an agent in writing production-grade Bash scripts with strict mode, quoted variables, safe file handling, input validation, logging and error traps. It is meant for CI/CD pipelines, deployment automation and system utilities that must tolerate faults.

Who should use the bash-defensive-patterns skill?

bash-defensive-patterns suits developers building production automation scripts, CI/CD pipeline scripts or system administration utilities. It is not meant for a single ad-hoc shell command or for targets that require strict POSIX sh only.

How do I install the bash-defensive-patterns skill?

Run npx -y skills add sickn33/agentic-awesome-skills --skill bash-defensive-patterns -y inside your project. Once installed, the agent can apply bash-defensive-patterns when writing robust shell scripts, and it asks for approval before any destructive operation.

More from sickn33/agentic-awesome-skills

All 682

Similar to Bash Defensive Patterns

More CLI & Terminal