shell-guide

Installation
SKILL.md

Shell/Bash Guide

Applies to: Bash 4+, POSIX sh, Automation Scripts, CI/CD Pipelines, Makefiles

Core Principles

  1. Strict Mode Always: Every script starts with set -euo pipefail to fail fast on errors
  2. Quote Everything: All variable expansions must be double-quoted to prevent word splitting and globbing
  3. Explicit Over Implicit: Use [[ ]] for conditionals, local for function variables, named constants for magic values
  4. Fail Loudly: Never swallow errors silently; use trap for cleanup and meaningful exit codes
  5. ShellCheck Clean: All scripts pass shellcheck with zero warnings before commit

Guardrails

Shebang and Strict Mode

  • Every script: #!/usr/bin/env bash (or #!/bin/sh for POSIX)
  • Immediately follow with set -euo pipefail
  • Use set -x only for debugging, never in production scripts
Related skills
Installs
7
Repository
ar4mirez/samuel
First Seen
Mar 1, 2026