agentleFS
timfewitimfewi/unix-agent-skills/skills/system/portable-shell/SKILL.md

portable-shell

Skill2 starsChanged 10 days agoMITView on GitHub

Use for shell portability across bash, zsh, Linux, and macOS, especially globbing, word splitting, shebangs, or GNU/BSD option differences.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 2 are distinctive, and 0 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.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Create temporary paths securely, quote cleanup, and remove only paths the invocation owns.

    line 29
  2. Distinctive:

    Use available shell checks and exercise the affected behavior on reachable targets.

    line 36

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

Preserve shell and userland semantics

Establish the target shell and installed utilities where they affect the command. The login shell, script interpreter, and userland can differ. macOS can run GNU utilities; Linux can use BusyBox. Do not infer the executable from the OS or a rejected --version.

Failure-prone differences

  • zsh does not split unquoted $var like bash, and an unmatched glob normally errors. Use explicit arguments or arrays; quote patterns intended for tools.
  • zsh can expand a word starting with = as a command path. Quote literal separators such as '==='.
  • /bin/bash is not universal; macOS's system bash is 3.2. An environment shebang still needs a suitable interpreter in PATH. Avoid associative arrays, mapfile, and ${var,,} on that older target.
  • set -e is context-sensitive, not universal failure handling. Handle expected nonzero statuses explicitly and preserve pipeline failures where supported. Do not add strict-mode flags without checking the script's control flow and target shell.
  • Preserve arbitrary filenames with NUL-delimited processing or find ... -exec ... {} +; never parse ls. Quote expansions and protect leading-dash operands using the command's supported syntax.
  • Create temporary paths securely, quote cleanup, and remove only paths the invocation owns. Replacing a file can change permissions, links, or metadata.

For sed -i, dates, stat, canonical paths, xargs, checksums, and timeouts, consult references/gnu-bsd.md for the relevant difference rather than loading every platform recipe.

Use available shell checks and exercise the affected behavior on reachable targets. Name the tested shell/userland and any untested target; one Linux run does not prove macOS compatibility.

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.