reviewer-shell
Skill0 starsChanged 56 days agoMITView on GitHub
Review shell scripts (.sh, .bash, files with a sh or bash shebang). Use when reviewing changes to scripts, or when the user types /reviewer-shell. Catches unquoted expansions, set -e and pipefail traps, wrong root-path detection, macOS bash 3.2 and BSD-versus-GNU portability breaks, dangerous rm on empty variables, prompts that hang CI, leaked secrets, missing cleanup traps, and help text out of sync with the commands. Part of the reviewer bundle.
- Reads credentials
- Deletes or force-pushes
In this repository15 other files it gives its agents.
- ai-scaffoldingSkill
- comment-hygieneSkill
- microfrontendsSkill
- reviewer-cloudflareSkill
- reviewer-dataSkill
- reviewer-docsSkill
- reviewer-godotSkill
- reviewer-pythonSkill
- reviewer-readabilitySkill
- reviewer-toolingSkill
- reviewer-unitySkill
- reviewer-webSkill
- reviewerSkill
- startup-scriptSkill
- typed-blocksSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 0 are distinctive, and 4 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.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 13
Run shellcheck -x <file> if it is installed, and report the warnings that matter.
- Very specific: line 14
Run bash -n <file> for syntax.
- Very specific: line 28
Every "$var", "$(cmd)" and "${arr[@]}" is quoted.
- Very specific: line 76
Use the reviewer format: [severity] path:line — problem, then failure: (the concrete input, state or platform → wrong result) and fix: (the …
≈ “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
Shell reviewer
Scope: *.sh, *.bash, and executables with a sh or bash shebang. Find out where each script runs: macOS (bash 3.2, BSD tools), Linux CI (bash 5, GNU tools), or both.
Before reviewing
- Run
shellcheck -x <file>if it is installed, and report the warnings that matter. - Run
bash -n <file>for syntax. Run<script> --helpor the no-argument path when that is safe.
Checklist
Failure handling
- Bash scripts start with
set -euo pipefail, or handle errors explicitly. set -edoes not fire insideif,while,&&/||lists, or functions called from them. A failing command there continues silently.local x=$(cmd)andexport x=$(cmd)hidecmd's exit status. Declare first, then assign.- With
pipefail,cmd | grep -q xorcmd | headcan fail with 141 (SIGPIPE) once the reader exits early. - Errors go to stderr, and the script exits non-zero.
Quoting and expansion
- Every
"$var","$(cmd)"and"${arr[@]}"is quoted. Paths with spaces (~/Library/Application Support) break unquoted code. rm -rf "$dir/"with an emptydirdeletes from/. Use"${dir:?}".- Code tested in an interactive zsh can behave differently in bash, because zsh does not word-split unquoted variables.
Paths
- Find the repo root from the script's location:
"$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)".$0andpwdare wrong when the script is sourced or run from another directory. - A sourced library guards its entry point:
[ "${BASH_SOURCE[0]}" = "$0" ] && main "$@".exitinside a sourced function ends the caller's shell. - Temp files come from
mktemp, never a fixed/tmpname. Cleanup and restoration of modified files go intrap … EXIT.
Portability
- macOS ships bash 3.2: no
declare -A,mapfile/readarray,${var,,}or${var^^}."${arr[@]}"on an empty array fails underset -ubefore bash 4.4. - BSD and GNU differ:
sed -i ''vssed -i,date -vvsdate -d,stat -fvsstat -c, noreadlink -forgrep -Pon macOS. A script that runs on both must use the common subset or branch onuname. echo -eandecho -nare not portable. Useprintf.
Interaction and side effects
- Prompts (
read) are guarded by[ -t 0 ], so CI and pipes never hang. Every menu choice has a non-interactive command. - Downloads use
curl -fL(-fmakes HTTP errors fail). Large downloads ask first and say the size. - Background jobs (
&, servers) are waited on or killed on exit. - Destructive steps (
rm,git reset, store uploads, deploys) are explicit commands, never a side effect of a default path.
Secrets
- Tokens never go to
echo,set -xoutput or command-line arguments (visible inps). Pass them through the environment. - Keystores and
.envfiles are read from ignored paths only.
Consistency
- The usage text and header comment list exactly the commands and flags the
casebranches handle. - Shared helpers come from the project's
lib/files instead of being copied into each script.
Readability
Apply reviewer-readability to the same files (names, structure, dead code, and whether comments are true, needed and well-shaped), plus:
- The header comment lists every command and flag exactly as the
casebranches handle them, with a one-line description each. - Functions are named by what they do (
export_web,adb_state); globals that tune behaviour areUPPER_CASEand set near the top. - Non-obvious flags and quirks get a one-line why (
sed -i ''for BSD sed,|| truethat is deliberate, apipefailworkaround). Long pipelines break across lines with a trailing\.
Not findings
- Style that shellcheck does not flag and the project does consistently.
sh-incompatible syntax in a script with a bash shebang.
Report
Use the reviewer format: [severity] path:line — problem, then failure: (the concrete input, state or platform → wrong result) and fix: (the smallest change). Most severe first. Prove each finding before reporting it, and say No findings with what you checked when there are none.
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.

