Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Writes Bash scripts with strict mode, defensive quoting, error and exit traps, safe temp files, and ShellCheck-clean fixes.
82% 100%+18 ptsof test cases passed
Passed 22 of 22 test cases with the skill, and 18 of 22 without it.
3 of 3 safety checks passed
Not used yet
Most Bash bugs are silent: an unset variable expands to nothing, a failed command is ignored, an unquoted path word-splits, and the script marches on corrupting state. This skill makes Bash scripts fail loudly, fail early, and clean up after themselves.
Keywords: bash, shell, strict mode, set -euo pipefail, IFS, quoting, word splitting, globbing, ShellCheck, trap, ERR, EXIT, cleanup, mktemp, signal handling, defensive scripting, POSIX, exit codes, here-doc, arrays.
Use this skill to author a new script from a hardened template, retrofit an existing script, or review a script for safety defects.
#!/usr/bin/env bash and the canonical strict-mode preamble (see below). Never rely on /bin/sh if Bash features are used.IFS=$'\n\t' so unquoted expansions don't split on spaces.EXIT trap that removes temp files and restores state, plus an ERR trap for diagnostics.mktemp, and reference them through the cleanup trap.command -v), required env vars.# shellcheck disable=SCxxxx comment.Reference files:
references/strict-mode.md — deep dive on set -euo pipefail, IFS, and the gotchas/escape hatches.references/shellcheck-codes.md — the most common ShellCheck codes, what they mean, and the correct fix.templates/hardened-script.sh — drop-in starting template with strict mode, traps, arg parsing, logging.scripts/harden_check.sh — static auditor that flags missing strict mode, unquoted vars, and other red flags.examples/before-after.md — a real fragile script transformed into a hardened one, line by line.#!/usr/bin/env bash
set -Eeuo pipefail
IFS=$'\n\t'
What each flag buys you:
Skills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.