bash-script
Skill1 starsChanged 3 months agoMITView on GitHub
Prefer the smallest reliable script that preserves the repository's existing shell, command, and output contracts. Decide whether Bash is still suitable before expanding a long-lived or data-heavy script. 1. Inspect the script, callers, target environments, repository guidance, and existing lint or test commands. 2. Identify the input, output, exit-code, side-effect, cleanup, and interactive/non-interactive contracts. 3. Reproduce failures before editing when practical. 4. Apply the smallest root-cause change; keep behavior idempotent where repeated execution is plausible. 5. Validate narrowly with bash…
In this repository14 other files it gives its agents.
- audit-pi-sessionSkill
- cli-uxSkill
- code-quality-gateSkill
- docs-pesapSkill
- external-reviewSkill
- githubSkill
- gitlabSkill
- good-apiSkill
- prekSkill
- pythonSkill
- rust-pesapSkill
- tdd-pesapSkill
- torcSkill
- uvSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 2 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
Prefer the smallest reliable script that preserves the repository's existing shell, command, and output contracts.
- Very specific: line 32
Use #!/usr/bin/env bash for Bash scripts.
- Very specific: line 38
Treat filenames as hostile data: do not parse ls or raw find output.
- Very specific: line 41
Use if command; then for command status, [[ ...
- Very specific: line 44
Prefer $(...), printf, small named functions, and lowercase locals.
- Distinctive: line 46
Use traps for temporary resources.
- Very specific: line 50
Do not parse structured JSON/YAML with ad hoc text processing, read and write the same file in one pipeline, or use cmd1 && cmd2 || cmd3 as …
- Very specific: line 53
Keep privileged writes explicit.
- Very specific: line 69
Use evals/trigger-prompts.json for trigger tuning and evals/evals.json for output-quality evaluation.
≈ “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
Bash scripts
Prefer the smallest reliable script that preserves the repository's existing shell, command, and output contracts. Decide whether Bash is still suitable before expanding a long-lived or data-heavy script.
Core workflow
- Inspect the script, callers, target environments, repository guidance, and existing lint or test commands.
- Identify the input, output, exit-code, side-effect, cleanup, and interactive/non-interactive contracts.
- Reproduce failures before editing when practical.
- Apply the smallest root-cause change; keep behavior idempotent where repeated execution is plausible.
- Validate narrowly with
bash -n, ShellCheck when available, and a bounded dry run or repository test. Exercise cleanup and failure paths when changed.
Guardrails
- Use
#!/usr/bin/env bashfor Bash scripts. Addset -euo pipefailto non-trivial scripts, but still handle critical failures explicitly; strict mode is not a substitute for reasoning about command status. - Bind positional and function arguments to named variables immediately. Quote expansions by default and use arrays instead of space-delimited command strings.
- Treat filenames as hostile data: do not parse
lsor rawfindoutput. Use globs,find -exec, or NUL-delimited input, and protect leading dashes with--or safe path prefixes. - Use
if command; thenfor command status,[[ ... ]]for Bash string and pattern tests, and(( ... ))for arithmetic after validating untrusted numeric input. - Prefer
$(...),printf, small named functions, and lowercase locals; reserve uppercase names for exported environment variables. - Use traps for temporary resources. Preserve the original exit code and make cleanup tolerant of partially created state.
- Send diagnostics to stderr. Gate tracing, color, animation, and prompts;
honor TTY state,
CI, andNO_COLOR, and provide flags for automation. - Do not parse structured JSON/YAML with ad hoc text processing, read and write
the same file in one pipeline, or use
cmd1 && cmd2 || cmd3as general control flow. - Keep privileged writes explicit; remember that
sudo cmd > filedoes not elevate the shell redirection. - Recommend Python or another language when the script accumulates complex data structures, business logic, deep control flow, or fragile quoting.
Reference router
Open only the reference whose trigger matches the task:
- Modern Bash — strict mode, cleanup, logging, operator UX, and deciding when to stop using Bash.
- Bash pitfalls — filename handling, quoting,
tests, pipelines, arrays, arithmetic,
sudo,find, andxargs. - Bash cheatsheet — function structure, redirection, heredocs, and debugging patterns.
Use evals/trigger-prompts.json for trigger tuning and evals/evals.json for
output-quality evaluation; do not load them during normal script work.
Output
Report Bash suitability, the contract and safety choices that mattered, files changed, validation commands and results, interactive/CI behavior, and any remaining reason to migrate away from Bash.
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.

