0128-bash-defensive-patterns

Community

Write safer Bash scripts with robust guards.

AuthorMrJmpl3
Version1.0.0
Installs0

System Documentation

What problem does it solve?

It prevents common Bash failures—silent error masking, unsafe variable handling, brittle parsing, and unmanaged cleanup—so your production scripts behave reliably under real-world edge cases.

Core Features & Use Cases

  • Strict mode foundations: Use set -Eeuo pipefail to fail fast on errors, unset variables, and broken pipelines.
  • Error trapping and cleanup: Add trap handlers for ERR and EXIT to log failures and reliably remove temporary resources.
  • Defensive safety patterns: Apply quoting discipline, safe arrays/read loops, robust argument parsing, structured logging, signal-aware orchestration, and atomic/idem-potent file operations.

Use Case: Build a CI/CD helper script that moves artifacts, validates inputs, logs meaningful status, and safely cleans up even when jobs are interrupted or commands fail mid-run.

Quick Start

Use the 0128-bash-defensive-patterns skill to harden your deployment Bash script by enabling strict mode, validating inputs, and adding traps for error logging and temporary file cleanup.

Dependency Matrix

Required Modules

None required

Components

Standard package

đź’» Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: 0128-bash-defensive-patterns
Download link: https://github.com/MrJmpl3/codex_____data_____configuration/archive/main.zip#0128-bash-defensive-patterns

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.