← ClaudeAtlas

shell-scriptinglisted

Write production-grade shell and CLI scripts — Bash and Python. Use when authoring or reviewing any script, Makefile target, hook, CI step, or automation that takes input, does work, and reports a result. Enforces runtime arguments (not hardcoded paths), fail-closed error handling, progress/observable output, idempotency, algorithmic efficiency, and precise machine-readable results. Triggers — "write a script", "bash script", "make target", "automate", "cron job", "CLI tool", any `*.sh`/`scripts/*.py`. Pairs with clean-code (naming/structure), deployment-cicd (CI steps), observability (log hygiene), hook-authoring (coding-os hooks).
kouroshez/coding-os · ★ 6 · Code & Development · score 77
Install: claude install-skill kouroshez/coding-os
# Shell & CLI Scripting A script is a **contract**: given inputs, do exactly one job, report a precise result, fail loud on anything unexpected. A script that hardcodes a path, swallows errors, or prints a paragraph the caller must parse is a liability — it breaks silently in the next environment and taxes every agent that runs it. This skill makes "robust, data-driven, observable" the default shape. > Scaffold a compliant script instead of hand-writing the boilerplate: > `python3 scripts/new_script.py --lang bash --name deploy --root .` > Lint an existing one against the discipline: > `bash scripts/lint_script.sh path/to/script.sh` ## The seven non-negotiables Every script — Bash or Python — satisfies all seven. The checklist in [assets/script-checklist.md](assets/script-checklist.md) is the ship gate. 1. **Runtime arguments, never hardcoded.** Inputs come from flags with sane defaults. No literal machine paths, no baked-in hostnames, no magic constants buried in the body. 2. **Fail-closed.** Any unmet precondition or sub-command failure stops the script with a non-zero exit and a message — never continue on error. 3. **Idempotent.** Re-running is safe: detect already-done state, refuse to clobber (or require `--force`). 4. **Observable.** Progress to stderr for anything slow; a final, parseable result (one line or `--json`) on stdout. 5. **Precise output.** stdout is the *result* a caller consumes; stderr is *narration*. Never mix them. 6. **Algorithmically honest.** N