linux-script-developer
Skill1 starsChanged 4 months agoMITView on GitHub
Write production-ready Bash scripts with strict error handling (`set -euo pipefail`), validated argument parsing, colored user feedback, and cross-platform compatibility (Linux, macOS, Windows via Git Bash/WSL). Use this skill whenever the user asks for a `.sh` script, a shell script, a Bash one-liner installer, a CLI wrapper, or a file-batch processor, and for server and deployment automation generally: releasing or rolling back a build, restarting or health-checking a service, scheduled and cron jobs, log rotation, backup and restore, syncing files between machines, and bootstrapping a box. Includes casual phrasings like "write a script to ...", "automate this in bash", or "make me a shell tool". Also use when reviewing or hardening an existing Bash script.
In this repository24 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- architecture-auditSkill
- autodreamSkill
- deep-discoverySkill
- generic-by-designSkill
- gitops-cd-developerSkill
- gitops-pipeline-developerSkill
- golang-script-developerSkill
- humanizerSkill
- information-architectureSkill
- interactive-deck-builderSkill
- javascript-script-developerSkill
- makefile-script-developerSkill
- plan-interviewSkill
- pre-commit-setupSkill
- python-script-developerSkill
- qaSkill
- skill-builderSkill
- teacher-modeSkill
- terraform-module-developerSkill
- typescript-script-developerSkill
- ui-deslopSkill
- xquik-x-dataSkill
The file
We split this skill into the rules it gives an agent
12 rules. About 0 are common, 0 are distinctive, and 12 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
12
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 43
Every script you write starts from this skeleton.
- Very specific: line 81
Validate the result: Run bash scripts/validate-script.sh <your-script.sh> — it grep-scans the script and checks shebang, strict mode, …
- Very specific: line 104
Trap cleanup on EXIT/ERR: when creating temp files: trap 'rm -f "$TMP"' EXIT.
- Very specific: line 109
Start every script from assets/templates/.
- Very specific: line 110
Use set -euo pipefail from the first line of logic.
- Very specific: line 114
Use functions for any logic block over ~5 lines.
- Very specific: line 115
Use ${SCRIPT_DIR} and relative paths.
- Very specific: line 117
Run scripts/validate-script.sh on the result.
- Very specific: line 119
Test cross-platform tooling differences (see references/cross-platform.md) when the script will run anywhere besides the author's machine.
- Very specific: line 124
Use unquoted variables, hardcoded absolute paths, or cd without a guard.
- Very specific: line 125
Use GNU-only flags (grep -P, date -d, readlink -f, mktemp --suffix) without a portable fallback.
- Very specific: line 126
Write monolithic scripts with logic outside functions, or skip the usage function.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Linux Script Developer
Production-ready Bash. Strict mode + input validation + cross-platform.
When to use
- The user asks for any
.shscript, installer, automation, or CLI wrapper. - The user wants to harden, refactor, or review an existing Bash script.
- A task chain ends in "and put it in a shell script".
Required structure
Every script you write starts from this skeleton. Do not omit set -euo pipefail or the main "$@" invocation.
#!/usr/bin/env bash
set -euo pipefail
readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
readonly SCRIPT_NAME="$(basename "$0")"
# Colors only when stdout is a TTY (avoids garbage in pipes/CI logs)
if [ -t 1 ]; then
RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[1;33m'; BLUE='\033[0;34m'; NC='\033[0m'
else
RED=''; GREEN=''; YELLOW=''; BLUE=''; NC=''
fi
usage() {
cat <<EOF
Usage: $SCRIPT_NAME [OPTIONS] <args>
EOF
exit "${1:-0}"
}
main() {
[ "$#" -ge 1 ] || { echo -e "${RED}Error: missing args${NC}" >&2; usage 1; }
# logic here
}
main "$@"Workflow
- Pick a starting template from
assets/templates/— copy and edit, do not rewrite from scratch:script.template.sh— basic single-purpose script.cli-tool.template.sh— multi-subcommand CLI (init / build / deploy style).file-processor.template.sh— batch operations over files.
- Apply the patterns in
references/patterns.mdfor any non-obvious case (traps, getopts, template processing, while-read loops). Read it on demand — don't preload it. - Validate the result. Run
bash scripts/validate-script.sh <your-script.sh>— it grep-scans the script and checks shebang, strict mode, header comment,usage/mainpatterns, quoted positional args, noeval, no hardcoded user-home paths, TTY-guarded ANSI codes, GNU-only flags, and stderr redirection. Aim for ≥ 90%. - Cross-check against the gotchas in
references/anti-patterns.mdbefore finishing — especially unquoted vars, hardcoded paths, and missing input validation. - For cross-platform scripts (running on macOS or Windows), load
references/cross-platform.mdand apply the relevant rules (sed-i'',readlink -freplacements,grep -Enot-P). - Generate man-page-style reference docs for the script using the template in
references/documentation.md. Always do this — either inline as a markdown block or as a sibling<script>.md.
Available resources
assets/templates/{script,cli-tool,file-processor}.template.sh— starting points.assets/examples/scaffold-example.sh— full reference implementation.scripts/validate-script.sh— score a script against the checklist (run after writing).references/patterns.md— load when implementing error handling, parsing, traps, templates, loops.references/anti-patterns.md— load when reviewing or rewriting an existing script.references/cross-platform.md— load when targeting macOS or Windows alongside Linux.references/documentation.md— load when generating script reference docs.
Top gotchas (always inline — do not skip)
- Quote everything.
cat $filebreaks on spaces; alwayscat "$file". set -euo pipefailis the minimum.-eexits on error,-uon undefined vars,pipefailpropagates pipe failures.#!/usr/bin/env bash, never#!/bin/bash. macOS ships an old Bash at/bin/bash; Alpine uses/bin/sh.- Validate args before using them. Fail loudly with a clear message and
usage, not a crypticunbound variable. - Use
[ -t 1 ]before emitting ANSI codes so output is clean when piped or in CI logs. - Use
${SCRIPT_DIR}/ relative paths, never hardcode/home/user/.... - Trap cleanup on EXIT/ERR when creating temp files:
trap 'rm -f "$TMP"' EXIT. - macOS
sed -irequires an empty string:sed -i'' -e 's/a/b/' fileworks on both macOS and Linux.
What you DO
- Start every script from
assets/templates/. - Use
set -euo pipefailfrom the first line of logic. - Quote every variable expansion:
"$var","$@","${arr[@]}". - Validate every input — count, type, file existence — before using it.
- Emit colored messages only when
[ -t 1 ]. - Use functions for any logic block over ~5 lines; keep
main()thin. - Use
${SCRIPT_DIR}and relative paths; never hardcode absolute paths outside the user's project. - Trap cleanup on
EXIT/ERRwhen you create temp files or background processes. - Run
scripts/validate-script.shon the result; iterate until ≥ 90%. - Generate man-page-style reference documentation alongside the script (see
references/documentation.md). - Test cross-platform tooling differences (see
references/cross-platform.md) when the script will run anywhere besides the author's machine.
What you do NOT do
- Skip
set -e, leave bareexcept/no error handling, or useeval/bash -c "$user_input". - Use unquoted variables, hardcoded absolute paths, or
cdwithout a guard. - Use GNU-only flags (
grep -P,date -d,readlink -f,mktemp --suffix) without a portable fallback. - Write monolithic scripts with logic outside functions, or skip the
usagefunction. - Emit ANSI color codes unconditionally — they pollute logs and pipes.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

