Install any skill in seconds. Free to start, no credit card required.
Get Started Free →microck/bash-defensive-patterns
Master defensive Bash programming techniques for production-grade scripts.
Passed 24 of 25 test cases with the skill, and 20 of 25 without it.
and 3 more in the full report
5 fixed19 passed either way0 still failing1 broke
Tokens, turns and time describe resource use, not a dollar price.
One of 5 test cases the skill fixed. Same model, same prompt, with and without the skill.
I am creating a CI/CD build script in Bash that fetches deployment packages and unpacks them. I need a robust script template that guarantees temporary working directories are automatically removed when the script finishes or encounters an error, halts immediately if any command in a pipeline fails, and outputs timestamped log entries. Please write the complete Bash script with these reliability features included.
| Checked | Without skill | With skill |
|---|---|---|
| The script includes the exact strict mode flag setting set -Eeuo pipefail at the top. | Missed | Passed |
| The script uses an EXIT signal trap to automatically clean up temporary directories. | Passed | Passed |
The instructions your model reads when the skill loads.
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.
Enable bash strict mode at the start of every script to catch errors early.
#!/bin/bash
set -Eeuo pipefail # Exit on error, unset variables, pipe failures
Key flags:
set -E: Inherit ERR trap in functionsset -e: Exit on any error (command returns non-zero)set -u: Exit on undefined variable referenceset -o pipefail: Pipe fails if any command fails (not just last)Implement proper cleanup on script exit or error.
#!/bin/bash
set -Eeuo pipefail
trap 'echo "Error on line $LINENO"' ERR
trap 'echo "Cleaning up..."; rm -rf "$TMPDIR"' EXIT
test cases passed, vs 20 / 25 without
Published skills whose descriptions closely match this one, with their headline benchmark lift.
More skills from the same source and nearby in the registry, with their headline benchmark lift.