agentleFS
pesappesap/skills/bash-script/SKILL.md

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…

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
  1. Distinctive:

    Prefer the smallest reliable script that preserves the repository's existing shell, command, and output contracts.

    line 14
  2. Very specific:

    Use #!/usr/bin/env bash for Bash scripts.

    line 32
  3. Very specific:

    Treat filenames as hostile data: do not parse ls or raw find output.

    line 38
  4. Very specific:

    Use if command; then for command status, [[ ...

    line 41
  5. Very specific:

    Prefer $(...), printf, small named functions, and lowercase locals.

    line 44
  6. Distinctive:

    Use traps for temporary resources.

    line 46
  7. Very specific:

    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 …

    line 50
  8. Very specific:

    Keep privileged writes explicit.

    line 53
  9. Very specific:

    Use evals/trigger-prompts.json for trigger tuning and evals/evals.json for output-quality evaluation.

    line 69

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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

  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 -n, ShellCheck when available, and a bounded dry run or repository test. Exercise cleanup and failure paths when changed.

Guardrails

  • Use #!/usr/bin/env bash for Bash scripts. Add set -euo pipefail to 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 ls or raw find output. Use globs, find -exec, or NUL-delimited input, and protect leading dashes with -- or safe path prefixes.
  • Use if command; then for 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, and NO_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 || cmd3 as general control flow.
  • Keep privileged writes explicit; remember that sudo cmd > file does 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, and xargs.
  • 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.